Index: third_party/WebKit/Source/platform/graphics/Gradient.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/Gradient.cpp b/third_party/WebKit/Source/platform/graphics/Gradient.cpp |
index 9736e023b34a5b6db7b8510a48288c9f8ecedcb6..fd2964a4993b727deb0523d09bb67216b9a6dc11 100644 |
--- a/third_party/WebKit/Source/platform/graphics/Gradient.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/Gradient.cpp |
@@ -233,32 +233,33 @@ SkShader* Gradient::shader() |
// Since the two-point radial gradient is slower than the plain radial, |
// only use it if we have to. |
if (m_p0 == m_p1 && m_r0 <= 0.0f) { |
- m_gradient = adoptRef(SkGradientShader::CreateRadial(m_p1.data(), m_r1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
+ m_gradient = fromSkSp(SkGradientShader::MakeRadial(m_p1.data(), m_r1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
} else { |
// The radii we give to Skia must be positive. If we're given a |
// negative radius, ask for zero instead. |
SkScalar radius0 = m_r0 >= 0.0f ? WebCoreFloatToSkScalar(m_r0) : 0; |
SkScalar radius1 = m_r1 >= 0.0f ? WebCoreFloatToSkScalar(m_r1) : 0; |
- m_gradient = adoptRef(SkGradientShader::CreateTwoPointConical(m_p0.data(), radius0, m_p1.data(), radius1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
+ m_gradient = fromSkSp(SkGradientShader::MakeTwoPointConical(m_p0.data(), radius0, m_p1.data(), radius1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
} |
} else { |
SkPoint pts[2] = { m_p0.data(), m_p1.data() }; |
SkMatrix localMatrix = affineTransformToSkMatrix(m_gradientSpaceTransformation); |
- m_gradient = adoptRef(SkGradientShader::CreateLinear(pts, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
+ m_gradient = fromSkSp(SkGradientShader::MakeLinear(pts, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix)); |
} |
if (!m_gradient) { |
// use last color, since our "geometry" was degenerate (e.g. radius==0) |
- m_gradient = adoptRef(SkShader::CreateColorShader(colors[countUsed - 1])); |
+ m_gradient = fromSkSp(SkShader::MakeColorShader(colors[countUsed - 1])); |
} |
return m_gradient.get(); |
} |
void Gradient::applyToPaint(SkPaint& paint) |
{ |
- paint.setShader(shader()); |
+ paint.setShader(sk_ref_sp(shader())); |
Stephen White
2016/03/18 14:48:27
Perhaps m_gradient should be sk_sp<SkShader>, and
f(malita)
2016/03/18 15:11:53
I'm not sure what the right balance for Blink's sk
|
// Legacy behavior: gradients are always dithered. |
paint.setDither(true); |
} |
+ |
} // namespace blink |