Changeset 123665 in webkit
- Timestamp:
- Jul 25, 2012, 2:47:21 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r123662 r123665 1 2012-07-25 Mike Reed <reed@google.com> 2 3 fix test in beginLayerClippedToImage to check for immutability if we're going to do a shallow-copy 4 https://bugs.webkit.org/show_bug.cgi?id=92276 5 6 Reviewed by Stephen White. 7 8 PlatformContextSkia::beginLayerClippedToImage 9 10 This function wants to apply the provided ImageBuffer as a clip. Skia does not support this natively yet, 11 so the code makes a "copy" of that imageBuffer, to be applied later. The old code, wanting to avoid a 12 deep copy if possible, checked for the presence of a SkPixelRef. If it found one, it made a shallow copy. 13 This is flawed, since the contents of a pixelref are not guaranteed to be immutable. The new code checks 14 against this attribute: if the bitmap is "immutable" then we can make a shallow-copy, else we make a 15 deep copy. 16 17 No new tests. Existing svg layouttests work w/ or w/out this change, but at the next Skia deps roll, we see 18 failures w/o this change. The change is more "correct", though the problem case does not exhibit itself until 19 Skia rev. 4722 or later lands. 20 21 * platform/graphics/skia/PlatformContextSkia.cpp: 22 (WebCore::PlatformContextSkia::beginLayerClippedToImage): 23 1 24 2012-07-25 Li Yin <li.yin@intel.com> 2 25 -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r123285 r123665 285 285 286 286 // Copy off the image as |imageBuffer| may be deleted before restore is invoked. 287 if (!bitmap->pixelRef()) { 288 // The bitmap owns it's pixels. This happens when we've allocated the 289 // pixels in some way and assigned them directly to the bitmap (as 290 // happens when we allocate a DIB). In this case the assignment operator 291 // does not copy the pixels, rather the copied bitmap ends up 292 // referencing the same pixels. As the pixels may not live as long as we 293 // need it to, we copy the image. 287 if (bitmap->isImmutable()) 288 m_state->m_imageBufferClip = *bitmap; 289 else { 290 // We need to make a deep-copy of the pixels themselves, so they don't 291 // change on us between now and when we want to apply them in restore() 294 292 bitmap->copyTo(&m_state->m_imageBufferClip, SkBitmap::kARGB_8888_Config); 295 } else {296 // If there is a pixel ref, we can safely use the assignment operator.297 m_state->m_imageBufferClip = *bitmap;298 293 } 299 294 }
Note:
See TracChangeset
for help on using the changeset viewer.