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

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

Issue 13637006: Add canvas blending modes under a runtime flag (Closed) Base URL: http://src.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 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
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 { 260 {
261 context->platformContext()->beginLayerClippedToImage(rect, this); 261 context->platformContext()->beginLayerClippedToImage(rect, this);
262 } 262 }
263 263
264 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst) 264 static bool drawNeedsCopy(GraphicsContext* src, GraphicsContext* dst)
265 { 265 {
266 return (dst->platformContext()->isDeferred() || src == dst); 266 return (dst->platformContext()->isDeferred() || src == dst);
267 } 267 }
268 268
269 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con st FloatRect& destRect, const FloatRect& srcRect, 269 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, con st FloatRect& destRect, const FloatRect& srcRect,
270 CompositeOperator op, BlendMode, bool useLowQualityScale) 270 CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
271 { 271 {
272 const SkBitmap& bitmap = *m_data.m_platformContext.bitmap(); 272 const SkBitmap& bitmap = *m_data.m_platformContext.bitmap();
273 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); 273 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap));
274 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNo tRespectImageOrientation, useLowQualityScale); 274 context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, blen dMode, DoNotRespectImageOrientation, useLowQualityScale);
Stephen Chennney 2013/04/08 16:07:02 Does this change make some version of drawImage no
rosca 2013/04/08 19:53:25 I removed one of the GraphicsContext::drawImage me
275 } 275 }
276 276
277 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const AffineTransform& patternTransform, 277 void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect , const AffineTransform& patternTransform,
278 const FloatPoint& phase, ColorSpace styleColorSpac e, CompositeOperator op, const FloatRect& destRect) 278 const FloatPoint& phase, ColorSpace styleColorSpac e, CompositeOperator op, const FloatRect& destRect)
279 { 279 {
280 const SkBitmap& bitmap = *m_data.m_platformContext.bitmap(); 280 const SkBitmap& bitmap = *m_data.m_platformContext.bitmap();
281 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); 281 RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsC opy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap));
282 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac e, op, destRect); 282 image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpac e, op, destRect);
283 } 283 }
284 284
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (!encodeImage(imageData, mimeType, quality, &encodedImage)) 451 if (!encodeImage(imageData, mimeType, quality, &encodedImage))
452 return "data:,"; 452 return "data:,";
453 453
454 Vector<char> base64Data; 454 Vector<char> base64Data;
455 base64Encode(encodedImage, base64Data); 455 base64Encode(encodedImage, base64Data);
456 456
457 return "data:" + mimeType + ";base64," + base64Data; 457 return "data:" + mimeType + ";base64," + base64Data;
458 } 458 }
459 459
460 } // namespace WebCore 460 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698