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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 m_strokePaint.setStrokeMiter(SkFloatToScalar(miterLimit)); | 90 m_strokePaint.setStrokeMiter(SkFloatToScalar(miterLimit)); |
91 } | 91 } |
92 | 92 |
93 void GraphicsContextState::setFillColor(const Color& color) | 93 void GraphicsContextState::setFillColor(const Color& color) |
94 { | 94 { |
95 m_fillPaint.setColor(color.rgb()); | 95 m_fillPaint.setColor(color.rgb()); |
96 m_fillPaint.setShader(0); | 96 m_fillPaint.setShader(0); |
97 } | 97 } |
98 | 98 |
99 // Shadow. (This will need tweaking if we use draw loopers for other things.) | 99 // Shadow. (This will need tweaking if we use draw loopers for other things.) |
100 void GraphicsContextState::setDrawLooper(PassRefPtr<SkDrawLooper> drawLooper) | 100 void GraphicsContextState::setDrawLooper(sk_sp<SkDrawLooper> drawLooper) |
101 { | 101 { |
102 // Grab a new ref for stroke. | 102 // Grab a new ref for stroke. |
103 m_strokePaint.setLooper(sk_ref_sp(drawLooper.get())); | 103 m_strokePaint.setLooper(sk_ref_sp(drawLooper.get())); |
104 // Pass the existing ref to fill (to minimize refcount churn). | 104 // Pass the existing ref to fill (to minimize refcount churn). |
105 m_fillPaint.setLooper(toSkSp(drawLooper)); | 105 m_fillPaint.setLooper(std::move(drawLooper)); |
106 } | 106 } |
107 | 107 |
108 void GraphicsContextState::setLineDash(const DashArray& dashes, float dashOffset
) | 108 void GraphicsContextState::setLineDash(const DashArray& dashes, float dashOffset
) |
109 { | 109 { |
110 m_strokeData.setLineDash(dashes, dashOffset); | 110 m_strokeData.setLineDash(dashes, dashOffset); |
111 } | 111 } |
112 | 112 |
113 void GraphicsContextState::setColorFilter(PassRefPtr<SkColorFilter> colorFilter) | 113 void GraphicsContextState::setColorFilter(sk_sp<SkColorFilter> colorFilter) |
114 { | 114 { |
115 // Grab a new ref for stroke. | 115 // Grab a new ref for stroke. |
116 m_strokePaint.setColorFilter(sk_ref_sp(colorFilter.get())); | 116 m_strokePaint.setColorFilter(sk_ref_sp(colorFilter.get())); |
117 // Pass the existing ref to fill (to minimize refcount churn). | 117 // Pass the existing ref to fill (to minimize refcount churn). |
118 m_fillPaint.setColorFilter(toSkSp(colorFilter)); | 118 m_fillPaint.setColorFilter(std::move(colorFilter)); |
119 } | 119 } |
120 | 120 |
121 void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality) | 121 void GraphicsContextState::setInterpolationQuality(InterpolationQuality quality) |
122 { | 122 { |
123 m_interpolationQuality = quality; | 123 m_interpolationQuality = quality; |
124 m_strokePaint.setFilterQuality(filterQualityForPaint(quality)); | 124 m_strokePaint.setFilterQuality(filterQualityForPaint(quality)); |
125 m_fillPaint.setFilterQuality(filterQualityForPaint(quality)); | 125 m_fillPaint.setFilterQuality(filterQualityForPaint(quality)); |
126 } | 126 } |
127 | 127 |
128 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) | 128 void GraphicsContextState::setShouldAntialias(bool shouldAntialias) |
129 { | 129 { |
130 m_shouldAntialias = shouldAntialias; | 130 m_shouldAntialias = shouldAntialias; |
131 m_strokePaint.setAntiAlias(shouldAntialias); | 131 m_strokePaint.setAntiAlias(shouldAntialias); |
132 m_fillPaint.setAntiAlias(shouldAntialias); | 132 m_fillPaint.setAntiAlias(shouldAntialias); |
133 } | 133 } |
134 | 134 |
135 } // namespace blink | 135 } // namespace blink |
OLD | NEW |