Pass gfx::Rect and gfx::RectF by const ref.
[chromium-blink-merge.git] / cc / layers / tiled_layer_impl.h
blobf7048238c53b326df473bcdffdef0602638f1e91
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_
8 #include <string>
10 #include "cc/base/cc_export.h"
11 #include "cc/layers/layer_impl.h"
13 namespace cc {
15 class LayerTilingData;
16 class DrawableTile;
18 class CC_EXPORT TiledLayerImpl : public LayerImpl {
19 public:
20 static scoped_ptr<TiledLayerImpl> Create(LayerTreeImpl* tree_impl, int id) {
21 return make_scoped_ptr(new TiledLayerImpl(tree_impl, id));
23 virtual ~TiledLayerImpl();
25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
26 OVERRIDE;
27 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
29 virtual bool WillDraw(DrawMode draw_mode,
30 ResourceProvider* resource_provider) OVERRIDE;
31 virtual void AppendQuads(QuadSink* quad_sink,
32 AppendQuadsData* append_quads_data) OVERRIDE;
34 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE;
36 void set_skips_draw(bool skips_draw) { skips_draw_ = skips_draw; }
37 void SetTilingData(const LayerTilingData& tiler);
38 void PushTileProperties(int i,
39 int j,
40 ResourceProvider::ResourceId resource,
41 const gfx::Rect& opaque_rect,
42 bool contents_swizzled);
43 void PushInvalidTile(int i, int j);
45 virtual Region VisibleContentOpaqueRegion() const OVERRIDE;
46 virtual void DidLoseOutputSurface() OVERRIDE;
48 const LayerTilingData* TilingForTesting() const { return tiler_.get(); }
50 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE;
52 protected:
53 TiledLayerImpl(LayerTreeImpl* tree_impl, int id);
54 // Exposed for testing.
55 bool HasTileAt(int i, int j) const;
56 bool HasResourceIdForTileAt(int i, int j) const;
58 virtual void GetDebugBorderProperties(SkColor* color, float* width) const
59 OVERRIDE;
60 virtual void AsValueInto(base::DictionaryValue* state) const OVERRIDE;
62 private:
63 virtual const char* LayerTypeAsString() const OVERRIDE;
65 DrawableTile* TileAt(int i, int j) const;
66 DrawableTile* CreateTile(int i, int j);
68 bool skips_draw_;
70 scoped_ptr<LayerTilingData> tiler_;
72 DISALLOW_COPY_AND_ASSIGN(TiledLayerImpl);
75 } // namespace cc
77 #endif // CC_LAYERS_TILED_LAYER_IMPL_H_