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

Side by Side Diff: src/gpu/GrSWMaskHelper.cpp

Issue 589103004: Add GrAASmallPathRenderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address nits Created 6 years, 2 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 | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.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 2012 Google Inc. 2 * Copyright 2012 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 "GrSWMaskHelper.h" 8 #include "GrSWMaskHelper.h"
9 9
10 #include "GrDrawState.h" 10 #include "GrDrawState.h"
11 #include "GrDrawTargetCaps.h" 11 #include "GrDrawTargetCaps.h"
12 #include "GrGpu.h" 12 #include "GrGpu.h"
13 13
14 #include "SkData.h" 14 #include "SkData.h"
15 #include "SkDistanceFieldGen.h"
15 #include "SkStrokeRec.h" 16 #include "SkStrokeRec.h"
16 17
17 // TODO: try to remove this #include 18 // TODO: try to remove this #include
18 #include "GrContext.h" 19 #include "GrContext.h"
19 20
20 namespace { 21 namespace {
21 22
22 /* 23 /*
23 * Convert a boolean operation into a transfer mode code 24 * Convert a boolean operation into a transfer mode code
24 */ 25 */
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 this->compressTextureData(texture, desc); 300 this->compressTextureData(texture, desc);
300 break; 301 break;
301 302
302 case kBlitter_CompressionMode: 303 case kBlitter_CompressionMode:
303 SkASSERT(fCompressedBuffer.get()); 304 SkASSERT(fCompressedBuffer.get());
304 this->sendTextureData(texture, desc, fCompressedBuffer.get(), 0); 305 this->sendTextureData(texture, desc, fCompressedBuffer.get(), 0);
305 break; 306 break;
306 } 307 }
307 } 308 }
308 309
310 /**
311 * Convert mask generation results to a signed distance field
312 */
313 void GrSWMaskHelper::toSDF(unsigned char* sdf) {
314 SkAutoLockPixels alp(fBM);
315
316 SkGenerateDistanceFieldFromA8Image(sdf, (const unsigned char*)fBM.getPixels( ),
317 fBM.width(), fBM.height(), fBM.rowBytes() );
318 }
319
309 //////////////////////////////////////////////////////////////////////////////// 320 ////////////////////////////////////////////////////////////////////////////////
310 /** 321 /**
311 * Software rasterizes path to A8 mask (possibly using the context's matrix) 322 * Software rasterizes path to A8 mask (possibly using the context's matrix)
312 * and uploads the result to a scratch texture. Returns the resulting 323 * and uploads the result to a scratch texture. Returns the resulting
313 * texture on success; NULL on failure. 324 * texture on success; NULL on failure.
314 */ 325 */
315 GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context, 326 GrTexture* GrSWMaskHelper::DrawPathMaskToTexture(GrContext* context,
316 const SkPath& path, 327 const SkPath& path,
317 const SkStrokeRec& stroke, 328 const SkStrokeRec& stroke,
318 const SkIRect& resultBounds, 329 const SkIRect& resultBounds,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 maskMatrix.preConcat(drawState->getViewMatrix()); 373 maskMatrix.preConcat(drawState->getViewMatrix());
363 374
364 drawState->addCoverageProcessor( 375 drawState->addCoverageProcessor(
365 GrSimpleTextureEffect::Create(texture, 376 GrSimpleTextureEffect::Create(texture,
366 maskMatrix, 377 maskMatrix,
367 GrTextureParams::kNone_Fi lterMode, 378 GrTextureParams::kNone_Fi lterMode,
368 kPosition_GrCoordSet))->u nref(); 379 kPosition_GrCoordSet))->u nref();
369 380
370 target->drawSimpleRect(dstRect); 381 target->drawSimpleRect(dstRect);
371 } 382 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698