Chromium Code Reviews| 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 namespace blink { | 8 namespace blink { |
| 9 | 9 |
| 10 GraphicsContextState::GraphicsContextState() | 10 GraphicsContextState::GraphicsContextState() |
| 11 : m_strokeColor(Color::black) | 11 : m_strokeColor(Color::black) |
| 12 , m_fillColor(Color::black) | 12 , m_fillColor(Color::black) |
| 13 , m_fillRule(RULE_NONZERO) | 13 , m_fillRule(RULE_NONZERO) |
| 14 , m_textDrawingMode(TextModeFill) | 14 , m_textDrawingMode(TextModeFill) |
| 15 , m_alpha(256) | 15 , m_alpha(256) |
| 16 , m_compositeOperation(SkXfermode::kSrcOver_Mode) | 16 , m_compositeOperation(SkXfermode::kSrcOver_Mode) |
| 17 , m_interpolationQuality(InterpolationDefault) | 17 , m_interpolationQuality(InterpolationDefault) |
| 18 , m_saveCount(0) | 18 , m_saveCount(0) |
| 19 , m_shouldAntialias(true) | 19 , m_shouldAntialias(true) |
| 20 , m_shouldClampToSourceRect(true) | 20 , m_shouldClampToSourceRect(true) |
| 21 { | 21 { |
| 22 m_strokePaint.setStyle(SkPaint::kStroke_Style); | 22 m_strokePaint.setStyle(SkPaint::kStroke_Style); |
| 23 m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness())); | 23 m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness())); |
| 24 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); | 24 m_strokePaint.setColor(applyAlpha(m_strokeColor.rgb())); |
| 25 m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap); | 25 m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap); |
| 26 m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join); | 26 m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join); |
| 27 m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit())); | 27 m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit())); |
| 28 m_strokePaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(m_in terpolationQuality)); | 28 m_strokePaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality( m_interpolationQuality)); |
|
f(malita)
2015/03/16 19:47:55
Hmm, I don't see SkiaUtils:WebCoreInterpolationQua
reed1
2015/03/16 21:00:10
Done.
| |
| 29 m_strokePaint.setAntiAlias(m_shouldAntialias); | 29 m_strokePaint.setAntiAlias(m_shouldAntialias); |
| 30 m_fillPaint.setColor(applyAlpha(m_fillColor.rgb())); | 30 m_fillPaint.setColor(applyAlpha(m_fillColor.rgb())); |
| 31 m_fillPaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(m_inte rpolationQuality)); | 31 m_fillPaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(m_ interpolationQuality)); |
| 32 m_fillPaint.setAntiAlias(m_shouldAntialias); | 32 m_fillPaint.setAntiAlias(m_shouldAntialias); |
| 33 } | 33 } |
| 34 | 34 |
| 35 GraphicsContextState::GraphicsContextState(const GraphicsContextState& other) | 35 GraphicsContextState::GraphicsContextState(const GraphicsContextState& other) |
| 36 : m_strokePaint(other.m_strokePaint) | 36 : m_strokePaint(other.m_strokePaint) |
| 37 , m_fillPaint(other.m_fillPaint) | 37 , m_fillPaint(other.m_fillPaint) |
| 38 , m_strokeData(other.m_strokeData) | 38 , m_strokeData(other.m_strokeData) |
| 39 , m_strokeColor(other.m_strokeColor) | 39 , m_strokeColor(other.m_strokeColor) |
| 40 , m_strokeGradient(other.m_strokeGradient) | 40 , m_strokeGradient(other.m_strokeGradient) |
| 41 , m_strokePattern(other.m_strokePattern) | 41 , m_strokePattern(other.m_strokePattern) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 void GraphicsContextState::setCompositeOperation(SkXfermode::Mode xferMode) | 205 void GraphicsContextState::setCompositeOperation(SkXfermode::Mode xferMode) |
| 206 { | 206 { |
| 207 m_compositeOperation = xferMode; | 207 m_compositeOperation = xferMode; |
| 208 m_strokePaint.setXfermodeMode(xferMode); | 208 m_strokePaint.setXfermodeMode(xferMode); |
| 209 m_fillPaint.setXfermodeMode(xferMode); | 209 m_fillPaint.setXfermodeMode(xferMode); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality) | 212 void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality) |
| 213 { | 213 { |
| 214 m_interpolationQuality = quality; | 214 m_interpolationQuality = quality; |
| 215 m_strokePaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(qual ity)); | 215 m_strokePaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality( quality)); |
| 216 m_fillPaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(qualit y)); | 216 m_fillPaint.setFilterQuality(WebCoreInterpolationQualityToSkFilterQuality(qu ality)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) | 219 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) |
| 220 { | 220 { |
| 221 m_shouldAntialias = shouldAntialias; | 221 m_shouldAntialias = shouldAntialias; |
| 222 m_strokePaint.setAntiAlias(shouldAntialias); | 222 m_strokePaint.setAntiAlias(shouldAntialias); |
| 223 m_fillPaint.setAntiAlias(shouldAntialias); | 223 m_fillPaint.setAntiAlias(shouldAntialias); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |