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

Unified Diff: ui/gfx/image/image_unittest_util.cc

Issue 10332163: Revert 137075 - Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months 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/gfx/image/image_unittest_util.h ('k') | ui/gfx/image/image_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_unittest_util.cc
===================================================================
--- ui/gfx/image/image_unittest_util.cc (revision 137075)
+++ ui/gfx/image/image_unittest_util.cc (working copy)
@@ -20,11 +20,11 @@
namespace gfx {
namespace test {
-const SkBitmap CreateBitmap(int width, int height) {
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
- bitmap.allocPixels();
- bitmap.eraseRGB(255, 0, 0);
+SkBitmap* CreateBitmap(int width, int height) {
+ SkBitmap* bitmap = new SkBitmap();
+ bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height);
+ bitmap->allocPixels();
+ bitmap->eraseRGB(255, 0, 0);
return bitmap;
}
@@ -65,15 +65,15 @@
}
PlatformImage CreatePlatformImage() {
- const SkBitmap bitmap(CreateBitmap(25, 25));
+ scoped_ptr<SkBitmap> bitmap(CreateBitmap(25, 25));
#if defined(OS_MACOSX)
- NSImage* image = gfx::SkBitmapToNSImage(bitmap);
+ NSImage* image = gfx::SkBitmapToNSImage(*(bitmap.get()));
base::mac::NSObjectRetain(image);
return image;
#elif defined(TOOLKIT_GTK)
- return gfx::GdkPixbufFromSkBitmap(&bitmap);
+ return gfx::GdkPixbufFromSkBitmap(bitmap.get());
#else
- return bitmap;
+ return bitmap.release();
#endif
}
@@ -93,25 +93,9 @@
#elif defined(TOOLKIT_GTK)
return image.ToGdkPixbuf();
#else
- return *image.ToSkBitmap();
+ return image.ToSkBitmap();
#endif
}
-bool IsPlatformImageValid(PlatformImage image) {
-#if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
- return image != NULL;
-#else
- return !image.isNull();
-#endif
-}
-
-bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) {
-#if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
- return image1 == image2;
-#else
- return image1.getPixels() == image2.getPixels();
-#endif
-}
-
} // namespace test
} // namespace gfx
« no previous file with comments | « ui/gfx/image/image_unittest_util.h ('k') | ui/gfx/image/image_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698