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_dropShadowImageFilter(other.m_dropShadowImageFilter) |
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 void GraphicsContextState::setDropShadowImageFilter(PassRefPtr<SkImageFilter> dr
opShadowImageFilter) |
| 209 { |
| 210 m_dropShadowImageFilter = dropShadowImageFilter; |
| 211 } |
| 212 |
| 213 void GraphicsContextState::clearDropShadowImageFilter() |
| 214 { |
| 215 m_dropShadowImageFilter.clear(); |
| 216 } |
| 217 |
207 void GraphicsContextState::setAlphaAsFloat(float alpha) | 218 void GraphicsContextState::setAlphaAsFloat(float alpha) |
208 { | 219 { |
209 if (alpha < 0) { | 220 if (alpha < 0) { |
210 m_alpha = 0; | 221 m_alpha = 0; |
211 } else { | 222 } else { |
212 m_alpha = roundf(alpha * 256); | 223 m_alpha = roundf(alpha * 256); |
213 if (m_alpha > 256) | 224 if (m_alpha > 256) |
214 m_alpha = 256; | 225 m_alpha = 256; |
215 } | 226 } |
216 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); | 227 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); |
(...skipping 30 matching lines...) Expand all Loading... |
247 | 258 |
248 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) | 259 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) |
249 { | 260 { |
250 m_shouldAntialias = shouldAntialias; | 261 m_shouldAntialias = shouldAntialias; |
251 m_strokePaint.setAntiAlias(shouldAntialias); | 262 m_strokePaint.setAntiAlias(shouldAntialias); |
252 m_fillPaint.setAntiAlias(shouldAntialias); | 263 m_fillPaint.setAntiAlias(shouldAntialias); |
253 } | 264 } |
254 | 265 |
255 | 266 |
256 } // namespace blink | 267 } // namespace blink |
OLD | NEW |