diff options
author | tfarina <tfarina@chromium.org> | 2015-01-07 18:22:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-08 02:23:04 +0000 |
commit | dab97567a755bc642b1875dacc94747ce6cd9222 (patch) | |
tree | 5d36c7a948dfab9581b155ce157c142b58297a95 /ash/touch/touch_hud_projection.cc | |
parent | d8dd133b137d8fb63fe261546f04b2a3affe9b7a (diff) | |
download | chromium_src-dab97567a755bc642b1875dacc94747ce6cd9222.zip chromium_src-dab97567a755bc642b1875dacc94747ce6cd9222.tar.gz chromium_src-dab97567a755bc642b1875dacc94747ce6cd9222.tar.bz2 |
ash: Use skia::RefPtr instead of manually calling unref().
According to
https://chromium.googlesource.com/chromium/src/+/master/skia/ext/refptr.h#40,
we should never call unref() on the underlying ref-counted pointer.
By using AdoptRef(), skia::RefPtr will take care of that for us
automatically.
BUG=None
R=sky@chromium.org
Review URL: https://codereview.chromium.org/812333003
Cr-Commit-Position: refs/heads/master@{#310443}
Diffstat (limited to 'ash/touch/touch_hud_projection.cc')
-rw-r--r-- | ash/touch/touch_hud_projection.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ash/touch/touch_hud_projection.cc b/ash/touch/touch_hud_projection.cc index 94bffce..30312af 100644 --- a/ash/touch/touch_hud_projection.cc +++ b/ash/touch/touch_hud_projection.cc @@ -6,6 +6,7 @@ #include "ash/root_window_controller.h" #include "ash/shell.h" +#include "skia/ext/refptr.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "ui/events/event.h" #include "ui/gfx/animation/animation_delegate.h" @@ -84,15 +85,14 @@ class TouchPointView : public views::View, alpha = static_cast<int>(fadeout_->CurrentValueBetween(alpha, 0)); fill_paint_.setAlpha(alpha); stroke_paint_.setAlpha(alpha); - SkShader* shader = SkGradientShader::CreateRadial( - gradient_center_, - SkIntToScalar(kPointRadius), - gradient_colors_, - gradient_pos_, - arraysize(gradient_colors_), - SkShader::kMirror_TileMode); - fill_paint_.setShader(shader); - shader->unref(); + skia::RefPtr<SkShader> shader = skia::AdoptRef( + SkGradientShader::CreateRadial(gradient_center_, + SkIntToScalar(kPointRadius), + gradient_colors_, + gradient_pos_, + arraysize(gradient_colors_), + SkShader::kMirror_TileMode)); + fill_paint_.setShader(shader.get()); canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), fill_paint_); canvas->DrawCircle(circle_center_, SkIntToScalar(kPointRadius), |