Skip to content

Commit

Permalink
ash: Use skia::RefPtr instead of manually calling unref().
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
tfarina authored and Commit bot committed Jan 8, 2015
1 parent d8dd133 commit dab9756
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions ash/touch/touch_hud_projection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit dab9756

Please sign in to comment.