OLD | NEW |
---|---|
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/GraphicsContextState.h" | 6 #include "platform/graphics/GraphicsContextState.h" |
7 | 7 |
8 #include "platform/graphics/skia/SkiaUtils.h" | 8 #include "platform/graphics/skia/SkiaUtils.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 29 matching lines...) Expand all Loading... | |
40 , m_fillPaint(other.m_fillPaint) | 40 , m_fillPaint(other.m_fillPaint) |
41 , m_strokeData(other.m_strokeData) | 41 , m_strokeData(other.m_strokeData) |
42 , m_strokeColor(other.m_strokeColor) | 42 , m_strokeColor(other.m_strokeColor) |
43 , m_strokeGradient(other.m_strokeGradient) | 43 , m_strokeGradient(other.m_strokeGradient) |
44 , m_strokePattern(other.m_strokePattern) | 44 , m_strokePattern(other.m_strokePattern) |
45 , m_fillColor(other.m_fillColor) | 45 , m_fillColor(other.m_fillColor) |
46 , m_fillRule(other.m_fillRule) | 46 , m_fillRule(other.m_fillRule) |
47 , m_fillGradient(other.m_fillGradient) | 47 , m_fillGradient(other.m_fillGradient) |
48 , m_fillPattern(other.m_fillPattern) | 48 , m_fillPattern(other.m_fillPattern) |
49 , m_looper(other.m_looper) | 49 , m_looper(other.m_looper) |
50 , m_imageFilter(other.m_imageFilter) | |
50 , m_textDrawingMode(other.m_textDrawingMode) | 51 , m_textDrawingMode(other.m_textDrawingMode) |
51 , m_alpha(other.m_alpha) | 52 , m_alpha(other.m_alpha) |
52 , m_colorFilter(other.m_colorFilter) | 53 , m_colorFilter(other.m_colorFilter) |
53 , m_compositeOperator(other.m_compositeOperator) | 54 , m_compositeOperator(other.m_compositeOperator) |
54 , m_blendMode(other.m_blendMode) | 55 , m_blendMode(other.m_blendMode) |
55 , m_interpolationQuality(other.m_interpolationQuality) | 56 , m_interpolationQuality(other.m_interpolationQuality) |
56 , m_saveCount(0) | 57 , m_saveCount(0) |
57 , m_shouldAntialias(other.m_shouldAntialias) | 58 , m_shouldAntialias(other.m_shouldAntialias) |
58 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) { } | 59 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) { } |
59 | 60 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 m_fillPaint.setLooper(m_looper.get()); | 198 m_fillPaint.setLooper(m_looper.get()); |
198 } | 199 } |
199 | 200 |
200 void GraphicsContextState::clearDrawLooper() | 201 void GraphicsContextState::clearDrawLooper() |
201 { | 202 { |
202 m_looper.clear(); | 203 m_looper.clear(); |
203 m_strokePaint.setLooper(0); | 204 m_strokePaint.setLooper(0); |
204 m_fillPaint.setLooper(0); | 205 m_fillPaint.setLooper(0); |
205 } | 206 } |
206 | 207 |
208 // Shadow. (This will need tweaking if we use image filters for other things.) | |
Stephen White
2014/10/23 01:45:47
Pls remove this comment.
sugoi1
2014/10/23 17:43:17
Done.
| |
209 void GraphicsContextState::setImageFilter(PassRefPtr<SkImageFilter> imageFilter) | |
210 { | |
211 m_imageFilter = imageFilter; | |
212 m_strokePaint.setImageFilter(m_imageFilter.get()); | |
Stephen White
2014/10/23 01:45:47
I don't think this is correct. If we set an image
sugoi1
2014/10/23 17:43:17
Done.
| |
213 m_fillPaint.setImageFilter(m_imageFilter.get()); | |
214 } | |
215 | |
216 void GraphicsContextState::clearImageFilter() | |
217 { | |
218 m_imageFilter.clear(); | |
219 m_strokePaint.setImageFilter(0); | |
Stephen White
2014/10/23 01:45:47
Same here.
sugoi1
2014/10/23 17:43:17
Done.
| |
220 m_fillPaint.setImageFilter(0); | |
221 } | |
222 | |
207 void GraphicsContextState::setAlphaAsFloat(float alpha) | 223 void GraphicsContextState::setAlphaAsFloat(float alpha) |
208 { | 224 { |
209 if (alpha < 0) { | 225 if (alpha < 0) { |
210 m_alpha = 0; | 226 m_alpha = 0; |
211 } else { | 227 } else { |
212 m_alpha = roundf(alpha * 256); | 228 m_alpha = roundf(alpha * 256); |
213 if (m_alpha > 256) | 229 if (m_alpha > 256) |
214 m_alpha = 256; | 230 m_alpha = 256; |
215 } | 231 } |
216 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); | 232 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); |
(...skipping 30 matching lines...) Expand all Loading... | |
247 | 263 |
248 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) | 264 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) |
249 { | 265 { |
250 m_shouldAntialias = shouldAntialias; | 266 m_shouldAntialias = shouldAntialias; |
251 m_strokePaint.setAntiAlias(shouldAntialias); | 267 m_strokePaint.setAntiAlias(shouldAntialias); |
252 m_fillPaint.setAntiAlias(shouldAntialias); | 268 m_fillPaint.setAntiAlias(shouldAntialias); |
253 } | 269 } |
254 | 270 |
255 | 271 |
256 } // namespace blink | 272 } // namespace blink |
OLD | NEW |