haikuwebkit/LayoutTests/fast/canvas/image-potential-subsample-e...

6 lines
144 B
Plaintext
Raw Permalink Normal View History

[iOS] Subsampled JPEG images do not draw correctly via the canvas APIs https://bugs.webkit.org/show_bug.cgi?id=134513 <rdar://problem/12078860> <rdar://problem/16745393> Reviewed by Tim Horton. Source/WebCore: Subsampled images (e.g. JPEG) were not consistently using their original dimensions and subsampled dimensions. This caused things like texImage2D to pack the pixels incorrectly, or drawImage to squish the rendering. Renamed m_scale to m_subsamplingScale on FrameData. Tests: fast/canvas/image-potential-subsample.html fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image.html * platform/graphics/BitmapImage.cpp: (WebCore::BitmapImage::cacheFrame): Rename to m_subsamplingScale. (WebCore::BitmapImage::frameAtIndex): Ditto. * platform/graphics/BitmapImage.h: (WebCore::FrameData::FrameData): Ditto. * platform/graphics/cg/BitmapImageCG.cpp: (WebCore::FrameData::clear): Ditto. (WebCore::BitmapImage::BitmapImage): Ditto. (WebCore::BitmapImage::draw): Use a scaledSrcRect that reflects the subsampled size, rather than assuming the srcRect accurately reflects how many pixels we have in the Bitmap. (WebCore::BitmapImage::copyUnscaledFrameAtIndex): * platform/graphics/cg/GraphicsContext3DCG.cpp: (WebCore::GraphicsContext3D::ImageExtractor::extractImage): Similar fix, although this time we just ask the image decoder to take into account the subsampled size when it is "generating" a frame, causing it to use the bitmap data it has already decoded. LayoutTests: Add Canvas2D and WebGL tests that exercise a very large JPEG image. The WebGL test is mostly copied from the WebGL test suite, so please excuse the coding style. * fast/canvas/image-potential-subsample-expected.txt: Added. * fast/canvas/image-potential-subsample.html: Added. * fast/canvas/resources/image-8000x8000.jpg: Added. * fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-potentially-subsampled-image.js: Added. (.init): (.runOneIteration): (.runTestOnImage): (.runTest): (generateTest): * fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image-expected.txt: Added. * fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image.html: Added. Canonical link: https://commits.webkit.org/152504@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170675 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-01 23:26:12 +00:00
PASS: Pixel (10, 10) was close to 255,0,0,255
PASS: Pixel (200, 200) was close to 0,255,0,255
PASS: Pixel (390, 390) was close to 0,0,255,255