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

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2559013002: Add ColorBehavior to blink::Image draw methods (Closed)
Patch Set: Rebase Created 4 years 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) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. 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 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Compensate for the container size rounding by adjusting the source rect. 255 // Compensate for the container size rounding by adjusting the source rect.
256 FloatSize adjustedSrcSize = scaledSrc.size(); 256 FloatSize adjustedSrcSize = scaledSrc.size();
257 adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(), 257 adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(),
258 roundedContainerSize.height() / containerSize.height()); 258 roundedContainerSize.height() / containerSize.height());
259 scaledSrc.setSize(adjustedSrcSize); 259 scaledSrc.setSize(adjustedSrcSize);
260 260
261 drawInternal(canvas, paint, dstRect, scaledSrc, DoNotRespectImageOrientation, 261 drawInternal(canvas, paint, dstRect, scaledSrc, DoNotRespectImageOrientation,
262 ClampImageToSourceRect, url); 262 ClampImageToSourceRect, url);
263 } 263 }
264 264
265 sk_sp<SkImage> SVGImage::imageForCurrentFrame() { 265 sk_sp<SkImage> SVGImage::imageForCurrentFrame(
266 const ColorBehavior& colorBehavior) {
267 // TODO(ccameron): This function should not ignore |colorBehavior|.
268 // https://crbug.com/667431
266 return imageForCurrentFrameForContainer(KURL(), size()); 269 return imageForCurrentFrameForContainer(KURL(), size());
267 } 270 }
268 271
269 void SVGImage::drawPatternForContainer(GraphicsContext& context, 272 void SVGImage::drawPatternForContainer(GraphicsContext& context,
270 const FloatSize containerSize, 273 const FloatSize containerSize,
271 float zoom, 274 float zoom,
272 const FloatRect& srcRect, 275 const FloatRect& srcRect,
273 const FloatSize& tileScale, 276 const FloatSize& tileScale,
274 const FloatPoint& phase, 277 const FloatPoint& phase,
275 SkBlendMode compositeOp, 278 SkBlendMode compositeOp,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (SkColorGetA(paint.getColor()) < 255) 338 if (SkColorGetA(paint.getColor()) < 255)
336 return true; 339 return true;
337 return !paint.isSrcOver(); 340 return !paint.isSrcOver();
338 } 341 }
339 342
340 void SVGImage::draw(SkCanvas* canvas, 343 void SVGImage::draw(SkCanvas* canvas,
341 const SkPaint& paint, 344 const SkPaint& paint,
342 const FloatRect& dstRect, 345 const FloatRect& dstRect,
343 const FloatRect& srcRect, 346 const FloatRect& srcRect,
344 RespectImageOrientationEnum shouldRespectImageOrientation, 347 RespectImageOrientationEnum shouldRespectImageOrientation,
345 ImageClampingMode clampMode) { 348 ImageClampingMode clampMode,
349 const ColorBehavior& colorBehavior) {
350 // TODO(ccameron): This function should not ignore |colorBehavior|.
351 // https://crbug.com/667431
346 if (!m_page) 352 if (!m_page)
347 return; 353 return;
348 354
349 drawInternal(canvas, paint, dstRect, srcRect, shouldRespectImageOrientation, 355 drawInternal(canvas, paint, dstRect, srcRect, shouldRespectImageOrientation,
350 clampMode, KURL()); 356 clampMode, KURL());
351 } 357 }
352 358
353 void SVGImage::drawInternal(SkCanvas* canvas, 359 void SVGImage::drawInternal(SkCanvas* canvas,
354 const SkPaint& paint, 360 const SkPaint& paint,
355 const FloatRect& dstRect, 361 const FloatRect& dstRect,
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 625 }
620 626
621 return m_page ? SizeAvailable : SizeUnavailable; 627 return m_page ? SizeAvailable : SizeUnavailable;
622 } 628 }
623 629
624 String SVGImage::filenameExtension() const { 630 String SVGImage::filenameExtension() const {
625 return "svg"; 631 return "svg";
626 } 632 }
627 633
628 } // namespace blink 634 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698