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

Unified Diff: ui/native_theme/native_theme_win.cc

Issue 11418217: Add skia::RefPtr class to wrap ref counted classes from Skia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop TNoRef Created 8 years, 1 month 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
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..3b7e2fa4ab69dc45bc4b2191645063c07bde1484 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -81,16 +81,15 @@ 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 = 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));
+ skia::RefPtr<SkShader>(paint->setShader(shader.get()));
}
// <-a->
@@ -509,11 +508,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::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

Powered by Google App Engine
This is Rietveld 408576698