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

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

Issue 956363003: Cleanup in GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 9 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/GrPipelineBuilder.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.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 "GrPipelineBuilder.h" 10 #include "GrPipelineBuilder.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, 348 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
349 GrDrawTarget* target, 349 GrDrawTarget* target,
350 GrPipelineBuilder* pipelineBuilder , 350 GrPipelineBuilder* pipelineBuilder ,
351 GrColor color, 351 GrColor color,
352 const SkMatrix& viewMatrix, 352 const SkMatrix& viewMatrix,
353 const SkIRect& rect) { 353 const SkIRect& rect) {
354 SkMatrix invert; 354 SkMatrix invert;
355 if (!viewMatrix.invert(&invert)) { 355 if (!viewMatrix.invert(&invert)) {
356 return; 356 return;
357 } 357 }
358 GrPipelineBuilder::AutoRestoreEffects are(pipelineBuilder); 358 GrPipelineBuilder::AutoRestoreFragmentProcessors arfp(pipelineBuilder);
359 359
360 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft, 360 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
361 SK_Scalar1 * rect.fTop, 361 SK_Scalar1 * rect.fTop,
362 SK_Scalar1 * rect.fRight, 362 SK_Scalar1 * rect.fRight,
363 SK_Scalar1 * rect.fBottom); 363 SK_Scalar1 * rect.fBottom);
364 364
365 // We use device coords to compute the texture coordinates. We take the devi ce coords and apply 365 // We use device coords to compute the texture coordinates. We take the devi ce coords and apply
366 // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling 366 // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling
367 // matrix to normalized coords. 367 // matrix to normalized coords.
368 SkMatrix maskMatrix; 368 SkMatrix maskMatrix;
369 maskMatrix.setIDiv(texture->width(), texture->height()); 369 maskMatrix.setIDiv(texture->width(), texture->height());
370 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop )); 370 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop ));
371 371
372 pipelineBuilder->addCoverageProcessor( 372 pipelineBuilder->addCoverageProcessor(
373 GrSimpleTextureEffect::Create(texture, 373 GrSimpleTextureEffect::Create(texture,
374 maskMatrix, 374 maskMatrix,
375 GrTextureParams::kNone_Fi lterMode, 375 GrTextureParams::kNone_Fi lterMode,
376 kDevice_GrCoordSet))->unr ef(); 376 kDevice_GrCoordSet))->unr ef();
377 377
378 target->drawRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &inve rt); 378 target->drawRect(pipelineBuilder, color, SkMatrix::I(), dstRect, NULL, &inve rt);
379 } 379 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698