1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_CONTENT_LAYER_H_
6 #define CC_LAYERS_CONTENT_LAYER_H_
8 #include "base/basictypes.h"
9 #include "cc/base/cc_export.h"
10 #include "cc/layers/tiled_layer.h"
11 #include "cc/resources/layer_painter.h"
17 class ContentLayerClient
;
18 class ContentLayerUpdater
;
20 class CC_EXPORT ContentLayerPainter
: public LayerPainter
{
22 static scoped_ptr
<ContentLayerPainter
> Create(ContentLayerClient
* client
);
24 void Paint(SkCanvas
* canvas
, const gfx::Rect
& content_rect
) override
;
27 explicit ContentLayerPainter(ContentLayerClient
* client
);
29 ContentLayerClient
* client_
;
31 DISALLOW_COPY_AND_ASSIGN(ContentLayerPainter
);
34 // A layer that renders its contents into an SkCanvas.
35 class CC_EXPORT ContentLayer
: public TiledLayer
{
37 static scoped_refptr
<ContentLayer
> Create(ContentLayerClient
* client
);
41 void SetLayerTreeHost(LayerTreeHost
* layer_tree_host
) override
;
42 void SetTexturePriorities(const PriorityCalculator
& priority_calc
) override
;
43 bool Update(ResourceUpdateQueue
* queue
,
44 const OcclusionTracker
<Layer
>* occlusion
) override
;
45 bool NeedMoreUpdates() override
;
47 void SetContentsOpaque(bool contents_opaque
) override
;
49 bool SupportsLCDText() const override
;
51 skia::RefPtr
<SkPicture
> GetPicture() const override
;
53 void OnOutputSurfaceCreated() override
;
56 explicit ContentLayer(ContentLayerClient
* client
);
57 ~ContentLayer() override
;
59 bool HasDrawableContent() const override
;
61 // TiledLayer implementation.
62 LayerUpdater
* Updater() const override
;
65 // TiledLayer implementation.
66 void CreateUpdaterIfNeeded() override
;
68 ContentLayerClient
* client_
;
69 scoped_refptr
<ContentLayerUpdater
> updater_
;
71 DISALLOW_COPY_AND_ASSIGN(ContentLayer
);
75 #endif // CC_LAYERS_CONTENT_LAYER_H_