 Chromium Code Reviews
 Chromium Code Reviews Issue 6849030:
  Add support for multi resolution icons   (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 6849030:
  Add support for multi resolution icons   (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| OLD | NEW | 
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 // Because the unit tests for gfx::Image are spread across multiple | 5 // Because the unit tests for gfx::Image are spread across multiple | 
| 6 // implementation files, this header contains the reusable components. | 6 // implementation files, this header contains the reusable components. | 
| 7 | 7 | 
| 8 #ifndef UI_GFX_IMAGE_UNITTEST_H_ | 8 #ifndef UI_GFX_IMAGE_UNITTEST_H_ | 
| 9 #define UI_GFX_IMAGE_UNITTEST_H_ | 9 #define UI_GFX_IMAGE_UNITTEST_H_ | 
| 10 | 10 | 
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 namespace test { | 23 namespace test { | 
| 24 | 24 | 
| 25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) | 
| 26 typedef NSImage* PlatformImage; | 26 typedef NSImage* PlatformImage; | 
| 27 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 27 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 
| 28 typedef GdkPixbuf* PlatformImage; | 28 typedef GdkPixbuf* PlatformImage; | 
| 29 #else | 29 #else | 
| 30 typedef const SkBitmap* PlatformImage; | 30 typedef const SkBitmap* PlatformImage; | 
| 31 #endif | 31 #endif | 
| 32 | 32 | 
| 33 SkBitmap* CreateBitmap() { | 33 inline SkBitmap* CreateBitmap(int width, int height) { | 
| 
Robert Sesek
2011/04/19 02:41:41
just curious: why inline?
 
sail
2011/04/19 04:56:59
This function is being included by image_unittest.
 | |
| 34 SkBitmap* bitmap = new SkBitmap(); | 34 SkBitmap* bitmap = new SkBitmap(); | 
| 35 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 25, 25); | 35 bitmap->setConfig(SkBitmap::kARGB_8888_Config, width, height); | 
| 36 bitmap->allocPixels(); | 36 bitmap->allocPixels(); | 
| 37 bitmap->eraseRGB(255, 0, 0); | 37 bitmap->eraseRGB(255, 0, 0); | 
| 38 return bitmap; | 38 return bitmap; | 
| 39 } | 39 } | 
| 40 | 40 | 
| 41 PlatformImage CreatePlatformImage() { | 41 inline PlatformImage CreatePlatformImage() { | 
| 42 scoped_ptr<SkBitmap> bitmap(CreateBitmap()); | 42 scoped_ptr<SkBitmap> bitmap(CreateBitmap(25, 25)); | 
| 43 #if defined(OS_MACOSX) | 43 #if defined(OS_MACOSX) | 
| 44 NSImage* image = gfx::SkBitmapToNSImage(*(bitmap.get())); | 44 NSImage* image = gfx::SkBitmapToNSImage(*(bitmap.get())); | 
| 45 base::mac::NSObjectRetain(image); | 45 base::mac::NSObjectRetain(image); | 
| 46 return image; | 46 return image; | 
| 47 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 47 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 
| 48 return gfx::GdkPixbufFromSkBitmap(bitmap.get()); | 48 return gfx::GdkPixbufFromSkBitmap(bitmap.get()); | 
| 49 #else | 49 #else | 
| 50 return bitmap.release(); | 50 return bitmap.release(); | 
| 51 #endif | 51 #endif | 
| 52 } | 52 } | 
| 53 | 53 | 
| 54 gfx::Image::RepresentationType GetPlatformRepresentationType() { | 54 inline gfx::Image::RepresentationType GetPlatformRepresentationType() { | 
| 55 #if defined(OS_MACOSX) | 55 #if defined(OS_MACOSX) | 
| 56 return gfx::Image::kNSImageRep; | 56 return gfx::Image::kNSImageRep; | 
| 57 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 57 #elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 
| 58 return gfx::Image::kGdkPixbufRep; | 58 return gfx::Image::kGdkPixbufRep; | 
| 59 #else | 59 #else | 
| 60 return gfx::Image::kSkBitmapRep; | 60 return gfx::Image::kSkBitmapRep; | 
| 61 #endif | 61 #endif | 
| 62 } | 62 } | 
| 63 | 63 | 
| 64 } // namespace test | 64 } // namespace test | 
| 65 } // namespace gfx | 65 } // namespace gfx | 
| 66 | 66 | 
| 67 #endif // UI_GFX_IMAGE_UNITTEST_H_ | 67 #endif // UI_GFX_IMAGE_UNITTEST_H_ | 
| OLD | NEW |