Title: [131370] trunk/Source/WebCore
- Revision
- 131370
- Author
- r...@google.com
- Date
- 2012-10-15 15:15:46 -0700 (Mon, 15 Oct 2012)
Log Message
In Skia's ImageFrame, only set the isOpaque flag when the frame is complete
https://bugs.webkit.org/show_bug.cgi?id=99326
Reviewed by Stephen White.
No new tests -- existing layouttests exercise this, esp.
png-partial-load-no-alpha.html
webp-partial-load.html
These two fail if skia is told that these are opaque, which it is w/o this CL.
At the moment, Skia has a hack to ignore the opaque-setting, so that these tests will pass as is.
This change is to first, correct webkit to only set isOpaque when the frame is complete, so that
in a later change, Skia can remove the hack, and re-enable its opaqueness optimization.
* platform/image-decoders/skia/ImageDecoderSkia.cpp:
(WebCore::ImageFrame::ImageFrame):
(WebCore::ImageFrame::operator=):
(WebCore::ImageFrame::zeroFillPixelData):
(WebCore::ImageFrame::hasAlpha):
(WebCore::ImageFrame::setHasAlpha):
(WebCore::ImageFrame::setStatus):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (131369 => 131370)
--- trunk/Source/WebCore/ChangeLog 2012-10-15 22:08:22 UTC (rev 131369)
+++ trunk/Source/WebCore/ChangeLog 2012-10-15 22:15:46 UTC (rev 131370)
@@ -1,3 +1,27 @@
+2012-10-15 Mike Reed <r...@google.com>
+
+ In Skia's ImageFrame, only set the isOpaque flag when the frame is complete
+ https://bugs.webkit.org/show_bug.cgi?id=99326
+
+ Reviewed by Stephen White.
+
+ No new tests -- existing layouttests exercise this, esp.
+ png-partial-load-no-alpha.html
+ webp-partial-load.html
+ These two fail if skia is told that these are opaque, which it is w/o this CL.
+
+ At the moment, Skia has a hack to ignore the opaque-setting, so that these tests will pass as is.
+ This change is to first, correct webkit to only set isOpaque when the frame is complete, so that
+ in a later change, Skia can remove the hack, and re-enable its opaqueness optimization.
+
+ * platform/image-decoders/skia/ImageDecoderSkia.cpp:
+ (WebCore::ImageFrame::ImageFrame):
+ (WebCore::ImageFrame::operator=):
+ (WebCore::ImageFrame::zeroFillPixelData):
+ (WebCore::ImageFrame::hasAlpha):
+ (WebCore::ImageFrame::setHasAlpha):
+ (WebCore::ImageFrame::setStatus):
+
2012-10-12 Tony Chang <t...@chromium.org>
input[type=range] as a flex item renders thumb at wrong position
Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (131369 => 131370)
--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-10-15 22:08:22 UTC (rev 131369)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h 2012-10-15 22:15:46 UTC (rev 131370)
@@ -177,10 +177,10 @@
Vector<PixelData> m_backingStore;
PixelData* m_bytes; // The memory is backed by m_backingStore.
IntSize m_size;
- bool m_hasAlpha;
// FIXME: Do we need m_colorProfile anymore?
ColorProfile m_colorProfile;
#endif
+ bool m_hasAlpha;
IntRect m_originalFrameRect; // This will always just be the entire
// buffer except for GIF frames whose
// original rect was smaller than the
Modified: trunk/Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp (131369 => 131370)
--- trunk/Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp 2012-10-15 22:08:22 UTC (rev 131369)
+++ trunk/Source/WebCore/platform/image-decoders/skia/ImageDecoderSkia.cpp 2012-10-15 22:15:46 UTC (rev 131370)
@@ -30,7 +30,8 @@
namespace WebCore {
ImageFrame::ImageFrame()
- : m_status(FrameEmpty)
+ : m_hasAlpha(false)
+ , m_status(FrameEmpty)
, m_duration(0)
, m_disposalMethod(DisposeNotSpecified)
, m_premultiplyAlpha(true)
@@ -51,6 +52,9 @@
setDuration(other.duration());
setDisposalMethod(other.disposalMethod());
setPremultiplyAlpha(other.premultiplyAlpha());
+ // Be sure that this is called after we've called setStatus(), since we
+ // look at our status to know what to do with the alpha value.
+ setHasAlpha(other.hasAlpha());
return *this;
}
@@ -67,6 +71,7 @@
void ImageFrame::zeroFillPixelData()
{
m_bitmap.bitmap().eraseARGB(0, 0, 0, 0);
+ m_hasAlpha = true;
}
bool ImageFrame::copyBitmapData(const ImageFrame& other)
@@ -99,12 +104,20 @@
bool ImageFrame::hasAlpha() const
{
- return !m_bitmap.bitmap().isOpaque();
+ return m_hasAlpha;
}
void ImageFrame::setHasAlpha(bool alpha)
{
- m_bitmap.bitmap().setIsOpaque(!alpha);
+ m_hasAlpha = alpha;
+
+ // If the frame is not fully loaded, there will be transparent pixels,
+ // so we can't tell skia we're opaque, even for image types that logically
+ // always are (e.g. jpeg).
+ bool isOpaque = !m_hasAlpha;
+ if (m_status != FrameComplete)
+ isOpaque = false;
+ m_bitmap.bitmap().setIsOpaque(isOpaque);
}
void ImageFrame::setColorProfile(const ColorProfile& colorProfile)
@@ -116,8 +129,10 @@
void ImageFrame::setStatus(FrameStatus status)
{
m_status = status;
- if (m_status == FrameComplete)
+ if (m_status == FrameComplete) {
+ m_bitmap.bitmap().setIsOpaque(!m_hasAlpha);
m_bitmap.setDataComplete(); // Tell the bitmap it's done.
+ }
}
int ImageFrame::width() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes