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

Side by Side Diff: src/core/SkRegion.cpp

Issue 1315123002: stray malloc/free -> sk_malloc/sk_free (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: realloc too Created 5 years, 3 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
« no previous file with comments | « no previous file | src/gpu/GrAALinearizingConvexPathRenderer.cpp » ('j') | 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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAALinearizingConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698