| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 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 | 9 |
| 10 #include "SkAtomics.h" | 10 #include "SkAtomics.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 #include <stdio.h> | 186 #include <stdio.h> |
| 187 char* SkRegion::toString() { | 187 char* SkRegion::toString() { |
| 188 Iterator iter(*this); | 188 Iterator iter(*this); |
| 189 int count = 0; | 189 int count = 0; |
| 190 while (!iter.done()) { | 190 while (!iter.done()) { |
| 191 count++; | 191 count++; |
| 192 iter.next(); | 192 iter.next(); |
| 193 } | 193 } |
| 194 // 4 ints, up to 10 digits each plus sign, 3 commas, '(', ')', SkRegion() an
d '\0' | 194 // 4 ints, up to 10 digits each plus sign, 3 commas, '(', ')', SkRegion() an
d '\0' |
| 195 const int max = (count*((11*4)+5))+11+1; | 195 const int max = (count*((11*4)+5))+11+1; |
| 196 char* result = (char*)malloc(max); | 196 char* result = (char*)sk_malloc_throw(max); |
| 197 if (result == NULL) { | 197 if (result == NULL) { |
| 198 return NULL; | 198 return NULL; |
| 199 } | 199 } |
| 200 count = sprintf(result, "SkRegion("); | 200 count = sprintf(result, "SkRegion("); |
| 201 iter.reset(*this); | 201 iter.reset(*this); |
| 202 while (!iter.done()) { | 202 while (!iter.done()) { |
| 203 const SkIRect& r = iter.rect(); | 203 const SkIRect& r = iter.rect(); |
| 204 count += sprintf(result+count, "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRigh
t, r.fBottom); | 204 count += sprintf(result+count, "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRigh
t, r.fBottom); |
| 205 iter.next(); | 205 iter.next(); |
| 206 } | 206 } |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 bool SkRegion::debugSetRuns(const RunType runs[], int count) { | 1470 bool SkRegion::debugSetRuns(const RunType runs[], int count) { |
| 1471 // we need to make a copy, since the real method may modify the array, and | 1471 // we need to make a copy, since the real method may modify the array, and |
| 1472 // so it cannot be const. | 1472 // so it cannot be const. |
| 1473 | 1473 |
| 1474 SkAutoTArray<RunType> storage(count); | 1474 SkAutoTArray<RunType> storage(count); |
| 1475 memcpy(storage.get(), runs, count * sizeof(RunType)); | 1475 memcpy(storage.get(), runs, count * sizeof(RunType)); |
| 1476 return this->setRuns(storage.get(), count); | 1476 return this->setRuns(storage.get(), count); |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 #endif | 1479 #endif |
| OLD | NEW |