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

0001 /*
0002     KHTML image displaying library.
0003 
0004     Copyright (C) 2007 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 IMLOAD_CANVAS_IMAGE_H
0025 #define IMLOAD_CANVAS_IMAGE_H
0026 
0027 class QImage;
0028 
0029 #include "image.h"
0030 
0031 namespace khtmlImLoad
0032 {
0033 
0034 /**
0035   A CanvasImage encapsulates a QImage that will be painted on externally,
0036   in order to permit scaling of it.  When drawing happens, however, the client must call the
0037   contentUpdated() method to avoid out-of-date data being painted.
0038  */
0039 class CanvasImage : public Image
0040 {
0041 public:
0042     CanvasImage(int width, int height);
0043     void contentUpdated();
0044     void resizeImage(int width, int height);
0045 private:
0046     void setupOriginalPlane(int width, int height);
0047     void flushAllCaches();
0048     static ImageOwner *trivialOwner();
0049     static ImageOwner *s_trivialOwner;
0050 };
0051 
0052 }
0053 
0054 #endif