summaryrefslogtreecommitdiffstats
path: root/cc/tiled_layer_impl.h
blob: aedcb1847c180ed886656352b5c4bf05e93beb98 (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
62
// 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 scoped_ptr<CCTiledLayerImpl> create(int id)
    {
        return make_scoped_ptr(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 pushInvalidTile(int, int);

    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 hasResourceIdForTileAt(int, int) const;

private:

    virtual const char* layerTypeAsString() const OVERRIDE;

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

    bool m_skipsDraw;
    bool m_contentsSwizzled;

    scoped_ptr<CCLayerTilingData> m_tiler;
};

}

#endif // CCTiledLayerImpl_h