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

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

Issue 783763002: Initial CL to move color / coverage off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@no-static-gp
Patch Set: bug fix Created 6 years 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/GrSoftwarePathRenderer.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"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 helper.toTexture(texture); 343 helper.toTexture(texture);
344 344
345 return texture; 345 return texture;
346 } 346 }
347 347
348 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, 348 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
349 GrDrawTarget* target, 349 GrDrawTarget* target,
350 GrDrawState* drawState, 350 GrDrawState* drawState,
351 GrColor color,
351 const SkIRect& rect) { 352 const SkIRect& rect) {
352 GrDrawState::AutoViewMatrixRestore avmr; 353 GrDrawState::AutoViewMatrixRestore avmr;
353 if (!avmr.setIdentity(drawState)) { 354 if (!avmr.setIdentity(drawState)) {
354 return; 355 return;
355 } 356 }
356 GrDrawState::AutoRestoreEffects are(drawState); 357 GrDrawState::AutoRestoreEffects are(drawState);
357 358
358 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft, 359 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
359 SK_Scalar1 * rect.fTop, 360 SK_Scalar1 * rect.fTop,
360 SK_Scalar1 * rect.fRight, 361 SK_Scalar1 * rect.fRight,
361 SK_Scalar1 * rect.fBottom); 362 SK_Scalar1 * rect.fBottom);
362 363
363 // We want to use device coords to compute the texture coordinates. We set o ur matrix to be 364 // We want to use device coords to compute the texture coordinates. We set o ur matrix to be
364 // equal to the view matrix followed by a translation so that the top-left o f the device bounds 365 // equal to the view matrix followed by a translation so that the top-left o f the device bounds
365 // maps to 0,0, and then a scaling matrix to normalized coords. We apply thi s matrix to the 366 // maps to 0,0, and then a scaling matrix to normalized coords. We apply thi s matrix to the
366 // vertex positions rather than local coords. 367 // vertex positions rather than local coords.
367 SkMatrix maskMatrix; 368 SkMatrix maskMatrix;
368 maskMatrix.setIDiv(texture->width(), texture->height()); 369 maskMatrix.setIDiv(texture->width(), texture->height());
369 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop )); 370 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop ));
370 maskMatrix.preConcat(drawState->getViewMatrix()); 371 maskMatrix.preConcat(drawState->getViewMatrix());
371 372
372 drawState->addCoverageProcessor( 373 drawState->addCoverageProcessor(
373 GrSimpleTextureEffect::Create(texture, 374 GrSimpleTextureEffect::Create(texture,
374 maskMatrix, 375 maskMatrix,
375 GrTextureParams::kNone_Fi lterMode, 376 GrTextureParams::kNone_Fi lterMode,
376 kPosition_GrCoordSet))->u nref(); 377 kPosition_GrCoordSet))->u nref();
377 378
378 target->drawSimpleRect(drawState, dstRect); 379 target->drawSimpleRect(drawState, color, dstRect);
379 } 380 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.h ('k') | src/gpu/GrSoftwarePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698