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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 return bmp.isNull() || | 179 return bmp.isNull() || |
180 (bmp.width() == 0 && bmp.height() == 0); | 180 (bmp.width() == 0 && bmp.height() == 0); |
181 } | 181 } |
182 | 182 |
183 PlatformImage CreatePlatformImage() { | 183 PlatformImage CreatePlatformImage() { |
184 const SkBitmap bitmap(CreateBitmap(25, 25)); | 184 const SkBitmap bitmap(CreateBitmap(25, 25)); |
185 #if defined(OS_IOS) | 185 #if defined(OS_IOS) |
186 ui::ScaleFactor scale_factor = ui::GetMaxScaleFactor(); | 186 ui::ScaleFactor scale_factor = ui::GetMaxScaleFactor(); |
187 float scale = ui::GetScaleFactorScale(scale_factor); | 187 float scale = ui::GetScaleFactorScale(scale_factor); |
188 | 188 |
189 base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( | 189 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
190 CGColorSpaceCreateDeviceRGB()); | 190 CGColorSpaceCreateDeviceRGB()); |
191 UIImage* image = | 191 UIImage* image = |
192 gfx::SkBitmapToUIImageWithColorSpace(bitmap, scale, color_space); | 192 gfx::SkBitmapToUIImageWithColorSpace(bitmap, scale, color_space); |
193 base::mac::NSObjectRetain(image); | 193 base::mac::NSObjectRetain(image); |
194 return image; | 194 return image; |
195 #elif defined(OS_MACOSX) | 195 #elif defined(OS_MACOSX) |
196 NSImage* image = gfx::SkBitmapToNSImage(bitmap); | 196 NSImage* image = gfx::SkBitmapToNSImage(bitmap); |
197 base::mac::NSObjectRetain(image); | 197 base::mac::NSObjectRetain(image); |
198 return image; | 198 return image; |
199 #elif defined(TOOLKIT_GTK) | 199 #elif defined(TOOLKIT_GTK) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { | 278 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { |
279 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK) | 279 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK) |
280 return image1 == image2; | 280 return image1 == image2; |
281 #else | 281 #else |
282 return image1.BackedBySameObjectAs(image2); | 282 return image1.BackedBySameObjectAs(image2); |
283 #endif | 283 #endif |
284 } | 284 } |
285 | 285 |
286 } // namespace test | 286 } // namespace test |
287 } // namespace gfx | 287 } // namespace gfx |
OLD | NEW |