Title: [125154] trunk
- Revision
- 125154
- Author
- [email protected]
- Date
- 2012-08-08 23:23:42 -0700 (Wed, 08 Aug 2012)
Log Message
Source/WebCore: Remove image decoding in some BitmapImage metadata functions
https://bugs.webkit.org/show_bug.cgi?id=93171
Reviewed by Simon Fraser.
These two metadata functions were decoding an entire frame:
- frameOrientationAtIndex
- frameHasAlphaAtIndex
This change removes image decoding from these two methods. This is for
preparation of having asynchronous image decoding, intending to reduce
code location that trigger image decoding.
frameOrientationAtIndex() doesn't require decoding a frame. This method
is only implemented in CG port in ImageSourceCG.cpp which doesn't do
image decoding.
frameHasAlphaAtIndex() is used to optimize certain drawing operations
and accelerated compositing. This change uses a heuristic for non-CG
port to determine if an image has alpha. If an image is not yet
decoded the function answers having alpha. Only if a frame is decoded
and cached that the alpha state of the frame is returned. This is an
admissible heuristic that postpone answering the question until a frame
is decoded.
Tested this change with a fully loaded image and partially loaded image
with background color.
Test: http/tests/images/jpg-img-partial-load.html
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::frameHasAlphaAtIndex):
(WebCore::BitmapImage::frameOrientationAtIndex):
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::frameHasAlphaAtIndex):
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::frameHasAlphaAtIndex):
(WebCore):
* platform/image-decoders/ImageDecoder.h:
(ImageDecoder):
LayoutTests: Test rendering JPEG <img> with CSS background
https://bugs.webkit.org/show_bug.cgi?id=93171
Reviewed by Simon Fraser.
Tests defer answering the alpha state for BitmapImage not yet
decoded doesn't affect rendering results.
Test: http/tests/images/jpg-img-partial-load.html
Tests the rendering results of a partially loaded JPEG image.
The image should be green in the top region and blue in the
lower region. The blue is the background color revealed by
full alpha of the undecoded region.
* fast/images/resources/green-256x256.jpg: Added.
* http/tests/images/jpg-img-partial-load-expected.png: Added.
* http/tests/images/jpg-img-partial-load-expected.txt: Added.
* http/tests/images/jpg-img-partial-load.html: Added.
* http/tests/resources/load-and-stall.php: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (125153 => 125154)
--- trunk/LayoutTests/ChangeLog 2012-08-09 05:50:24 UTC (rev 125153)
+++ trunk/LayoutTests/ChangeLog 2012-08-09 06:23:42 UTC (rev 125154)
@@ -1,3 +1,26 @@
+2012-08-08 Alpha Lam <[email protected]>
+
+ Test rendering JPEG <img> with CSS background
+ https://bugs.webkit.org/show_bug.cgi?id=93171
+
+ Reviewed by Simon Fraser.
+
+ Tests defer answering the alpha state for BitmapImage not yet
+ decoded doesn't affect rendering results.
+
+ Test: http/tests/images/jpg-img-partial-load.html
+
+ Tests the rendering results of a partially loaded JPEG image.
+ The image should be green in the top region and blue in the
+ lower region. The blue is the background color revealed by
+ full alpha of the undecoded region.
+
+ * fast/images/resources/green-256x256.jpg: Added.
+ * http/tests/images/jpg-img-partial-load-expected.png: Added.
+ * http/tests/images/jpg-img-partial-load-expected.txt: Added.
+ * http/tests/images/jpg-img-partial-load.html: Added.
+ * http/tests/resources/load-and-stall.php: Added.
+
2012-08-08 Xingnan Wang <[email protected]>
Skip CoreAnimation plugin model tests on android
Added: trunk/LayoutTests/fast/images/resources/green-256x256.jpg (0 => 125154)
--- trunk/LayoutTests/fast/images/resources/green-256x256.jpg (rev 0)
+++ trunk/LayoutTests/fast/images/resources/green-256x256.jpg 2012-08-09 06:23:42 UTC (rev 125154)
@@ -0,0 +1,5 @@
+\xFF\xD8\xFF\xE0 JFIF H H \xFF\xDB C \xFF\xDB C\xFF\xC0 "