Changeset 75469 in webkit
- Timestamp:
- Jan 10, 2011 7:29:15 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r75467 r75469 1 2011-01-10 Stephen White <senorblanco@chromium.org> 2 3 Reviewed by James Robinson. 4 5 Fix canvas->canvas draws on the GPU path. 6 https://bugs.webkit.org/show_bug.cgi?id=52141 7 8 Two problems: according to the canvas spec, both source and 9 destination rects can have negative width or height, but this shouldn't 10 cause the image to be flipped. So we need to normalize the rects (in 11 the software path, this is done by BitmapImage*::draw). Secondly, in 12 the FBO->FBO path, the image needs to be flipped vertically, since it 13 is drawn upside down. We were doing this by flipping the destination 14 rect, but this doesn't work if the source rect is not the entire image, 15 since we extract the wrong part of the image. Fixed by flipping the 16 source rect instead (and flipping it within the image buffer's height, 17 not the source rect's height). 18 19 Covered by fast/canvas/drawImage-with-negative-source-destination.html. 20 21 22 * platform/graphics/skia/BitmapImageSingleFrameSkia.h: 23 Put normalizeRect() in global scope. 24 * platform/graphics/skia/ImageBufferSkia.cpp: 25 (WebCore::ImageBuffer::draw): 26 Fix as above: normalize both source and dest rects, and flip the 27 source rect instead of the dest rect. 28 * platform/graphics/skia/ImageSkia.cpp: 29 (WebCore::normalizeRect): 30 Put normalizeRect() in global scope. 31 1 32 2011-01-10 Laszlo Gombos <laszlo.1.gombos@nokia.com> 2 33 -
trunk/Source/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h
r65617 r75469 83 83 }; 84 84 85 FloatRect normalizeRect(const FloatRect&); 86 85 87 } // namespace WebCore 86 88 -
trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r74868 r75469 115 115 DrawingBuffer* sourceDrawingBuffer = m_data.m_platformContext.gpuCanvas()->drawingBuffer(); 116 116 unsigned sourceTexture = static_cast<unsigned>(sourceDrawingBuffer->platformColorBuffer()); 117 FloatRect destRectFlipped(destRect); 118 destRectFlipped.setY(destRect.y() + destRect.height()); 119 destRectFlipped.setHeight(-destRect.height()); 117 FloatRect destRectNormalized(normalizeRect(destRect)); 118 FloatRect srcRectFlipped(normalizeRect(srcRect)); 119 srcRectFlipped.setY(m_size.height() - srcRect.y()); 120 srcRectFlipped.setHeight(-srcRect.height()); 120 121 context->platformContext()->prepareForHardwareDraw(); 121 context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRect , destRectFlipped, styleColorSpace, op);122 context->platformContext()->gpuCanvas()->drawTexturedRect(sourceTexture, m_size, srcRectFlipped, destRectNormalized, styleColorSpace, op); 122 123 return; 123 124 } -
trunk/Source/WebCore/platform/graphics/skia/ImageSkia.cpp
r73169 r75469 299 299 300 300 // A helper method for translating negative width and height values. 301 staticFloatRect normalizeRect(const FloatRect& rect)301 FloatRect normalizeRect(const FloatRect& rect) 302 302 { 303 303 FloatRect norm = rect;
Note: See TracChangeset
for help on using the changeset viewer.