1/*
2 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB.  If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18 */
19
20#ifndef TileQt_h
21#define TileQt_h
22
23#if USE(TILED_BACKING_STORE)
24
25#include "IntPoint.h"
26#include "IntRect.h"
27#include "Tile.h"
28#include <wtf/PassRefPtr.h>
29#include <wtf/RefCounted.h>
30
31QT_BEGIN_NAMESPACE
32class QPixmap;
33class QRegion;
34QT_END_NAMESPACE
35
36namespace WebCore {
37
38class TiledBackingStore;
39
40class TileQt : public Tile {
41public:
42    typedef IntPoint Coordinate;
43
44    static PassRefPtr<Tile> create(TiledBackingStore* backingStore, const Coordinate& tileCoordinate) { return adoptRef(new TileQt(backingStore, tileCoordinate)); }
45    ~TileQt();
46
47    bool isDirty() const;
48    void invalidate(const IntRect&);
49    Vector<IntRect> updateBackBuffer();
50    void swapBackBufferToFront();
51    bool isReadyToPaint() const;
52    void paint(GraphicsContext*, const IntRect&);
53
54    const Tile::Coordinate& coordinate() const { return m_coordinate; }
55    const IntRect& rect() const { return m_rect; }
56    void resize(const WebCore::IntSize&);
57
58private:
59    TileQt(TiledBackingStore*, const Coordinate&);
60
61    TiledBackingStore* m_backingStore;
62    Coordinate m_coordinate;
63    IntRect m_rect;
64
65    QPixmap* m_buffer;
66    QPixmap* m_backBuffer;
67    QRegion* m_dirtyRegion;
68};
69
70}
71#endif
72#endif
73