fix logic
[personal-kdelibs.git] / khtml / imload / tile.h
blobbf0fe7a866f3f6520a2ee3df1badfb08cfc96b1a
1 /*
2 Large image displaying library.
4 Copyright (C) 2004,2005 Maks Orlovich (maksim@kde.org)
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef TILE_H
26 #define TILE_H
28 #include <cstring>
30 #include <QDebug>
32 namespace khtmlImLoad {
34 class TileCache;
35 class TileCacheNode;
37 /**
38 We hold pointers tiles in the cache. The interface is simple: when they get
39 kicked out of the cache, the discard method is invoked to have the associated
40 resources freed. Note that the cache does not own the entries, but merely
41 mages the more expensive part of their resources. The cacheEntry
42 field is used to link the tile node to the appropriate cache entry for it.
44 class Tile
46 public:
47 enum {TileSize = 64};
48 //Note:this can be safely reduced, but not increased --- ScaledPlane
49 //relies for byte offsets in a single row in a tile fitting into bytes
51 unsigned char versions[Tile::TileSize];
52 protected:
53 friend class TileCache;
55 Tile(): cacheNode(0)
57 std::memset(versions, 0, Tile::TileSize);
59 virtual ~Tile(){}
60 virtual void discard() = 0;
62 TileCacheNode* cacheNode;
67 #endif
68 // kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;