summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/TiledBackingStore.h
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/graphics/TiledBackingStore.h
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/graphics/TiledBackingStore.h')
-rw-r--r--WebCore/platform/graphics/TiledBackingStore.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/TiledBackingStore.h b/WebCore/platform/graphics/TiledBackingStore.h
new file mode 100644
index 0000000..8ed4336
--- /dev/null
+++ b/WebCore/platform/graphics/TiledBackingStore.h
@@ -0,0 +1,110 @@
+/*
+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TiledBackingStore_h
+#define TiledBackingStore_h
+
+#if ENABLE(TILED_BACKING_STORE)
+
+#include "FloatSize.h"
+#include "IntPoint.h"
+#include "IntRect.h"
+#include "Tile.h"
+#include "Timer.h"
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GraphicsContext;
+class TiledBackingStoreClient;
+
+class TiledBackingStore : public Noncopyable {
+public:
+ TiledBackingStore(TiledBackingStoreClient*);
+ ~TiledBackingStore();
+
+ void viewportChanged(const IntRect& viewportRect);
+
+ float contentsScale() { return m_contentsScale; }
+ void setContentsScale(float);
+
+ bool contentsFrozen() const { return m_contentsFrozen; }
+ void setContentsFrozen(bool);
+
+ void invalidate(const IntRect& dirtyRect);
+ void paint(GraphicsContext*, const IntRect&);
+
+private:
+ void startTileBufferUpdateTimer();
+ void startTileCreationTimer();
+
+ typedef Timer<TiledBackingStore> TileTimer;
+
+ void tileBufferUpdateTimerFired(TileTimer*);
+ void tileCreationTimerFired(TileTimer*);
+
+ void updateTileBuffers();
+ void createTiles();
+
+ void commitScaleChange();
+
+ void dropOverhangingTiles();
+ void dropTilesOutsideRect(const IntRect&);
+
+ PassRefPtr<Tile> tileAt(const Tile::Coordinate&) const;
+ void setTile(const Tile::Coordinate& coordinate, PassRefPtr<Tile> tile);
+ void removeTile(const Tile::Coordinate& coordinate);
+
+ IntRect mapToContents(const IntRect&) const;
+ IntRect mapFromContents(const IntRect&) const;
+
+ IntRect contentsRect() const;
+
+ IntRect tileRectForCoordinate(const Tile::Coordinate&) const;
+ Tile::Coordinate tileCoordinateForPoint(const IntPoint&) const;
+ double tileDistance(const IntRect& viewport, const Tile::Coordinate&);
+
+ void paintCheckerPattern(GraphicsContext*, const IntRect&, const Tile::Coordinate&);
+
+private:
+ TiledBackingStoreClient* m_client;
+
+ typedef HashMap<Tile::Coordinate, RefPtr<Tile> > TileMap;
+ TileMap m_tiles;
+
+ TileTimer* m_tileBufferUpdateTimer;
+ TileTimer* m_tileCreationTimer;
+
+ IntSize m_tileSize;
+
+ IntRect m_viewport;
+ float m_contentsScale;
+ float m_pendingScale;
+
+ bool m_contentsFrozen;
+
+ friend class Tile;
+};
+
+}
+
+#endif
+#endif