File indexing completed on 2024-11-03 09:54:24
0001 /* 0002 * Copyright (C) 2004, 2006, 2007 Apple Computer, Inc. All rights reserved. 0003 * Copyright (C) 2005 Zack Rusin <zack@kde.org> 0004 * Copyright (C) 2007 Maksim Orlovich <maksim@kde.org> 0005 * 0006 * Redistribution and use in source and binary forms, with or without 0007 * modification, are permitted provided that the following conditions 0008 * are met: 0009 * 1. Redistributions of source code must retain the above copyright 0010 * notice, this list of conditions and the following disclaimer. 0011 * 2. Redistributions in binary form must reproduce the above copyright 0012 * notice, this list of conditions and the following disclaimer in the 0013 * documentation and/or other materials provided with the distribution. 0014 * 0015 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 0016 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0017 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 0018 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 0019 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 0020 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 0021 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 0022 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 0023 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0025 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0026 */ 0027 0028 #ifndef RENDER_CANVASIMAGE_H 0029 #define RENDER_CANVASIMAGE_H 0030 0031 #include "html/html_elementimpl.h" 0032 #include "html/html_canvasimpl.h" 0033 #include "rendering/render_replaced.h" 0034 #include "dom/dom_string.h" 0035 0036 #include <QMap> 0037 #include <QImage> 0038 #include <QPainter> 0039 0040 #include "imload/imagepainter.h" 0041 0042 namespace khtml 0043 { 0044 0045 class RenderCanvasImage : public RenderReplaced 0046 { 0047 public: 0048 RenderCanvasImage(DOM::HTMLCanvasElementImpl *); 0049 0050 const char *renderName() const override 0051 { 0052 return "RenderCanvasImage"; 0053 } 0054 0055 void paint(PaintInfo &i, int tx, int ty) override; 0056 void layout() override; 0057 void updateFromElement() override; 0058 0059 // don't even think about making this method virtual! 0060 DOM::HTMLCanvasElementImpl *element() const 0061 { 0062 return static_cast<DOM::HTMLCanvasElementImpl *>(RenderObject::element()); 0063 } 0064 0065 private: 0066 khtmlImLoad::ImagePainter imagePainter; 0067 }; 0068 0069 } //namespace 0070 0071 #endif