Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(602)

Side by Side Diff: tests/PathUtilsTest.cpp

Issue 19394004: NIT MASTER 9000 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698