OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkPathUtils.h" | 9 #include "SkPathUtils.h" |
10 | 10 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
13 #include "SkRandom.h" | 13 #include "SkRandom.h" |
14 #include "SkTime.h" | 14 #include "SkTime.h" |
15 #include "Test.h" | 15 #include "Test.h" |
16 | 16 |
17 class SkBitmap; | |
18 | |
19 const int kNumIt = 100; | 17 const int kNumIt = 100; |
20 | 18 |
21 static void fill_random_bits( int chars, char* bits ){ | 19 static void fill_random_bits(int chars, char* bits){ |
22 SkMWCRandom rand(SkTime::GetMSecs()); | 20 SkMWCRandom rand(SkTime::GetMSecs()); |
23 | 21 |
24 for (int i = 0; i < chars; ++i){ | 22 for (int i = 0; i < chars; ++i){ |
25 bits[i] = rand.nextU(); | 23 bits[i] = rand.nextU(); |
26 } | 24 } |
27 } | 25 } |
28 | 26 |
29 static int get_bit( const char* buffer, int x ) { | 27 static int get_bit(const char* buffer, int x) { |
30 int byte = x >> 3; | 28 int byte = x >> 3; |
31 int bit = x & 7; | 29 int bit = x & 7; |
32 | 30 |
33 return buffer[byte] & (128 >> bit); | 31 return buffer[byte] & (128 >> bit); |
34 } | 32 } |
35 | 33 |
36 /* // useful for debugging errors | 34 /* // useful for debugging errors |
37 #include <iostream> | 35 #include <iostream> |
38 static void print_bits( const char* bits, int w, int h) { | 36 static void print_bits( const char* bits, int w, int h) { |
39 | 37 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 binary_to_skbitmap(binBmp, &bmpTruth, w[i], h, rowBytes); | 150 binary_to_skbitmap(binBmp, &bmpTruth, w[i], h, rowBytes); |
153 | 151 |
154 test_path(reporter, &bmpTruth, binBmp, w[i], h, rowBytes); | 152 test_path(reporter, &bmpTruth, binBmp, w[i], h, rowBytes); |
155 test_region(reporter, &bmpTruth, binBmp, w[i], h, rowBytes); | 153 test_region(reporter, &bmpTruth, binBmp, w[i], h, rowBytes); |
156 } | 154 } |
157 } | 155 } |
158 } | 156 } |
159 | 157 |
160 #include "TestClassDef.h" | 158 #include "TestClassDef.h" |
161 DEFINE_TESTCLASS("PathUtils", PathUtils, TestPathUtils) | 159 DEFINE_TESTCLASS("PathUtils", PathUtils, TestPathUtils) |
OLD | NEW |