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

Side by Side Diff: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

Issue 7564022: Merge 91870 - Fix for printing with accelerated <canvas> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 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 unified diff | Download patch
« no previous file with comments | « Source/WebCore/html/HTMLCanvasElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, Google Inc. All rights reserved. 2 * Copyright (c) 2008, Google Inc. All rights reserved.
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const 107 void ImageBuffer::clip(GraphicsContext* context, const FloatRect& rect) const
108 { 108 {
109 context->platformContext()->beginLayerClippedToImage(rect, this); 109 context->platformContext()->beginLayerClippedToImage(rect, this);
110 } 110 }
111 111
112 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con st FloatRect& destRect, const FloatRect& srcRect, 112 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con st FloatRect& destRect, const FloatRect& srcRect,
113 CompositeOperator op, bool useLowQualityScale) 113 CompositeOperator op, bool useLowQualityScale)
114 { 114 {
115 m_context->platformContext()->makeGrContextCurrent();
116 SkDevice* srcDevice = m_context->platformContext()->canvas()->getDevice();
117 SkBitmap bitmap = srcDevice->accessBitmap(false);
118 SkAutoLockPixels bitmapLock(bitmap);
115 context->platformContext()->makeGrContextCurrent(); 119 context->platformContext()->makeGrContextCurrent();
116 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformC ontext.bitmap(), context == m_context); 120 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(bitmap, context == m_context);
117 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useL owQualityScale); 121 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useL owQualityScale);
118 } 122 }
119 123
120 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const AffineTransform& patternTransform, 124 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const AffineTransform& patternTransform,
121 const FloatPoint& phase, ColorSpace styleColorSpac e, CompositeOperator op, const FloatRect& destRect) 125 const FloatPoint& phase, ColorSpace styleColorSpac e, CompositeOperator op, const FloatRect& destRect)
122 { 126 {
123 context->platformContext()->makeGrContextCurrent(); 127 context->platformContext()->makeGrContextCurrent();
124 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformC ontext.bitmap(), context == m_context); 128 RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformC ontext.bitmap(), context == m_context);
125 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac e, op, destRect); 129 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac e, op, destRect);
126 } 130 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 373
370 return ImageToDataURL(bitmap, mimeType, quality); 374 return ImageToDataURL(bitmap, mimeType, quality);
371 } 375 }
372 376
373 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality) 377 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality)
374 { 378 {
375 return ImageToDataURL(source, mimeType, quality); 379 return ImageToDataURL(source, mimeType, quality);
376 } 380 }
377 381
378 } // namespace WebCore 382 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/HTMLCanvasElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698