diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 01:00:54 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-05 01:00:54 +0000 |
commit | 3699ae5a17c4b0b68842a673550d86cdc7961728 (patch) | |
tree | cf60fc865bcbdf60e47ca37b43fa7cfd5898f01f /ui/native_theme | |
parent | f775d10814adf1320c8bf9de8279d473c254dd9e (diff) | |
download | chromium_src-3699ae5a17c4b0b68842a673550d86cdc7961728.zip chromium_src-3699ae5a17c4b0b68842a673550d86cdc7961728.tar.gz chromium_src-3699ae5a17c4b0b68842a673550d86cdc7961728.tar.bz2 |
ui: Use skia::RefPtr<T> for implicit safe reference counting.
R=sky
BUG=163454
Depends on: https://codereview.chromium.org/11418217/
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11299262
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/native_theme')
-rw-r--r-- | ui/native_theme/native_theme_base.cc | 16 | ||||
-rw-r--r-- | ui/native_theme/native_theme_win.cc | 16 |
2 files changed, 16 insertions, 16 deletions
diff --git a/ui/native_theme/native_theme_base.cc b/ui/native_theme/native_theme_base.cc index fa6151f..91a5172 100644 --- a/ui/native_theme/native_theme_base.cc +++ b/ui/native_theme/native_theme_base.cc @@ -576,12 +576,12 @@ SkRect NativeThemeBase::PaintCheckboxRadioNewCommon( else /* kNormal */ startEndColors = kCheckboxGradientColors; SkColor colors[3] = {startEndColors[0], startEndColors[0], startEndColors[1]}; - SkShader* shader = SkGradientShader::CreateLinear( - gradient_bounds, colors, NULL, 3, SkShader::kClamp_TileMode, NULL); + skia::RefPtr<SkShader> shader = skia::AdoptRef( + SkGradientShader::CreateLinear( + gradient_bounds, colors, NULL, 3, SkShader::kClamp_TileMode, NULL)); SkPaint paint; paint.setAntiAlias(true); - paint.setShader(shader); - shader->unref(); + paint.setShader(shader.get()); paint.setStyle(SkPaint::kFill_Style); canvas->drawRoundRect(skrect, borderRadius, borderRadius, paint); paint.setShader(NULL); @@ -725,12 +725,12 @@ void NativeThemeBase::PaintButton(SkCanvas* canvas, colors[0] = light_color; colors[1] = base_color; - SkShader* shader = SkGradientShader::CreateLinear( - gradient_bounds, colors, NULL, 2, SkShader::kClamp_TileMode, NULL); + skia::RefPtr<SkShader> shader = skia::AdoptRef( + SkGradientShader::CreateLinear( + gradient_bounds, colors, NULL, 2, SkShader::kClamp_TileMode, NULL)); paint.setStyle(SkPaint::kFill_Style); paint.setAntiAlias(true); - paint.setShader(shader); - shader->unref(); + paint.setShader(shader.get()); canvas->drawRoundRect(skrect, SkIntToScalar(1), SkIntToScalar(1), paint); paint.setShader(NULL); diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc index 27a00a5..7ede675 100644 --- a/ui/native_theme/native_theme_win.cc +++ b/ui/native_theme/native_theme_win.cc @@ -81,16 +81,16 @@ void SetCheckerboardShader(SkPaint* paint, const RECT& align_rect) { temp_bitmap.setPixels(buffer); SkBitmap bitmap; temp_bitmap.copyTo(&bitmap, temp_bitmap.config()); - SkShader* shader = SkShader::CreateBitmapShader(bitmap, - SkShader::kRepeat_TileMode, - SkShader::kRepeat_TileMode); + skia::RefPtr<SkShader> shader = skia::AdoptRef( + SkShader::CreateBitmapShader( + bitmap, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode)); // Align the pattern with the upper corner of |align_rect|. SkMatrix matrix; matrix.setTranslate(SkIntToScalar(align_rect.left), SkIntToScalar(align_rect.top)); shader->setLocalMatrix(matrix); - SkSafeUnref(paint->setShader(shader)); + paint->setShader(shader.get()); } // <-a-> @@ -509,11 +509,11 @@ void NativeThemeWin::PaintIndirect(SkCanvas* canvas, // keeping a cache of the resulting bitmaps. // Create an offscreen canvas that is backed by an HDC. - skia::BitmapPlatformDevice* device = skia::BitmapPlatformDevice::Create( - rect.width(), rect.height(), false, NULL); + skia::RefPtr<skia::BitmapPlatformDevice> device = skia::AdoptRef( + skia::BitmapPlatformDevice::Create( + rect.width(), rect.height(), false, NULL)); DCHECK(device); - SkCanvas offscreen_canvas(device); - device->unref(); + SkCanvas offscreen_canvas(device.get()); DCHECK(skia::SupportsPlatformPaint(&offscreen_canvas)); // Some of the Windows theme drawing operations do not write correct alpha |