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

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

Issue 205343008: Distance field fixes for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix int->float conversion issues Created 6 years, 8 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/GrAtlas.h » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDistanceFieldGen.h" 8 #include "SkDistanceFieldGen.h"
9 #include "SkPoint.h" 9 #include "SkPoint.h"
10 10
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 // assumes an 8-bit image and distance field 330 // assumes an 8-bit image and distance field
331 bool SkGenerateDistanceFieldFromImage(unsigned char* distanceField, 331 bool SkGenerateDistanceFieldFromImage(unsigned char* distanceField,
332 const unsigned char* image, 332 const unsigned char* image,
333 int width, int height, 333 int width, int height,
334 int distanceMagnitude) { 334 int distanceMagnitude) {
335 SkASSERT(NULL != distanceField); 335 SkASSERT(NULL != distanceField);
336 SkASSERT(NULL != image); 336 SkASSERT(NULL != image);
337 337
338 // the final distance field will have additional texels on each side to hand le 338 // the final distance field will have additional texels on each side to hand le
339 // the maximum distance 339 // the maximum distance + 1 for bilerp
340 // we expand our temp data by one more on each side to simplify 340 // we expand our temp data by one more on each side to simplify
341 // the scanning code -- will always be treated as infinitely far away 341 // the scanning code -- will always be treated as infinitely far away
342 int pad = distanceMagnitude+1; 342 int pad = distanceMagnitude+2;
343 343
344 // set params for distance field data 344 // set params for distance field data
345 int dataWidth = width + 2*pad; 345 int dataWidth = width + 2*pad;
346 int dataHeight = height + 2*pad; 346 int dataHeight = height + 2*pad;
347 347
348 // create temp data 348 // create temp data
349 size_t dataSize = dataWidth*dataHeight*sizeof(DFData); 349 size_t dataSize = dataWidth*dataHeight*sizeof(DFData);
350 SkAutoSMalloc<1024> dfStorage(dataSize); 350 SkAutoSMalloc<1024> dfStorage(dataSize);
351 DFData* dataPtr = (DFData*) dfStorage.get(); 351 DFData* dataPtr = (DFData*) dfStorage.get();
352 sk_bzero(dataPtr, dataSize); 352 sk_bzero(dataPtr, dataSize);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 #endif 469 #endif
470 ++currData; 470 ++currData;
471 ++currEdge; 471 ++currEdge;
472 } 472 }
473 currData += 2; 473 currData += 2;
474 currEdge += 2; 474 currEdge += 2;
475 } 475 }
476 476
477 return true; 477 return true;
478 } 478 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698