File indexing completed on 2024-05-19 11:38:33

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 #ifndef PIXMAP_PLANE_H
0025 #define PIXMAP_PLANE_H
0026 
0027 #include "array2d.h"
0028 #include "animprovider.h"
0029 #include "imageplane.h"
0030 #include "pixmaptile.h"
0031 
0032 namespace khtmlImLoad
0033 {
0034 
0035 class AnimProvider;
0036 
0037 /**
0038  A pixmap plane is responsible for drawing data of an image plane
0039  @internal
0040 */
0041 class PixmapPlane: public Plane
0042 {
0043 public:
0044     ImagePlane         *parent;
0045     int                 refCount;//For image's use
0046 private:
0047     Array2D<PixmapTile> tiles;
0048 public:
0049     PixmapPlane(unsigned int _width, unsigned int _height, ImagePlane *_parent):
0050         Plane(_width, _height), parent(_parent), tiles(tilesWidth, tilesHeight)
0051     {
0052         nextFrame    = nullptr;
0053         animProvider = nullptr;
0054         refCount     = 0;
0055     }
0056 
0057     PixmapPlane  *nextFrame;
0058     AnimProvider *animProvider;
0059 
0060     void flushCache();
0061 
0062     ~PixmapPlane()
0063     {
0064         delete animProvider;
0065         delete parent;
0066         delete nextFrame;
0067     }
0068 
0069     /**
0070      Paints a portion of the frame on the painter 'p' at dx and dy.
0071      The source rectangle starts at sx, sy and has dimension width * height.
0072     */
0073     void paint(int dx, int dy, QPainter *p,
0074                int sx, int sy, int width = -1, int height = -1);
0075 };
0076 
0077 }
0078 
0079 #endif