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 #include "skia/ext/skia_utils_mac.mm" | 5 #include "skia/ext/skia_utils_mac.mm" |
6 | 6 |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 bool isred, bool tfbit) { | 45 bool isred, bool tfbit) { |
46 SkBitmap bitmap; | 46 SkBitmap bitmap; |
47 | 47 |
48 if (tfbit) | 48 if (tfbit) |
49 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 49 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
50 else | 50 else |
51 bitmap.setConfig(SkBitmap::kARGB_4444_Config, width, height); | 51 bitmap.setConfig(SkBitmap::kARGB_4444_Config, width, height); |
52 bitmap.allocPixels(); | 52 bitmap.allocPixels(); |
53 | 53 |
54 if (isred) | 54 if (isred) |
55 bitmap.eraseRGB(0xff, 0, 0); | 55 bitmap.eraseARGB(0xff, 0xff, 0, 0); |
56 else | 56 else |
57 bitmap.eraseRGB(0, 0, 0xff); | 57 bitmap.eraseARGB(0xff, 0, 0, 0xff); |
58 | 58 |
59 return bitmap; | 59 return bitmap; |
60 } | 60 } |
61 | 61 |
62 NSImage* SkiaUtilsMacTest::CreateNSImage(int width, int height, bool isred) { | 62 NSImage* SkiaUtilsMacTest::CreateNSImage(int width, int height, bool isred) { |
63 base::scoped_nsobject<NSImage> image( | 63 base::scoped_nsobject<NSImage> image( |
64 [[NSImage alloc] initWithSize:NSMakeSize(width, height)]); | 64 [[NSImage alloc] initWithSize:NSMakeSize(width, height)]); |
65 [image lockFocus]; | 65 [image lockFocus]; |
66 if (isred) | 66 if (isred) |
67 [[NSColor colorWithDeviceRed:1.0 green:0.0 blue:0.0 alpha:1.0] set]; | 67 [[NSColor colorWithDeviceRed:1.0 green:0.0 blue:0.0 alpha:1.0] set]; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 TEST_F(SkiaUtilsMacTest, BitLocker_ClipNoBits) { | 238 TEST_F(SkiaUtilsMacTest, BitLocker_ClipNoBits) { |
239 RunBitLockerTest(SkiaUtilsMacTest::TestClipNoBits); | 239 RunBitLockerTest(SkiaUtilsMacTest::TestClipNoBits); |
240 } | 240 } |
241 | 241 |
242 TEST_F(SkiaUtilsMacTest, BitLocker_XClipNoBits) { | 242 TEST_F(SkiaUtilsMacTest, BitLocker_XClipNoBits) { |
243 RunBitLockerTest(SkiaUtilsMacTest::TestXClipNoBits); | 243 RunBitLockerTest(SkiaUtilsMacTest::TestXClipNoBits); |
244 } | 244 } |
245 | 245 |
246 } // namespace | 246 } // namespace |
247 | 247 |
OLD | NEW |