WebKit Roll 139512:139548
[chromium-blink-merge.git] / cc / tiled_layer_impl.h
blob81726b8175bdac6f7429fd9256f0a828cb70faad
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_TILED_LAYER_IMPL_H_
6 #define CC_TILED_LAYER_IMPL_H_
8 #include "cc/cc_export.h"
9 #include "cc/layer_impl.h"
11 namespace cc {
13 class LayerTilingData;
14 class DrawableTile;
16 class CC_EXPORT TiledLayerImpl : public LayerImpl {
17 public:
18 static scoped_ptr<TiledLayerImpl> create(LayerTreeImpl* treeImpl, int id)
20 return make_scoped_ptr(new TiledLayerImpl(treeImpl, id));
22 virtual ~TiledLayerImpl();
24 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
26 virtual ResourceProvider::ResourceId contentsResourceId() const OVERRIDE;
28 virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;
30 void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
31 void setTilingData(const LayerTilingData& tiler);
32 void pushTileProperties(int, int, ResourceProvider::ResourceId, const gfx::Rect& opaqueRect, bool contentsSwizzled);
33 void pushInvalidTile(int, int);
35 virtual Region visibleContentOpaqueRegion() const OVERRIDE;
36 virtual void didLoseOutputSurface() OVERRIDE;
38 protected:
39 TiledLayerImpl(LayerTreeImpl* treeImpl, int id);
40 // Exposed for testing.
41 bool hasTileAt(int, int) const;
42 bool hasResourceIdForTileAt(int, int) const;
44 virtual void getDebugBorderProperties(SkColor*, float* width) const OVERRIDE;
46 private:
48 virtual const char* layerTypeAsString() const OVERRIDE;
50 DrawableTile* tileAt(int, int) const;
51 DrawableTile* createTile(int, int);
53 bool m_skipsDraw;
55 scoped_ptr<LayerTilingData> m_tiler;
60 #endif // CC_TILED_LAYER_IMPL_H_