| 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 { |
| 11 | 11 |
| 12 GraphicsContextState::GraphicsContextState() | 12 GraphicsContextState::GraphicsContextState() |
| 13 : m_fillColor(Color::black) | 13 : m_fillColor(Color::black) |
| 14 , m_fillRule(RULE_NONZERO) | 14 , m_fillRule(RULE_NONZERO) |
| 15 , m_textDrawingMode(TextModeFill) | 15 , m_textDrawingMode(TextModeFill) |
| 16 , m_alpha(256) | 16 , m_alpha(256) |
| 17 , m_xferMode(nullptr) | 17 , m_xferMode(nullptr) |
| 18 , m_compositeOperator(CompositeSourceOver) | 18 , m_compositeOperator(CompositeSourceOver) |
| 19 , m_blendMode(WebBlendModeNormal) | 19 , m_blendMode(WebBlendModeNormal) |
| 20 , m_interpolationQuality(InterpolationDefault) | 20 , m_interpolationQuality(InterpolationDefault) |
| 21 , m_saveCount(0) | 21 , m_saveCount(0) |
| 22 , m_shouldAntialias(true) | 22 , m_shouldAntialias(true) |
| 23 , m_shouldSmoothFonts(true) | |
| 24 , m_shouldClampToSourceRect(true) | 23 , m_shouldClampToSourceRect(true) |
| 25 { | 24 { |
| 26 m_strokePaint.setStyle(SkPaint::kStroke_Style); | 25 m_strokePaint.setStyle(SkPaint::kStroke_Style); |
| 27 m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness())); | 26 m_strokePaint.setStrokeWidth(SkFloatToScalar(m_strokeData.thickness())); |
| 28 m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb())); | 27 m_strokePaint.setColor(applyAlpha(m_strokeData.color().rgb())); |
| 29 m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap); | 28 m_strokePaint.setStrokeCap(SkPaint::kDefault_Cap); |
| 30 m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join); | 29 m_strokePaint.setStrokeJoin(SkPaint::kDefault_Join); |
| 31 m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit())); | 30 m_strokePaint.setStrokeMiter(SkFloatToScalar(m_strokeData.miterLimit())); |
| 32 m_strokePaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(m_in
terpolationQuality)); | 31 m_strokePaint.setFilterLevel(WebCoreInterpolationQualityToSkFilterLevel(m_in
terpolationQuality)); |
| 33 m_strokePaint.setAntiAlias(m_shouldAntialias); | 32 m_strokePaint.setAntiAlias(m_shouldAntialias); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 47 , m_looper(other.m_looper) | 46 , m_looper(other.m_looper) |
| 48 , m_textDrawingMode(other.m_textDrawingMode) | 47 , m_textDrawingMode(other.m_textDrawingMode) |
| 49 , m_alpha(other.m_alpha) | 48 , m_alpha(other.m_alpha) |
| 50 , m_xferMode(other.m_xferMode) | 49 , m_xferMode(other.m_xferMode) |
| 51 , m_colorFilter(other.m_colorFilter) | 50 , m_colorFilter(other.m_colorFilter) |
| 52 , m_compositeOperator(other.m_compositeOperator) | 51 , m_compositeOperator(other.m_compositeOperator) |
| 53 , m_blendMode(other.m_blendMode) | 52 , m_blendMode(other.m_blendMode) |
| 54 , m_interpolationQuality(other.m_interpolationQuality) | 53 , m_interpolationQuality(other.m_interpolationQuality) |
| 55 , m_saveCount(0) | 54 , m_saveCount(0) |
| 56 , m_shouldAntialias(other.m_shouldAntialias) | 55 , m_shouldAntialias(other.m_shouldAntialias) |
| 57 , m_shouldSmoothFonts(other.m_shouldSmoothFonts) | |
| 58 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) { } | 56 , m_shouldClampToSourceRect(other.m_shouldClampToSourceRect) { } |
| 59 | 57 |
| 60 void GraphicsContextState::copy(const GraphicsContextState& source) | 58 void GraphicsContextState::copy(const GraphicsContextState& source) |
| 61 { | 59 { |
| 62 this->~GraphicsContextState(); | 60 this->~GraphicsContextState(); |
| 63 new (this) GraphicsContextState(source); | 61 new (this) GraphicsContextState(source); |
| 64 } | 62 } |
| 65 | 63 |
| 66 const SkPaint& GraphicsContextState::strokePaint(int strokedPathLength) const | 64 const SkPaint& GraphicsContextState::strokePaint(int strokedPathLength) const |
| 67 { | 65 { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 245 |
| 248 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) | 246 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) |
| 249 { | 247 { |
| 250 m_shouldAntialias = shouldAntialias; | 248 m_shouldAntialias = shouldAntialias; |
| 251 m_strokePaint.setAntiAlias(shouldAntialias); | 249 m_strokePaint.setAntiAlias(shouldAntialias); |
| 252 m_fillPaint.setAntiAlias(shouldAntialias); | 250 m_fillPaint.setAntiAlias(shouldAntialias); |
| 253 } | 251 } |
| 254 | 252 |
| 255 | 253 |
| 256 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |