diff options
author | reed <reed@google.com> | 2016-03-11 04:59:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-11 13:00:21 +0000 |
commit | 642d8f97282ddbdb26f76ae6773e8bc459b4b15b (patch) | |
tree | d136e6ec545c7e1aa66ad1e1417c85df9377db02 /ui/views | |
parent | ccb033d86c3371aa90b079b7bac879fd536e02ad (diff) | |
download | chromium_src-642d8f97282ddbdb26f76ae6773e8bc459b4b15b.zip chromium_src-642d8f97282ddbdb26f76ae6773e8bc459b4b15b.tar.gz chromium_src-642d8f97282ddbdb26f76ae6773e8bc459b4b15b.tar.bz2 |
Begin switch-over to using sk_sp (for SkShader for now)
This is not a complete conversion of setShader() sites, but is intended to be a canary, to tryout the new patterns. More will follow once this is approved.
BUG=skia:5077
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1778913002
Cr-Commit-Position: refs/heads/master@{#380613}
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/color_chooser/color_chooser_view.cc | 6 | ||||
-rw-r--r-- | ui/views/controls/progress_bar.cc | 13 | ||||
-rw-r--r-- | ui/views/painter.cc | 3 |
3 files changed, 8 insertions, 14 deletions
diff --git a/ui/views/color_chooser/color_chooser_view.cc b/ui/views/color_chooser/color_chooser_view.cc index 2c63883..e0aea82 100644 --- a/ui/views/color_chooser/color_chooser_view.cc +++ b/ui/views/color_chooser/color_chooser_view.cc @@ -103,11 +103,9 @@ void DrawGradientRect(const gfx::Rect& rect, SkColor start_color, points[1].iset(rect.width() + 1, 0); else points[1].iset(0, rect.height() + 1); - skia::RefPtr<SkShader> shader(skia::AdoptRef( - SkGradientShader::CreateLinear(points, colors, NULL, 2, - SkShader::kClamp_TileMode))); SkPaint paint; - paint.setShader(shader.get()); + paint.setShader(SkGradientShader::MakeLinear(points, colors, NULL, 2, + SkShader::kClamp_TileMode)); canvas->DrawRect(rect, paint); } diff --git a/ui/views/controls/progress_bar.cc b/ui/views/controls/progress_bar.cc index 0a9fd12..0278e5b 100644 --- a/ui/views/controls/progress_bar.cc +++ b/ui/views/controls/progress_bar.cc @@ -82,9 +82,8 @@ void FillRoundRect(gfx::Canvas* canvas, } else { p[1].iset(x, y + h); } - skia::RefPtr<SkShader> s = skia::AdoptRef(SkGradientShader::CreateLinear( - p, colors, points, count, SkShader::kClamp_TileMode)); - paint.setShader(s.get()); + paint.setShader(SkGradientShader::MakeLinear(p, colors, points, count, + SkShader::kClamp_TileMode)); canvas->DrawPath(path, paint); } @@ -296,11 +295,9 @@ void ProgressBar::OnPaint(gfx::Canvas* canvas) { std::max(0, progress_width - kHighlightWidth - kBorderWidth); p[0].iset(highlight_left, 0); p[1].iset(progress_width, 0); - skia::RefPtr<SkShader> s = - skia::AdoptRef(SkGradientShader::CreateLinear( - p, highlight_colors, highlight_points, - arraysize(highlight_colors), SkShader::kClamp_TileMode)); - paint.setShader(s.get()); + paint.setShader(SkGradientShader::MakeLinear( + p, highlight_colors, highlight_points, arraysize(highlight_colors), + SkShader::kClamp_TileMode)); paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); canvas->DrawRect(gfx::Rect(highlight_left, 0, kHighlightWidth + kBorderWidth, bar_height), diff --git a/ui/views/painter.cc b/ui/views/painter.cc index 0cc1f0d..8e0d3e6 100644 --- a/ui/views/painter.cc +++ b/ui/views/painter.cc @@ -151,10 +151,9 @@ void GradientPainter::Paint(gfx::Canvas* canvas, const gfx::Size& size) { else p[1].iset(0, size.height()); - skia::RefPtr<SkShader> s = skia::AdoptRef(SkGradientShader::CreateLinear( + paint.setShader(SkGradientShader::MakeLinear( p, colors_.get(), pos_.get(), count_, SkShader::kClamp_TileMode)); paint.setStyle(SkPaint::kFill_Style); - paint.setShader(s.get()); canvas->sk_canvas()->drawRectCoords(SkIntToScalar(0), SkIntToScalar(0), SkIntToScalar(size.width()), |