1/*
2 Large image displaying library.
3
4 Copyright (C) 2004,2005 Maks Orlovich (maksim@kde.org)
5
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:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
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.
22
23*/
24#ifndef PIXMAP_PLANE_H
25#define PIXMAP_PLANE_H
26
27#include "array2d.h"
28#include "animprovider.h"
29#include "imageplane.h"
30#include "pixmaptile.h"
31
32namespace khtmlImLoad
33{
34
35class AnimProvider;
36
37/**
38 A pixmap plane is responsible for drawing data of an image plane
39 @internal
40*/
41class PixmapPlane: public Plane
42{
43public:
44 ImagePlane *parent;
45 int refCount;//For image's use
46private:
47 Array2D<PixmapTile> tiles;
48public:
49 PixmapPlane(unsigned int _width, unsigned int _height, ImagePlane *_parent):
50 Plane(_width, _height), parent(_parent), tiles(tilesWidth, tilesHeight)
51 {
52 nextFrame = nullptr;
53 animProvider = nullptr;
54 refCount = 0;
55 }
56
57 PixmapPlane *nextFrame;
58 AnimProvider *animProvider;
59
60 void flushCache();
61
62 ~PixmapPlane()
63 {
64 delete animProvider;
65 delete parent;
66 delete nextFrame;
67 }
68
69 /**
70 Paints a portion of the frame on the painter 'p' at dx and dy.
71 The source rectangle starts at sx, sy and has dimension width * height.
72 */
73 void paint(int dx, int dy, QPainter *p,
74 int sx, int sy, int width = -1, int height = -1);
75};
76
77}
78
79#endif
80