| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 std::vector<float> scales; | 49 std::vector<float> scales; |
| 50 scales.push_back(1.0f); | 50 scales.push_back(1.0f); |
| 51 scales.push_back(2.0f); | 51 scales.push_back(2.0f); |
| 52 return scales; | 52 return scales; |
| 53 } | 53 } |
| 54 | 54 |
| 55 const SkBitmap CreateBitmap(int width, int height) { | 55 const SkBitmap CreateBitmap(int width, int height) { |
| 56 SkBitmap bitmap; | 56 SkBitmap bitmap; |
| 57 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 57 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
| 58 bitmap.allocPixels(); | 58 bitmap.allocPixels(); |
| 59 bitmap.eraseRGB(0, 255, 0); | 59 bitmap.eraseARGB(255, 0, 255, 0); |
| 60 return bitmap; | 60 return bitmap; |
| 61 } | 61 } |
| 62 | 62 |
| 63 gfx::ImageSkia CreateImageSkia(int width, int height) { | 63 gfx::ImageSkia CreateImageSkia(int width, int height) { |
| 64 return gfx::ImageSkia::CreateFrom1xBitmap(CreateBitmap(width, height)); | 64 return gfx::ImageSkia::CreateFrom1xBitmap(CreateBitmap(width, height)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 scoped_refptr<base::RefCountedMemory> CreatePNGBytes(int edge_size) { | 67 scoped_refptr<base::RefCountedMemory> CreatePNGBytes(int edge_size) { |
| 68 SkBitmap bitmap = CreateBitmap(edge_size, edge_size); | 68 SkBitmap bitmap = CreateBitmap(edge_size, edge_size); |
| 69 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes()); | 69 scoped_refptr<base::RefCountedBytes> bytes(new base::RefCountedBytes()); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { | 253 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { |
| 254 #if defined(OS_MACOSX) | 254 #if defined(OS_MACOSX) |
| 255 return image1 == image2; | 255 return image1 == image2; |
| 256 #else | 256 #else |
| 257 return image1.BackedBySameObjectAs(image2); | 257 return image1.BackedBySameObjectAs(image2); |
| 258 #endif | 258 #endif |
| 259 } | 259 } |
| 260 | 260 |
| 261 } // namespace test | 261 } // namespace test |
| 262 } // namespace gfx | 262 } // namespace gfx |
| OLD | NEW |