| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/gfx/image/image_unittest_util.h" | 8 #include "ui/gfx/image/image_unittest_util.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 | 209 |
| 210 PlatformImage CreatePlatformImage() { | 210 PlatformImage CreatePlatformImage() { |
| 211 const SkBitmap bitmap(CreateBitmap(25, 25)); | 211 const SkBitmap bitmap(CreateBitmap(25, 25)); |
| 212 #if defined(OS_IOS) | 212 #if defined(OS_IOS) |
| 213 float scale = ImageSkia::GetMaxSupportedScale(); | 213 float scale = ImageSkia::GetMaxSupportedScale(); |
| 214 | 214 |
| 215 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( | 215 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
| 216 CGColorSpaceCreateDeviceRGB()); | 216 CGColorSpaceCreateDeviceRGB()); |
| 217 UIImage* image = | 217 UIImage* image = |
| 218 gfx::SkBitmapToUIImageWithColorSpace(bitmap, scale, color_space); | 218 skia::SkBitmapToUIImageWithColorSpace(bitmap, scale, color_space); |
| 219 base::mac::NSObjectRetain(image); | 219 base::mac::NSObjectRetain(image); |
| 220 return image; | 220 return image; |
| 221 #elif defined(OS_MACOSX) | 221 #elif defined(OS_MACOSX) |
| 222 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( | 222 NSImage* image = skia::SkBitmapToNSImageWithColorSpace( |
| 223 bitmap, base::mac::GetGenericRGBColorSpace()); | 223 bitmap, base::mac::GetGenericRGBColorSpace()); |
| 224 base::mac::NSObjectRetain(image); | 224 base::mac::NSObjectRetain(image); |
| 225 return image; | 225 return image; |
| 226 #else | 226 #else |
| 227 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 227 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 228 #endif | 228 #endif |
| 229 } | 229 } |
| 230 | 230 |
| 231 gfx::Image::RepresentationType GetPlatformRepresentationType() { | 231 gfx::Image::RepresentationType GetPlatformRepresentationType() { |
| 232 #if defined(OS_IOS) | 232 #if defined(OS_IOS) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { | 287 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { |
| 288 #if defined(OS_MACOSX) | 288 #if defined(OS_MACOSX) |
| 289 return image1 == image2; | 289 return image1 == image2; |
| 290 #else | 290 #else |
| 291 return image1.BackedBySameObjectAs(image2); | 291 return image1.BackedBySameObjectAs(image2); |
| 292 #endif | 292 #endif |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace test | 295 } // namespace test |
| 296 } // namespace gfx | 296 } // namespace gfx |
| OLD | NEW |