Title: [123665] trunk/Source/WebCore
- Revision
- 123665
- Author
- r...@google.com
- Date
- 2012-07-25 14:47:21 -0700 (Wed, 25 Jul 2012)
Log Message
fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy
https://bugs.webkit.org/show_bug.cgi?id=92276
Reviewed by Stephen White.
PlatformContextSkia::beginLayerClippedToImage
This function wants to apply the provided ImageBuffer as a clip. Skia does not support this natively yet,
so the code makes a "copy" of that imageBuffer, to be applied later. The old code, wanting to avoid a
deep copy if possible, checked for the presence of a SkPixelRef. If it found one, it made a shallow copy.
This is flawed, since the contents of a pixelref are not guaranteed to be immutable. The new code checks
against this attribute: if the bitmap is "immutable" then we can make a shallow-copy, else we make a
deep copy.
No new tests. Existing svg layouttests work w/ or w/out this change, but at the next Skia deps roll, we see
failures w/o this change. The change is more "correct", though the problem case does not exhibit itself until
Skia rev. 4722 or later lands.
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::beginLayerClippedToImage):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123664 => 123665)
--- trunk/Source/WebCore/ChangeLog 2012-07-25 21:41:14 UTC (rev 123664)
+++ trunk/Source/WebCore/ChangeLog 2012-07-25 21:47:21 UTC (rev 123665)
@@ -1,3 +1,26 @@
+2012-07-25 Mike Reed <r...@google.com>
+
+ fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy
+ https://bugs.webkit.org/show_bug.cgi?id=92276
+
+ Reviewed by Stephen White.
+
+ PlatformContextSkia::beginLayerClippedToImage
+
+ This function wants to apply the provided ImageBuffer as a clip. Skia does not support this natively yet,
+ so the code makes a "copy" of that imageBuffer, to be applied later. The old code, wanting to avoid a
+ deep copy if possible, checked for the presence of a SkPixelRef. If it found one, it made a shallow copy.
+ This is flawed, since the contents of a pixelref are not guaranteed to be immutable. The new code checks
+ against this attribute: if the bitmap is "immutable" then we can make a shallow-copy, else we make a
+ deep copy.
+
+ No new tests. Existing svg layouttests work w/ or w/out this change, but at the next Skia deps roll, we see
+ failures w/o this change. The change is more "correct", though the problem case does not exhibit itself until
+ Skia rev. 4722 or later lands.
+
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (WebCore::PlatformContextSkia::beginLayerClippedToImage):
+
2012-07-25 Li Yin <li....@intel.com>
It is invalid when both numberOfInputChannels and numberOfOutputChannels to be zero in _javascript_AudioNode.
Modified: trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp (123664 => 123665)
--- trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2012-07-25 21:41:14 UTC (rev 123664)
+++ trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp 2012-07-25 21:47:21 UTC (rev 123665)
@@ -284,17 +284,12 @@
}
// Copy off the image as |imageBuffer| may be deleted before restore is invoked.
- if (!bitmap->pixelRef()) {
- // The bitmap owns it's pixels. This happens when we've allocated the
- // pixels in some way and assigned them directly to the bitmap (as
- // happens when we allocate a DIB). In this case the assignment operator
- // does not copy the pixels, rather the copied bitmap ends up
- // referencing the same pixels. As the pixels may not live as long as we
- // need it to, we copy the image.
- bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
- } else {
- // If there is a pixel ref, we can safely use the assignment operator.
+ if (bitmap->isImmutable())
m_state->m_imageBufferClip = *bitmap;
+ else {
+ // We need to make a deep-copy of the pixels themselves, so they don't
+ // change on us between now and when we want to apply them in restore()
+ bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config);
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes