File indexing completed on 2024-04-28 11:38:26
0001 /* 0002 Large image displaying library. 0003 0004 Copyright (C) 2004,2005 Maks Orlovich (maksim@kde.org) 0005 0006 Permission is hereby granted, free of charge, to any person obtaining a copy 0007 of this software and associated documentation files (the "Software"), to deal 0008 in the Software without restriction, including without limitation the rights 0009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0010 copies of the Software, and to permit persons to whom the Software is 0011 furnished to do so, subject to the following conditions: 0012 0013 The above copyright notice and this permission notice shall be included in 0014 all copies or substantial portions of the Software. 0015 0016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0019 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 0020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 0021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0022 0023 */ 0024 0025 #ifndef TILE_H 0026 #define TILE_H 0027 0028 #include <cstring> 0029 0030 0031 namespace khtmlImLoad 0032 { 0033 0034 class TileCache; 0035 class TileCacheNode; 0036 0037 /** 0038 We hold pointers tiles in the cache. The interface is simple: when they get 0039 kicked out of the cache, the discard method is invoked to have the associated 0040 resources freed. Note that the cache does not own the entries, but merely 0041 mages the more expensive part of their resources. The cacheEntry 0042 field is used to link the tile node to the appropriate cache entry for it. 0043 */ 0044 class Tile 0045 { 0046 public: 0047 enum {TileSize = 64}; 0048 //Note:this can be safely reduced, but not increased --- ScaledPlane 0049 //relies for byte offsets in a single row in a tile fitting into bytes 0050 0051 unsigned char versions[Tile::TileSize]; 0052 protected: 0053 friend class TileCache; 0054 0055 Tile(): cacheNode(nullptr) 0056 { 0057 std::memset(versions, 0, Tile::TileSize); 0058 } 0059 virtual ~Tile() {} 0060 virtual void discard() = 0; 0061 0062 TileCacheNode *cacheNode; 0063 }; 0064 0065 } 0066 0067 #endif