Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Unified Diff: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

Issue 7465097: Merge 92227 - [Chromium] Remove an unnecessary readback during accelerated (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
===================================================================
--- Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (revision 92296)
+++ Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (working copy)
@@ -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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698