Title: [92297] branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Revision
92297
Author
[email protected]
Date
2011-08-03 11:40:24 -0700 (Wed, 03 Aug 2011)

Log Message

Merge 92227 - [Chromium] Remove an unnecessary readback during accelerated 
canvas-to-canvas draws.
https://bugs.webkit.org/show_bug.cgi?id=65560

Reviewed by James Robinson.

No new tests.  (Printing has few tests, sadly.)

* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::ImageBuffer::draw):
Revert most of the changes to this file from
http://trac.webkit.org/changeset/91870, except for the call which makes
the source context current, so that the readPixels() still works.


[email protected]
Review URL: http://codereview.chromium.org/7465097

Modified Paths

Diff

Modified: branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (92296 => 92297)


--- branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-03 18:38:40 UTC (rev 92296)
+++ branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-03 18:40:24 UTC (rev 92297)
@@ -112,12 +112,15 @@
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
                        CompositeOperator op, bool useLowQualityScale)
 {
+    // Set both graphics contexts current. This looks a little weird, but is
+    // necessary since we may be drawing from an accelerated to
+    // non-accelerated context (e.g., printing), or vice versa. Note that it
+    // only works because the context is actually the same underlying context
+    // (or null), since we use one context for accelerated drawing. If that
+    // assumption changes, we'll have to revisit this code.
+    context->platformContext()->makeGrContextCurrent();
     m_context->platformContext()->makeGrContextCurrent();
-    SkDevice* srcDevice = m_context->platformContext()->canvas()->getDevice();
-    SkBitmap bitmap = srcDevice->accessBitmap(false);
-    SkAutoLockPixels bitmapLock(bitmap);
-    context->platformContext()->makeGrContextCurrent();
-    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(bitmap, context == m_context);
+    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
     context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to