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

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

Issue 1966903004: Remove clip from GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@fix2_nvpr
Patch Set: Created 4 years, 7 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
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 "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 } 315 }
316 316
317 helper.toTexture(texture); 317 helper.toTexture(texture);
318 318
319 return texture; 319 return texture;
320 } 320 }
321 321
322 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture, 322 void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
323 GrDrawTarget* target, 323 GrDrawTarget* target,
324 GrPipelineBuilder* pipelineBuilder , 324 GrPipelineBuilder* pipelineBuilder ,
325 const GrClip& clip,
325 GrColor color, 326 GrColor color,
326 const SkMatrix& viewMatrix, 327 const SkMatrix& viewMatrix,
327 const SkIRect& rect) { 328 const SkIRect& rect) {
328 SkMatrix invert; 329 SkMatrix invert;
329 if (!viewMatrix.invert(&invert)) { 330 if (!viewMatrix.invert(&invert)) {
330 return; 331 return;
331 } 332 }
332 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps(*pipelineBuilder) ; 333 GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps(*pipelineBuilder) ;
333 334
334 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft, 335 SkRect dstRect = SkRect::MakeLTRB(SK_Scalar1 * rect.fLeft,
335 SK_Scalar1 * rect.fTop, 336 SK_Scalar1 * rect.fTop,
336 SK_Scalar1 * rect.fRight, 337 SK_Scalar1 * rect.fRight,
337 SK_Scalar1 * rect.fBottom); 338 SK_Scalar1 * rect.fBottom);
338 339
339 // We use device coords to compute the texture coordinates. We take the devi ce coords and apply 340 // We use device coords to compute the texture coordinates. We take the devi ce coords and apply
340 // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling 341 // a translation so that the top-left of the device bounds maps to 0,0, and then a scaling
341 // matrix to normalized coords. 342 // matrix to normalized coords.
342 SkMatrix maskMatrix; 343 SkMatrix maskMatrix;
343 maskMatrix.setIDiv(texture->width(), texture->height()); 344 maskMatrix.setIDiv(texture->width(), texture->height());
344 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop )); 345 maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop ));
345 346
346 pipelineBuilder->addCoverageFragmentProcessor( 347 pipelineBuilder->addCoverageFragmentProcessor(
347 GrSimpleTextureEffect::Create(texture, 348 GrSimpleTextureEffect::Create(texture,
348 maskMatrix, 349 maskMatrix,
349 GrTextureParams::kNone_Fi lterMode, 350 GrTextureParams::kNone_Fi lterMode,
350 kDevice_GrCoordSet))->unr ef(); 351 kDevice_GrCoordSet))->unr ef();
351 352
352 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(), 353 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S kMatrix::I(),
353 dstRect, nullptr, &invert)); 354 dstRect, nullptr, &invert));
354 target->drawBatch(*pipelineBuilder, batch); 355 target->drawBatch(*pipelineBuilder, clip, batch);
355 } 356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698