WebKit merge 128969:128981
[chromium-blink-merge.git] / cc / CCTiledLayerImpl.h
blob56d3521d3fbd9c8208e4b52c46258015f1110604
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 CCTiledLayerImpl_h
6 #define CCTiledLayerImpl_h
8 #include "CCLayerImpl.h"
9 #include <public/WebTransformationMatrix.h>
11 namespace cc {
13 class CCLayerTilingData;
14 class DrawableTile;
16 class CCTiledLayerImpl : public CCLayerImpl {
17 public:
18 static PassOwnPtr<CCTiledLayerImpl> create(int id)
20 return adoptPtr(new CCTiledLayerImpl(id));
22 virtual ~CCTiledLayerImpl();
24 virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;
26 virtual CCResourceProvider::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 CCLayerTilingData& tiler);
32 void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect);
34 void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; }
35 bool contentsSwizzled() const { return m_contentsSwizzled; }
37 virtual Region visibleContentOpaqueRegion() const OVERRIDE;
38 virtual void didLoseContext() OVERRIDE;
40 protected:
41 explicit CCTiledLayerImpl(int id);
42 // Exposed for testing.
43 bool hasTileAt(int, int) const;
44 bool hasTextureIdForTileAt(int, int) const;
46 private:
48 virtual const char* layerTypeAsString() const OVERRIDE { return "ContentLayer"; }
50 DrawableTile* tileAt(int, int) const;
51 DrawableTile* createTile(int, int);
53 bool m_skipsDraw;
54 bool m_contentsSwizzled;
56 OwnPtr<CCLayerTilingData> m_tiler;
61 #endif // CCTiledLayerImpl_h