Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: ui/native_theme/native_theme_win.cc

Issue 11299262: ui: Use skia::RefPtr<T> for implicit safe reference counting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: winbuild Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/native_theme/native_theme_base.cc ('k') | ui/views/controls/glow_hover_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_win.cc
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index 27a00a510c00e2a5355756b12b37a14e0d559b60..7ede675d63811f8cd27a5e654d095951dee78bfd 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
« no previous file with comments | « ui/native_theme/native_theme_base.cc ('k') | ui/views/controls/glow_hover_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698