Changeset 170675 in webkit
- Timestamp:
- Jul 1, 2014, 4:26:12 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r170661 r170675 1 2014-07-01 Dean Jackson <[email protected]> 2 3 [iOS] Subsampled JPEG images do not draw correctly via the canvas APIs 4 https://bugs.webkit.org/show_bug.cgi?id=134513 5 <rdar://problem/12078860> 6 <rdar://problem/16745393> 7 8 Reviewed by Tim Horton. 9 10 Add Canvas2D and WebGL tests that exercise a very large JPEG image. 11 12 The WebGL test is mostly copied from the WebGL test suite, so please 13 excuse the coding style. 14 15 * fast/canvas/image-potential-subsample-expected.txt: Added. 16 * fast/canvas/image-potential-subsample.html: Added. 17 * fast/canvas/resources/image-8000x8000.jpg: Added. 18 * fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-potentially-subsampled-image.js: Added. 19 (.init): 20 (.runOneIteration): 21 (.runTestOnImage): 22 (.runTest): 23 (generateTest): 24 * fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image-expected.txt: Added. 25 * fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image.html: Added. 26 1 27 2014-07-01 Chris Fleizach <[email protected]> 2 28 -
trunk/Source/WebCore/ChangeLog
r170665 r170675 1 2014-07-01 Dean Jackson <[email protected]> 2 3 [iOS] Subsampled JPEG images do not draw correctly via the canvas APIs 4 https://bugs.webkit.org/show_bug.cgi?id=134513 5 <rdar://problem/12078860> 6 <rdar://problem/16745393> 7 8 Reviewed by Tim Horton. 9 10 Subsampled images (e.g. JPEG) were not consistently using 11 their original dimensions and subsampled dimensions. This caused 12 things like texImage2D to pack the pixels incorrectly, or drawImage 13 to squish the rendering. 14 15 Renamed m_scale to m_subsamplingScale on FrameData. 16 17 Tests: fast/canvas/image-potential-subsample.html 18 fast/canvas/webgl/tex-image-and-sub-image-2d-with-potentially-subsampled-image.html 19 20 * platform/graphics/BitmapImage.cpp: 21 (WebCore::BitmapImage::cacheFrame): Rename to m_subsamplingScale. 22 (WebCore::BitmapImage::frameAtIndex): Ditto. 23 * platform/graphics/BitmapImage.h: 24 (WebCore::FrameData::FrameData): Ditto. 25 * platform/graphics/cg/BitmapImageCG.cpp: 26 (WebCore::FrameData::clear): Ditto. 27 (WebCore::BitmapImage::BitmapImage): Ditto. 28 (WebCore::BitmapImage::draw): Use a scaledSrcRect that reflects the subsampled size, 29 rather than assuming the srcRect accurately reflects how many pixels we have 30 in the Bitmap. 31 (WebCore::BitmapImage::copyUnscaledFrameAtIndex): 32 * platform/graphics/cg/GraphicsContext3DCG.cpp: 33 (WebCore::GraphicsContext3D::ImageExtractor::extractImage): Similar fix, although this 34 time we just ask the image decoder to take into account the subsampled size 35 when it is "generating" a frame, causing it to use the bitmap data it has already 36 decoded. 37 1 38 2014-07-01 Joseph Pecoraro <[email protected]> 2 39 -
trunk/Source/WebCore/platform/graphics/BitmapImage.cpp
r167497 r170675 167 167 #if PLATFORM(IOS) 168 168 m_frames[index].m_frame = m_source.createFrameAtIndex(index, &scaleHint); 169 m_frames[index].m_s cale = scaleHint;169 m_frames[index].m_subsamplingScale = scaleHint; 170 170 #else 171 171 m_frames[index].m_frame = m_source.createFrameAtIndex(index); … … 432 432 if (index >= m_frames.size() || !m_frames[index].m_frame) 433 433 cacheFrame(index, scaleHint); 434 else if (std::min(1.0f, scaleHint) > m_frames[index].m_s cale) {434 else if (std::min(1.0f, scaleHint) > m_frames[index].m_subsamplingScale) { 435 435 // If the image is already cached, but at too small a size, re-decode a larger version. 436 436 int sizeChange = -m_frames[index].m_frameBytes; -
trunk/Source/WebCore/platform/graphics/BitmapImage.h
r167356 r170675 72 72 , m_orientation(DefaultImageOrientation) 73 73 #if PLATFORM(IOS) 74 , m_s cale(0)74 , m_subsamplingScale(0) 75 75 , m_haveInfo(false) 76 76 #endif … … 95 95 ImageOrientation m_orientation; 96 96 #if PLATFORM(IOS) 97 float m_s cale;97 float m_subsamplingScale; 98 98 bool m_haveInfo; 99 99 #endif -
trunk/Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp
r167375 r170675 62 62 #if PLATFORM(IOS) 63 63 m_frameBytes = 0; 64 m_s cale = 1;64 m_subsamplingScale = 1; 65 65 m_haveInfo = false; 66 66 #endif … … 115 115 116 116 #if PLATFORM(IOS) 117 m_frames[0].m_s cale = 1;117 m_frames[0].m_subsamplingScale = 1; 118 118 #endif 119 119 … … 200 200 { 201 201 CGImageRef image; 202 #if !PLATFORM(IOS) 203 startAnimation(); 204 205 image = frameAtIndex(m_currentFrame); 206 #else 202 FloatRect srcRectForCurrentFrame = srcRect; 203 204 #if PLATFORM(IOS) 205 if (m_originalSize.width() && m_originalSize.height()) 206 srcRectForCurrentFrame.scale(m_size.width() / static_cast<float>(m_originalSize.width()), m_size.height() / static_cast<float>(m_originalSize.height())); 207 207 208 startAnimation(DoNotCatchUp); 208 209 … … 213 214 imagePossiblyCopied = adoptCF(copyUnscaledFrameAtIndex(m_currentFrame)); 214 215 else 215 imagePossiblyCopied = frameAtIndex(m_currentFrame, std::min<float>(1.0f, std::max(transformedDestinationRect.size.width / srcRect .width(), transformedDestinationRect.size.height / srcRect.height())));216 216 imagePossiblyCopied = frameAtIndex(m_currentFrame, std::min<float>(1.0f, std::max(transformedDestinationRect.size.width / srcRectForCurrentFrame.width(), transformedDestinationRect.size.height / srcRectForCurrentFrame.height()))); 217 217 218 image = imagePossiblyCopied.get(); 218 #endif 219 #else 220 startAnimation(); 221 222 image = frameAtIndex(m_currentFrame); 223 #endif 224 219 225 if (!image) // If it's too early we won't have an image yet. 220 226 return; … … 227 233 float scale = 1; 228 234 #if PLATFORM(IOS) 229 scale = m_frames[m_currentFrame].m_s cale;235 scale = m_frames[m_currentFrame].m_subsamplingScale; 230 236 #endif 231 237 FloatSize selfSize = currentFrameSize(); … … 235 241 orientation = frameOrientationAtIndex(m_currentFrame); 236 242 237 ctxt->drawNativeImage(image, selfSize, styleColorSpace, destRect, srcRect , scale, compositeOp, blendMode, orientation);243 ctxt->drawNativeImage(image, selfSize, styleColorSpace, destRect, srcRectForCurrentFrame, scale, compositeOp, blendMode, orientation); 238 244 239 245 if (imageObserver()) … … 250 256 cacheFrame(index, 1); 251 257 252 if (m_frames[index].m_s cale == 1 && !m_source.isSubsampled())258 if (m_frames[index].m_subsamplingScale == 1 && !m_source.isSubsampled()) 253 259 return CGImageRetain(m_frames[index].m_frame); 254 260 -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp
r165676 r170675 333 333 if (!decoder.frameCount()) 334 334 return false; 335 #if PLATFORM(IOS) 336 float scaleHint = 1; 337 if (m_image->isBitmapImage()) { 338 IntSize originalSize = toBitmapImage(m_image)->originalSize(); 339 if (originalSize.width() && originalSize.height()) 340 scaleHint = std::min<float>(1.0f, std::max(m_image->size().width() / originalSize.width(), m_image->size().width() / originalSize.height())); 341 } 342 m_decodedImage = adoptCF(decoder.createFrameAtIndex(0, &scaleHint)); 343 #else 335 344 m_decodedImage = adoptCF(decoder.createFrameAtIndex(0)); 345 #endif 336 346 m_cgImage = m_decodedImage.get(); 337 347 } else
Note:
See TracChangeset
for help on using the changeset viewer.