| 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 "platform/graphics/GraphicsContextState.h" | 5 #include "platform/graphics/GraphicsContextState.h" |
| 6 | 6 |
| 7 #include "platform/graphics/skia/SkiaUtils.h" | 7 #include "platform/graphics/skia/SkiaUtils.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 void GraphicsContextState::setFillColor(const Color& color) { | 85 void GraphicsContextState::setFillColor(const Color& color) { |
| 86 m_fillPaint.setColor(color.rgb()); | 86 m_fillPaint.setColor(color.rgb()); |
| 87 m_fillPaint.setShader(0); | 87 m_fillPaint.setShader(0); |
| 88 } | 88 } |
| 89 | 89 |
| 90 // Shadow. (This will need tweaking if we use draw loopers for other things.) | 90 // Shadow. (This will need tweaking if we use draw loopers for other things.) |
| 91 void GraphicsContextState::setDrawLooper(sk_sp<SkDrawLooper> drawLooper) { | 91 void GraphicsContextState::setDrawLooper(sk_sp<SkDrawLooper> drawLooper) { |
| 92 // Grab a new ref for stroke. | 92 // Grab a new ref for stroke. |
| 93 m_strokePaint.setLooper(sk_ref_sp(drawLooper.get())); | 93 m_strokePaint.setLooper(drawLooper); |
| 94 // Pass the existing ref to fill (to minimize refcount churn). | 94 // Pass the existing ref to fill (to minimize refcount churn). |
| 95 m_fillPaint.setLooper(std::move(drawLooper)); | 95 m_fillPaint.setLooper(std::move(drawLooper)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void GraphicsContextState::setLineDash(const DashArray& dashes, | 98 void GraphicsContextState::setLineDash(const DashArray& dashes, |
| 99 float dashOffset) { | 99 float dashOffset) { |
| 100 m_strokeData.setLineDash(dashes, dashOffset); | 100 m_strokeData.setLineDash(dashes, dashOffset); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void GraphicsContextState::setColorFilter(sk_sp<SkColorFilter> colorFilter) { | 103 void GraphicsContextState::setColorFilter(sk_sp<SkColorFilter> colorFilter) { |
| 104 // Grab a new ref for stroke. | 104 // Grab a new ref for stroke. |
| 105 m_strokePaint.setColorFilter(sk_ref_sp(colorFilter.get())); | 105 m_strokePaint.setColorFilter(colorFilter); |
| 106 // Pass the existing ref to fill (to minimize refcount churn). | 106 // Pass the existing ref to fill (to minimize refcount churn). |
| 107 m_fillPaint.setColorFilter(std::move(colorFilter)); | 107 m_fillPaint.setColorFilter(std::move(colorFilter)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void GraphicsContextState::setInterpolationQuality( | 110 void GraphicsContextState::setInterpolationQuality( |
| 111 InterpolationQuality quality) { | 111 InterpolationQuality quality) { |
| 112 m_interpolationQuality = quality; | 112 m_interpolationQuality = quality; |
| 113 m_strokePaint.setFilterQuality(filterQualityForPaint(quality)); | 113 m_strokePaint.setFilterQuality(filterQualityForPaint(quality)); |
| 114 m_fillPaint.setFilterQuality(filterQualityForPaint(quality)); | 114 m_fillPaint.setFilterQuality(filterQualityForPaint(quality)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) { | 117 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) { |
| 118 m_shouldAntialias = shouldAntialias; | 118 m_shouldAntialias = shouldAntialias; |
| 119 m_strokePaint.setAntiAlias(shouldAntialias); | 119 m_strokePaint.setAntiAlias(shouldAntialias); |
| 120 m_fillPaint.setAntiAlias(shouldAntialias); | 120 m_fillPaint.setAntiAlias(shouldAntialias); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |