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 skia::RefPtr
<SkPicture
> GetPicture() const override
;
51 void OnOutputSurfaceCreated() override
;
54 explicit ContentLayer(ContentLayerClient
* client
);
55 ~ContentLayer() override
;
57 bool HasDrawableContent() const override
;
59 // TiledLayer implementation.
60 LayerUpdater
* Updater() const override
;
63 // TiledLayer implementation.
64 void CreateUpdaterIfNeeded() override
;
66 ContentLayerClient
* client_
;
67 scoped_refptr
<ContentLayerUpdater
> updater_
;
69 DISALLOW_COPY_AND_ASSIGN(ContentLayer
);
73 #endif // CC_LAYERS_CONTENT_LAYER_H_