File indexing completed on 2024-05-19 15:12:19

0001 /*
0002     Large image displaying library.
0003 
0004     Copyright (C) 2004,2005 Maks Orlovich (maksim@kde.org)
0005     Copyright (C) 2012 Martin Sandsmark (martin.sandsmark@kde.org)
0006 
0007     Permission is hereby granted, free of charge, to any person obtaining a copy
0008     of this software and associated documentation files (the "Software"), to deal
0009     in the Software without restriction, including without limitation the rights
0010     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0011     copies of the Software, and to permit persons to whom the Software is
0012     furnished to do so, subject to the following conditions:
0013 
0014     The above copyright notice and this permission notice shall be included in
0015     all copies or substantial portions of the Software.
0016 
0017     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0018     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0019     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0020     AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0021     AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0022     CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0023 
0024 */
0025 #ifndef SCALED_IMAGE_PLANE_H
0026 #define SCALED_IMAGE_PLANE_H
0027 
0028 #include "array2d.h"
0029 #include "imageplane.h"
0030 #include "rawimageplane.h"
0031 #include "imagetile.h"
0032 
0033 namespace khtmlImLoad
0034 {
0035 
0036 /**
0037  A scaled image plane pulls data from a RawImagePlane and resizes it
0038 */
0039 class ScaledImagePlane: public ImagePlane
0040 {
0041 public:
0042     virtual ~ScaledImagePlane();
0043 
0044     void flushCache() override;
0045 
0046     ScaledImagePlane(unsigned int _width, unsigned int _height, RawImagePlane *_parent);
0047 
0048     virtual bool isUpToDate(unsigned int tileX, unsigned int tileY,
0049                             PixmapTile *tile) override;
0050 
0051     virtual void ensureUpToDate(unsigned int tileX, unsigned int tileY,
0052                                 PixmapTile *tile) override;
0053 private:
0054     RawImagePlane     *parent;
0055     Array2D<ImageTile> tiles;
0056     int m_width, m_height;
0057 };
0058 
0059 }
0060 
0061 #endif