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

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

Issue 1786183002: Revert of Switch Blink SkShader clients to sk_sp (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 e59ebf73fdba03f5ff7c02816f2bea5c7b2f4241..9736e023b34a5b6db7b8510a48288c9f8ecedcb6 100644
--- a/third_party/WebKit/Source/platform/graphics/Gradient.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Gradient.cpp
@@ -84,7 +84,7 @@
}
m_stops.append(stop);
- m_gradient.reset();
+ m_gradient.clear();
}
void Gradient::sortStopsIfNecessary()
@@ -117,7 +117,7 @@
return;
m_drawInPMColorSpace = drawInPMColorSpace;
- m_gradient.reset();
+ m_gradient.clear();
}
void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation)
@@ -126,7 +126,7 @@
return;
m_gradientSpaceTransformation = gradientSpaceTransformation;
- m_gradient.reset();
+ m_gradient.clear();
}
// Determine the total number of stops needed, including pseudo-stops at the
@@ -189,10 +189,10 @@
}
}
-sk_sp<SkShader> Gradient::shader()
+SkShader* Gradient::shader()
{
if (m_gradient)
- return m_gradient;
+ return m_gradient.get();
sortStopsIfNecessary();
ASSERT(m_stopsSorted);
@@ -233,25 +233,25 @@
// 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 = 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 = 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 = 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 = 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)

Powered by Google App Engine
This is Rietveld 408576698