1 /* 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 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 TiledImageOpenVG_h 21 #define TiledImageOpenVG_h 22 23 #include "IntRect.h" 24 #include "IntSize.h" 25 #include "SharedResourceOpenVG.h" 26 27 #include <openvg.h> 28 #include <wtf/Vector.h> 29 30 namespace WebCore { 31 32 class FloatRect; 33 34 class TiledImageOpenVG : public SharedResourceOpenVG { 35 public: 36 TiledImageOpenVG(const IntSize& size, const IntSize& tileSize); 37 TiledImageOpenVG(const TiledImageOpenVG&); 38 ~TiledImageOpenVG(); 39 40 TiledImageOpenVG& operator=(const TiledImageOpenVG&); 41 42 const IntSize& size() const { return m_size; } 43 const IntSize& maxTileSize() const { return m_maxTileSize; } 44 45 int numTiles() const; 46 int numColumns() const; 47 int numRows() const; 48 49 IntRect tilesInRect(const FloatRect&) const; 50 51 void setTile(int xIndex, int yIndex, VGImage); 52 VGImage tile(int xIndex, int yIndex) const; 53 IntRect tileRect(int xIndex, int yIndex) const; 54 55 private: 56 void detachTiles(); 57 void destroyTiles(); 58 59 IntSize m_size; 60 IntSize m_maxTileSize; 61 62 int m_numColumns; 63 64 Vector<VGImage> m_tiles; 65 }; 66 67 } 68 69 #endif 70