1 // Copyright 2011 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_TILED_LAYER_IMPL_H_
6 #define CC_LAYERS_TILED_LAYER_IMPL_H_
10 #include "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h"
15 class LayerTilingData
;
18 class CC_EXPORT TiledLayerImpl
: public LayerImpl
{
20 static scoped_ptr
<TiledLayerImpl
> Create(LayerTreeImpl
* tree_impl
, int id
) {
21 return make_scoped_ptr(
22 new TiledLayerImpl(tree_impl
, id
, new LayerImpl::SyncedScrollOffset
));
24 static scoped_ptr
<TiledLayerImpl
> Create(
25 LayerTreeImpl
* tree_impl
,
27 scoped_refptr
<LayerImpl::SyncedScrollOffset
> synced_scroll_offset
) {
28 return make_scoped_ptr(
29 new TiledLayerImpl(tree_impl
, id
, synced_scroll_offset
));
31 ~TiledLayerImpl() override
;
33 scoped_ptr
<LayerImpl
> CreateLayerImpl(LayerTreeImpl
* tree_impl
) override
;
34 void PushPropertiesTo(LayerImpl
* layer
) override
;
36 bool WillDraw(DrawMode draw_mode
,
37 ResourceProvider
* resource_provider
) override
;
38 void AppendQuads(RenderPass
* render_pass
,
39 AppendQuadsData
* append_quads_data
) override
;
41 void GetContentsResourceId(ResourceProvider::ResourceId
* resource_id
,
42 gfx::Size
* resource_size
) const override
;
44 void set_skips_draw(bool skips_draw
) { skips_draw_
= skips_draw
; }
45 void SetTilingData(const LayerTilingData
& tiler
);
46 void PushTileProperties(int i
,
48 ResourceProvider::ResourceId resource
,
49 bool contents_swizzled
);
50 void PushInvalidTile(int i
, int j
);
52 SimpleEnclosedRegion
VisibleContentOpaqueRegion() const override
;
53 void ReleaseResources() override
;
55 const LayerTilingData
* TilingForTesting() const { return tiler_
.get(); }
57 size_t GPUMemoryUsageInBytes() const override
;
60 TiledLayerImpl(LayerTreeImpl
* tree_impl
, int id
);
62 LayerTreeImpl
* tree_impl
,
64 scoped_refptr
<LayerImpl::SyncedScrollOffset
> synced_scroll_offset
);
65 // Exposed for testing.
66 bool HasTileAt(int i
, int j
) const;
67 bool HasResourceIdForTileAt(int i
, int j
) const;
69 void GetDebugBorderProperties(SkColor
* color
, float* width
) const override
;
70 void AsValueInto(base::trace_event::TracedValue
* dict
) const override
;
73 const char* LayerTypeAsString() const override
;
75 DrawableTile
* TileAt(int i
, int j
) const;
76 DrawableTile
* CreateTile(int i
, int j
);
80 scoped_ptr
<LayerTilingData
> tiler_
;
82 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl
);
87 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_