Index: ui/gfx/render_text.cc |
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc |
index e6e7398cafff6187c393c7752ec90282ae0e69a4..bd804d65f5ea2168b6943c49d50722d7d5382679 100644 |
--- a/ui/gfx/render_text.cc |
+++ b/ui/gfx/render_text.cc |
@@ -139,11 +139,11 @@ void AddFadeEffect(const Rect& text_rect, |
// Creates a SkShader to fade the text, with |left_part| specifying the left |
// fade effect, if any, and |right_part| specifying the right fade effect. |
-skia::RefPtr<SkShader> CreateFadeShader(const FontList& font_list, |
- const Rect& text_rect, |
- const Rect& left_part, |
- const Rect& right_part, |
- SkColor color) { |
+sk_sp<SkShader> CreateFadeShader(const FontList& font_list, |
+ const Rect& text_rect, |
+ const Rect& left_part, |
+ const Rect& right_part, |
+ SkColor color) { |
// In general, fade down to 0 alpha. But when the available width is less |
// than four characters, linearly ramp up the fade target alpha to as high as |
// 20% at zero width. This allows the user to see the last faded characters a |
@@ -174,9 +174,9 @@ skia::RefPtr<SkShader> CreateFadeShader(const FontList& font_list, |
const SkPoint points[2] = { PointToSkPoint(text_rect.origin()), |
PointToSkPoint(text_rect.top_right()) }; |
- return skia::AdoptRef( |
- SkGradientShader::CreateLinear(&points[0], &colors[0], &positions[0], |
- colors.size(), SkShader::kClamp_TileMode)); |
+ return |
+ SkGradientShader::MakeLinear(&points[0], &colors[0], &positions[0], |
+ colors.size(), SkShader::kClamp_TileMode); |
} |
// Converts a FontRenderParams::Hinting value to the corresponding |
@@ -269,8 +269,8 @@ void SkiaTextRenderer::SetForegroundColor(SkColor foreground) { |
paint_.setColor(foreground); |
} |
-void SkiaTextRenderer::SetShader(SkShader* shader) { |
- paint_.setShader(shader); |
+void SkiaTextRenderer::SetShader(sk_sp<SkShader> shader) { |
+ paint_.setShader(std::move(shader)); |
} |
void SkiaTextRenderer::SetUnderlineMetrics(SkScalar thickness, |
@@ -1231,11 +1231,9 @@ void RenderText::ApplyFadeEffects(internal::SkiaTextRenderer* renderer) { |
text_rect.Inset(GetAlignmentOffset(0).x(), 0, 0, 0); |
// TODO(msw): Use the actual text colors corresponding to each faded part. |
- skia::RefPtr<SkShader> shader = |
+ renderer->SetShader( |
CreateFadeShader(font_list(), text_rect, left_part, right_part, |
- colors_.breaks().front().second); |
- if (shader) |
- renderer->SetShader(shader.get()); |
+ colors_.breaks().front().second)); |
} |
void RenderText::ApplyTextShadows(internal::SkiaTextRenderer* renderer) { |