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

Unified Diff: ui/gfx/skbitmap_operations.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/gfx/skbitmap_operations.cc
diff --git a/ui/gfx/skbitmap_operations.cc b/ui/gfx/skbitmap_operations.cc
index 7e2750604bcccb4e82cef9364ae1f6ef90e6eec0..3d113292adcebf0e46a2f4fa4f0ef2ad03c004e3 100644
--- a/ui/gfx/skbitmap_operations.cc
+++ b/ui/gfx/skbitmap_operations.cc
@@ -8,6 +8,7 @@
#include <string.h>
#include "base/logging.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorFilter.h"
@@ -759,10 +760,10 @@ SkBitmap SkBitmapOperations::CreateColorMask(const SkBitmap& bitmap,
SkCanvas canvas(color_mask);
- SkColorFilter* color_filter = SkColorFilter::CreateModeFilter(
+ skia::RefPtr<SkColorFilter> color_filter = SkColorFilter::CreateModeFilter(
c, SkXfermode::kSrcIn_Mode);
SkPaint paint;
- paint.setColorFilter(color_filter)->unref();
+ paint.setColorFilter(color_filter.get());
canvas.drawBitmap(bitmap, SkIntToScalar(0), SkIntToScalar(0), &paint);
return color_mask;
}
@@ -795,9 +796,10 @@ SkBitmap SkBitmapOperations::CreateDropShadow(
SkBitmap shadow_image = SkBitmapOperations::CreateColorMask(bitmap,
shadow.color());
- paint.setImageFilter(
+ skia::RefPtr<SkBlurImageFilter> filter =
new SkBlurImageFilter(SkDoubleToScalar(shadow.blur()),
- SkDoubleToScalar(shadow.blur())))->unref();
+ SkDoubleToScalar(shadow.blur()));
+ paint.setImageFilter(filter.get());
canvas.saveLayer(0, &paint);
canvas.drawBitmap(shadow_image,
« skia/ext/refptr_unittest.cc ('K') | « ui/gfx/render_text.cc ('k') | ui/gfx/skia_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698