| OLD | NEW |
| 1 /* | 1 /* |
| 2 * CAUTION: EXPERIMENTAL CODE | 2 * CAUTION: EXPERIMENTAL CODE |
| 3 * | 3 * |
| 4 * This code is not to be used and will not be supported | 4 * This code is not to be used and will not be supported |
| 5 * if it fails on you. DO NOT USE! | 5 * if it fails on you. DO NOT USE! |
| 6 * | 6 * |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SkPathUtils.h" | 9 #include "SkPathUtils.h" |
| 10 | 10 |
| 11 #include "SkPath.h" | 11 #include "SkPath.h" |
| 12 #include "SkPathOps.h" // this can't be found, how do I link it? | 12 #include "SkPathOps.h" // this can't be found, how do I link it? |
| 13 #include "SkRegion.h" | 13 #include "SkRegion.h" |
| 14 | 14 |
| 15 typedef void (*line2path)(SkPath*, const char*, int, int); | 15 typedef void (*line2path)(SkPath*, const char*, int, int); |
| 16 #define SQRT_2 1.41421356237f | 16 #define SQRT_2 1.41421356237f |
| 17 #define ON 0xFF000000 // black pixel | 17 #define ON 0xFF000000 // black pixel |
| 18 #define OFF 0x00000000 // transparent pixel | 18 #define OFF 0x00000000 // transparent pixel |
| 19 | 19 |
| 20 // assumes stride is in bytes | 20 // assumes stride is in bytes |
| 21 /* | 21 /* |
| 22 static void FillRandomBits( int chars, char* bits ){ | 22 static void FillRandomBits( int chars, char* bits ){ |
| 23 SkTime time; | 23 SkTime time; |
| 24 SkMWCRandom rand = SkMWCRandom( time.GetMSecs() ); | 24 SkRandom rand = SkRandom( time.GetMSecs() ); |
| 25 | 25 |
| 26 for (int i = 0; i < chars; ++i){ | 26 for (int i = 0; i < chars; ++i){ |
| 27 bits[i] = rand.nextU(); | 27 bits[i] = rand.nextU(); |
| 28 } | 28 } |
| 29 }OA | 29 }OA |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 static int GetBit( const char* buffer, int x ) { | 32 static int GetBit( const char* buffer, int x ) { |
| 33 int byte = x >> 3; | 33 int byte = x >> 3; |
| 34 int bit = x & 7; | 34 int bit = x & 7; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 } else if ( GetBit(line,w-1) ) { // if last pixel on add rect | 144 } else if ( GetBit(line,w-1) ) { // if last pixel on add rect |
| 145 // add the thing here | 145 // add the thing here |
| 146 region.op(SkIRect::MakeXYWH(w-1, y, 1, 1), | 146 region.op(SkIRect::MakeXYWH(w-1, y, 1, 1), |
| 147 SkRegion::kUnion_Op ); | 147 SkRegion::kUnion_Op ); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 // convert region to path | 150 // convert region to path |
| 151 region.getBoundaryPath(path); | 151 region.getBoundaryPath(path); |
| 152 } | 152 } |
| OLD | NEW |