Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: third_party/WebKit/Source/platform/graphics/Gradient.cpp

Issue 1814473003: Revert of Add sk_sp helpers and switch Blink SkShader clients to the new APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a2ff0d1a94c99657af5dde247fc4e1bd985f4c3f..9736e023b34a5b6db7b8510a48288c9f8ecedcb6 100644
--- a/third_party/WebKit/Source/platform/graphics/Gradient.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Gradient.cpp
@@ -189,10 +189,10 @@
}
}
-PassRefPtr<SkShader> Gradient::refShader()
+SkShader* Gradient::shader()
{
if (m_gradient)
- return m_gradient;
+ return m_gradient.get();
sortStopsIfNecessary();
ASSERT(m_stopsSorted);
@@ -233,33 +233,32 @@
// 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::MakeRadial(m_p1.data(), m_r1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix));
+ m_gradient = adoptRef(SkGradientShader::CreateRadial(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::MakeTwoPointConical(m_p0.data(), radius0, m_p1.data(), radius1, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix));
+ m_gradient = adoptRef(SkGradientShader::CreateTwoPointConical(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::MakeLinear(pts, colors.data(), pos.data(), static_cast<int>(countUsed), tile, shouldDrawInPMColorSpace, &localMatrix));
+ m_gradient = adoptRef(SkGradientShader::CreateLinear(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::MakeColorShader(colors[countUsed - 1]));
- }
- return m_gradient;
+ m_gradient = adoptRef(SkShader::CreateColorShader(colors[countUsed - 1]));
+ }
+ return m_gradient.get();
}
void Gradient::applyToPaint(SkPaint& paint)
{
- paint.setShader(adoptSkSp(refShader()));
+ paint.setShader(shader());
// Legacy behavior: gradients are always dithered.
paint.setDither(true);
}
-
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/Gradient.h ('k') | third_party/WebKit/Source/platform/graphics/GraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698