summaryrefslogtreecommitdiffstats
path: root/cc/CCTiledLayerImpl.h
blob: 56d3521d3fbd9c8208e4b52c46258015f1110604 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CCTiledLayerImpl_h
#define CCTiledLayerImpl_h

#include "CCLayerImpl.h"
#include <public/WebTransformationMatrix.h>

namespace cc {

class CCLayerTilingData;
class DrawableTile;

class CCTiledLayerImpl : public CCLayerImpl {
public:
    static PassOwnPtr<CCTiledLayerImpl> create(int id)
    {
        return adoptPtr(new CCTiledLayerImpl(id));
    }
    virtual ~CCTiledLayerImpl();

    virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE;

    virtual CCResourceProvider::ResourceId contentsResourceId() const OVERRIDE;

    virtual void dumpLayerProperties(std::string*, int indent) const OVERRIDE;

    void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
    void setTilingData(const CCLayerTilingData& tiler);
    void pushTileProperties(int, int, CCResourceProvider::ResourceId, const IntRect& opaqueRect);

    void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; }
    bool contentsSwizzled() const { return m_contentsSwizzled; }

    virtual Region visibleContentOpaqueRegion() const OVERRIDE;
    virtual void didLoseContext() OVERRIDE;

protected:
    explicit CCTiledLayerImpl(int id);
    // Exposed for testing.
    bool hasTileAt(int, int) const;
    bool hasTextureIdForTileAt(int, int) const;

private:

    virtual const char* layerTypeAsString() const OVERRIDE { return "ContentLayer"; }

    DrawableTile* tileAt(int, int) const;
    DrawableTile* createTile(int, int);

    bool m_skipsDraw;
    bool m_contentsSwizzled;

    OwnPtr<CCLayerTilingData> m_tiler;
};

}

#endif // CCTiledLayerImpl_h