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 "ui/gfx/color_analysis.h" | 5 #include "ui/gfx/color_analysis.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "skia/ext/platform_canvas.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
14 #include "third_party/skia/include/core/SkColor.h" | |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/color_utils.h" | 16 #include "ui/gfx/color_utils.h" |
17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
18 #include "ui/gfx/image/image.h" | 18 #include "ui/gfx/image/image.h" |
19 | 19 |
20 namespace color_utils { | 20 namespace color_utils { |
21 | 21 |
22 const unsigned char k1x1White[] = { | 22 const unsigned char k1x1White[] = { |
23 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, | 23 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, |
24 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, | 24 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); | 494 Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); |
495 | 495 |
496 EXPECT_EQ(0, min_gl); | 496 EXPECT_EQ(0, min_gl); |
497 EXPECT_EQ(255, max_gl); | 497 EXPECT_EQ(255, max_gl); |
498 EXPECT_EQ(min_gl, SkColorGetA(result.getColor(0, 0))); | 498 EXPECT_EQ(min_gl, SkColorGetA(result.getColor(0, 0))); |
499 EXPECT_EQ(max_gl, SkColorGetA(result.getColor(299, 199))); | 499 EXPECT_EQ(max_gl, SkColorGetA(result.getColor(299, 199))); |
500 EXPECT_EQ(93U, SkColorGetA(result.getColor(150, 0))); | 500 EXPECT_EQ(93U, SkColorGetA(result.getColor(150, 0))); |
501 } | 501 } |
502 | 502 |
503 } // namespace color_utils | 503 } // namespace color_utils |
OLD | NEW |