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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp

Issue 2712083002: color: Remove blink pre-conversion code (Closed)
Patch Set: Rebase Created 3 years, 9 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, 2009, 2010, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 18 matching lines...) Expand all
29 #include "platform/geometry/IntSize.h" 29 #include "platform/geometry/IntSize.h"
30 #include "platform/graphics/GraphicsContext.h" 30 #include "platform/graphics/GraphicsContext.h"
31 31
32 namespace blink { 32 namespace blink {
33 33
34 void GradientGeneratedImage::draw(PaintCanvas* canvas, 34 void GradientGeneratedImage::draw(PaintCanvas* canvas,
35 const PaintFlags& flags, 35 const PaintFlags& flags,
36 const FloatRect& destRect, 36 const FloatRect& destRect,
37 const FloatRect& srcRect, 37 const FloatRect& srcRect,
38 RespectImageOrientationEnum, 38 RespectImageOrientationEnum,
39 ImageClampingMode, 39 ImageClampingMode) {
40 const ColorBehavior& colorBehavior) {
41 // TODO(ccameron): This function should not ignore |colorBehavior|.
42 // https://crbug.com/672306
43 SkRect visibleSrcRect = srcRect; 40 SkRect visibleSrcRect = srcRect;
44 if (!visibleSrcRect.intersect( 41 if (!visibleSrcRect.intersect(
45 SkRect::MakeIWH(m_size.width(), m_size.height()))) 42 SkRect::MakeIWH(m_size.width(), m_size.height())))
46 return; 43 return;
47 44
48 const SkMatrix transform = 45 const SkMatrix transform =
49 SkMatrix::MakeRectToRect(srcRect, destRect, SkMatrix::kFill_ScaleToFit); 46 SkMatrix::MakeRectToRect(srcRect, destRect, SkMatrix::kFill_ScaleToFit);
50 SkRect visibleDestRect; 47 SkRect visibleDestRect;
51 transform.mapRect(&visibleDestRect, visibleSrcRect); 48 transform.mapRect(&visibleDestRect, visibleSrcRect);
52 49
53 PaintFlags gradientFlags(flags); 50 PaintFlags gradientFlags(flags);
54 m_gradient->applyToFlags(gradientFlags, transform); 51 m_gradient->applyToFlags(gradientFlags, transform);
55 canvas->drawRect(visibleDestRect, gradientFlags); 52 canvas->drawRect(visibleDestRect, gradientFlags);
56 } 53 }
57 54
58 void GradientGeneratedImage::drawTile(GraphicsContext& context, 55 void GradientGeneratedImage::drawTile(GraphicsContext& context,
59 const FloatRect& srcRect) { 56 const FloatRect& srcRect) {
60 // TODO(ccameron): This function should not ignore |context|'s color behavior. 57 // TODO(ccameron): This function should not ignore |context|'s color behavior.
61 // https://crbug.com/672306 58 // https://crbug.com/672306
62 PaintFlags gradientFlags(context.fillFlags()); 59 PaintFlags gradientFlags(context.fillFlags());
63 m_gradient->applyToFlags(gradientFlags, SkMatrix::I()); 60 m_gradient->applyToFlags(gradientFlags, SkMatrix::I());
64 61
65 context.drawRect(srcRect, gradientFlags); 62 context.drawRect(srcRect, gradientFlags);
66 } 63 }
67 64
68 bool GradientGeneratedImage::applyShader(PaintFlags& flags, 65 bool GradientGeneratedImage::applyShader(PaintFlags& flags,
69 const SkMatrix& localMatrix, 66 const SkMatrix& localMatrix) {
70 const ColorBehavior& colorBehavior) {
71 // TODO(ccameron): This function should not ignore |colorBehavior|.
72 // https://crbug.com/672306
73 DCHECK(m_gradient); 67 DCHECK(m_gradient);
74 m_gradient->applyToFlags(flags, localMatrix); 68 m_gradient->applyToFlags(flags, localMatrix);
75 69
76 return true; 70 return true;
77 } 71 }
78 72
79 } // namespace blink 73 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698