Changeset 86269 in webkit
- Timestamp:
- May 11, 2011 2:17:50 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86266 r86269 3 3 Reviewed by Kenneth Rohde Christiansen. 4 4 5 6 5 [Texmap][Qt] Upstream texture-mapper changes from Qt's WebKit2 branch 6 https://bugs.webkit.org/show_bug.cgi?id=60439 7 8 Patch 5/12: Implement the new TextureMapper functions for the Qt backend. 9 This allow non-rectangular clipping, some stub functions, and getting a unique 10 id for an image. 11 12 No new tests. Tests in LayoutTests/compositing cover this. 13 14 * platform/graphics/qt/TextureMapperQt.cpp: 15 (WebCore::TextureMapperQt::beginClip): 16 (WebCore::TextureMapperQt::endClip): 17 (WebCore::TextureMapperQt::viewportSize): 18 (WebCore::TextureMapperQt::setGraphicsContext): 19 (WebCore::TextureMapperQt::graphicsContext): 20 (WebCore::TextureMapperQt::drawTexture): 21 (WebCore::TextureMapperQt::beginPainting): 22 (WebCore::TextureMapperQt::endPainting): 23 (WebCore::RGBA32PremultimpliedBufferQt::beginPaint): 24 (WebCore::uidForImage): 25 * platform/graphics/qt/TextureMapperQt.h: 26 27 2011-05-11 Noam Rosenthal <noam.rosenthal@nokia.com> 28 29 Reviewed by Kenneth Rohde Christiansen. 30 31 [Texmap] Upstream texture-mapper changes from Qt's WebKit2 branch 7 32 https://bugs.webkit.org/show_bug.cgi?id=60439 8 33 -
trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp
r71538 r86269 99 99 } 100 100 101 void TextureMapperQt::setClip(const IntRect& rect) 102 { 103 QPainter* painter = m_currentSurface ? &m_currentSurface->m_painter : m_painter; 101 void TextureMapperQt::beginClip(const TransformationMatrix& matrix, const FloatRect& rect) 102 { 103 QPainter* painter = currentPainter(); 104 painter->save(); 105 QTransform prevTransform = painter->transform(); 106 painter->setTransform(matrix, false); 104 107 painter->setClipRect(rect); 105 } 108 painter->setTransform(prevTransform, false); 109 } 110 111 void TextureMapperQt::endClip() 112 { 113 currentPainter()->restore(); 114 } 115 116 IntSize TextureMapperQt::viewportSize() const 117 { 118 return IntSize(m_painter->device()->width(), m_painter->device()->height()); 119 } 120 106 121 107 122 TextureMapperQt::TextureMapperQt() … … 112 127 void TextureMapperQt::setGraphicsContext(GraphicsContext* context) 113 128 { 129 m_context = context; 114 130 m_painter = context->platformContext(); 115 131 initialize(m_painter); 132 } 133 134 GraphicsContext* TextureMapperQt::graphicsContext() 135 { 136 return m_context; 116 137 } 117 138 … … 133 154 134 155 135 void TextureMapperQt::drawTexture(const BitmapTexture& texture, const IntRect& targetRect, const TransformationMatrix& matrix, float opacity, const BitmapTexture* maskTexture)156 void TextureMapperQt::drawTexture(const BitmapTexture& texture, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity, const BitmapTexture* maskTexture) 136 157 { 137 158 const BitmapTextureQt& textureQt = static_cast<const BitmapTextureQt&>(texture); … … 158 179 painter->setOpacity(opacity); 159 180 painter->setTransform(matrix, true); 160 painter->drawPixmap(targetRect, pixmap, textureQt.sourceRect());181 painter->drawPixmap(targetRect, pixmap, FloatRect(textureQt.sourceRect())); 161 182 painter->setTransform(prevTransform); 162 183 painter->setOpacity(prevOpacity); … … 181 202 { 182 203 204 } 205 206 void TextureMapperQt::beginPainting() 207 { 208 m_painter->save(); 209 } 210 211 void TextureMapperQt::endPainting() 212 { 213 m_painter->restore(); 183 214 } 184 215 … … 189 220 { 190 221 // m_image is only using during paint, it's safe to override it. 191 m_image = QImage(rect.size().width(), rect.size().height(), QImage::Format_ARGB32_Premultiplied);222 m_image = QImage(rect.size().width(), rect.size().height(), opaque ? QImage::Format_RGB32 : QImage::Format_ARGB32_Premultiplied); 192 223 if (!opaque) 193 224 m_image.fill(0); … … 211 242 } 212 243 244 uint64_t uidForImage(Image* image) 245 { 246 return image->nativeImageForCurrentFrame()->serialNumber(); 247 } 213 248 #endif 214 249 }; -
trunk/Source/WebCore/platform/graphics/qt/TextureMapperQt.h
r71538 r86269 43 43 virtual bool isPacked() const { return m_isPacked; } 44 44 45 QPainter* painter() { return &m_painter; } 46 45 47 private: 46 48 QPainter m_painter; … … 54 56 TextureMapperQt(); 55 57 56 virtual void drawTexture(const BitmapTexture& texture, const IntRect& targetRect, const TransformationMatrix& matrix, float opacity, const BitmapTexture* maskTexture);58 virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture); 57 59 virtual void bindSurface(BitmapTexture* surface); 58 virtual void setClip(const IntRect&); 60 virtual void beginClip(const TransformationMatrix&, const FloatRect&); 61 virtual void endClip(); 59 62 virtual void setGraphicsContext(GraphicsContext*); 63 virtual GraphicsContext* graphicsContext(); 60 64 virtual bool allowSurfaceForRoot() const { return false; } 61 65 virtual PassRefPtr<BitmapTexture> createTexture(); 66 virtual IntSize viewportSize() const; 67 virtual void beginPainting(); 68 virtual void endPainting(); 62 69 63 70 static void initialize(QPainter* painter) … … 67 74 68 75 static PassOwnPtr<TextureMapper> create() { return new TextureMapperQt; } 76 private: 77 inline QPainter* currentPainter() { return m_currentSurface ? m_currentSurface->painter() : m_painter; } 69 78 70 private:71 79 QPainter* m_painter; 80 GraphicsContext* m_context; 72 81 RefPtr<BitmapTextureQt> m_currentSurface; 73 82 };
Note: See TracChangeset
for help on using the changeset viewer.