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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasStyle.cpp

Issue 2007553002: Retire setGradientSpaceTransform, setPatternSpaceTransform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more expectations Created 4 years, 7 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) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "modules/canvas2d/CanvasStyle.h" 29 #include "modules/canvas2d/CanvasStyle.h"
30 30
31 #include "core/CSSPropertyNames.h" 31 #include "core/CSSPropertyNames.h"
32 #include "core/css/StylePropertySet.h" 32 #include "core/css/StylePropertySet.h"
33 #include "core/css/parser/CSSParser.h" 33 #include "core/css/parser/CSSParser.h"
34 #include "core/html/HTMLCanvasElement.h" 34 #include "core/html/HTMLCanvasElement.h"
35 #include "modules/canvas2d/CanvasGradient.h" 35 #include "modules/canvas2d/CanvasGradient.h"
36 #include "modules/canvas2d/CanvasPattern.h" 36 #include "modules/canvas2d/CanvasPattern.h"
37 #include "platform/graphics/skia/SkiaUtils.h"
37 #include "third_party/skia/include/core/SkShader.h" 38 #include "third_party/skia/include/core/SkShader.h"
38 #include "wtf/PassRefPtr.h" 39 #include "wtf/PassRefPtr.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
42 enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParsedSystemColor, Parse Failed }; 43 enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParsedSystemColor, Parse Failed };
43 44
44 static ColorParseResult parseColor(Color& parsedColor, const String& colorString ) 45 static ColorParseResult parseColor(Color& parsedColor, const String& colorString )
45 { 46 {
46 if (equalIgnoringCase(colorString, "currentcolor")) 47 if (equalIgnoringCase(colorString, "currentcolor"))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 113
113 void CanvasStyle::applyToPaint(SkPaint& paint) const 114 void CanvasStyle::applyToPaint(SkPaint& paint) const
114 { 115 {
115 switch (m_type) { 116 switch (m_type) {
116 case ColorRGBA: 117 case ColorRGBA:
117 paint.setShader(nullptr); 118 paint.setShader(nullptr);
118 break; 119 break;
119 case Gradient: 120 case Gradient:
120 getCanvasGradient()->getGradient()->applyToPaint(paint); 121 getCanvasGradient()->getGradient()->applyToPaint(paint);
121 break; 122 break;
122 case ImagePattern: 123 case ImagePattern: {
123 getCanvasPattern()->getPattern()->applyToPaint(paint); 124 const SkMatrix localMatrix = affineTransformToSkMatrix(getCanvasPattern( )->getTransform());
125 getCanvasPattern()->getPattern()->applyToPaint(paint, &localMatrix);
126 }
124 break; 127 break;
fs 2016/05/24 18:32:03 Nit: Exchange this line with the one above?
f(malita) 2016/05/24 18:42:26 Done.
125 default: 128 default:
126 ASSERT_NOT_REACHED(); 129 ASSERT_NOT_REACHED();
127 } 130 }
128 } 131 }
129 132
130 RGBA32 CanvasStyle::paintColor() const 133 RGBA32 CanvasStyle::paintColor() const
131 { 134 {
132 if (m_type == ColorRGBA) 135 if (m_type == ColorRGBA)
133 return m_rgba; 136 return m_rgba;
134 ASSERT(m_type == Gradient || m_type == ImagePattern); 137 ASSERT(m_type == Gradient || m_type == ImagePattern);
135 return Color::black; 138 return Color::black;
136 } 139 }
137 140
138 DEFINE_TRACE(CanvasStyle) 141 DEFINE_TRACE(CanvasStyle)
139 { 142 {
140 visitor->trace(m_gradient); 143 visitor->trace(m_gradient);
141 visitor->trace(m_pattern); 144 visitor->trace(m_pattern);
142 } 145 }
143 146
144 } // namespace blink 147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698