OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "base/gfx/image_operations.h" | 7 #include "skia/ext/image_operations.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 // Computes the average pixel value for the given range, inclusive. | 13 // Computes the average pixel value for the given range, inclusive. |
14 uint32_t AveragePixel(const SkBitmap& bmp, | 14 uint32_t AveragePixel(const SkBitmap& bmp, |
15 int x_min, int x_max, | 15 int x_min, int x_max, |
16 int y_min, int y_max) { | 16 int y_min, int y_max) { |
17 float accum[4] = {0, 0, 0, 0}; | 17 float accum[4] = {0, 0, 0, 0}; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 SkAutoLockPixels src_lock(src); | 140 SkAutoLockPixels src_lock(src); |
141 SkAutoLockPixels results_lock(results); | 141 SkAutoLockPixels results_lock(results); |
142 for (int y = 0; y < src_h; y++) { | 142 for (int y = 0; y < src_h; y++) { |
143 for (int x = 0; x < src_w; x++) { | 143 for (int x = 0; x < src_w; x++) { |
144 EXPECT_EQ(*src.getAddr32(x, y), *results.getAddr32(x, y)); | 144 EXPECT_EQ(*src.getAddr32(x, y), *results.getAddr32(x, y)); |
145 } | 145 } |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
OLD | NEW |