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

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

Issue 14882011: Pass bounds into draw calls in path renderers. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathRenderer.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrDefaultPathRenderer.h" 9 #include "GrDefaultPathRenderer.h"
10 10
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 } 438 }
439 } 439 }
440 break; 440 break;
441 default: 441 default:
442 GrAssert(!"Unknown path fFill!"); 442 GrAssert(!"Unknown path fFill!");
443 return false; 443 return false;
444 } 444 }
445 } 445 }
446 } 446 }
447 447
448 { 448 SkRect devBounds;
449 GetPathDevBounds(path, drawState->getRenderTarget(), viewM, &devBounds);
450
449 for (int p = 0; p < passCount; ++p) { 451 for (int p = 0; p < passCount; ++p) {
450 drawState->setDrawFace(drawFace[p]); 452 drawState->setDrawFace(drawFace[p]);
451 if (NULL != passes[p]) { 453 if (NULL != passes[p]) {
452 *drawState->stencil() = *passes[p]; 454 *drawState->stencil() = *passes[p];
453 } 455 }
454 456
455 if (lastPassIsBounds && (p == passCount-1)) { 457 if (lastPassIsBounds && (p == passCount-1)) {
456 if (!colorWritesWereDisabled) { 458 if (!colorWritesWereDisabled) {
457 drawState->disableState(GrDrawState::kNoColorWrites_StateBit); 459 drawState->disableState(GrDrawState::kNoColorWrites_StateBit);
458 } 460 }
459 GrRect bounds; 461 GrRect bounds;
460 GrDrawState::AutoDeviceCoordDraw adcd; 462 GrDrawState::AutoDeviceCoordDraw adcd;
461 if (reverse) { 463 if (reverse) {
462 GrAssert(NULL != drawState->getRenderTarget()); 464 GrAssert(NULL != drawState->getRenderTarget());
463 // draw over the whole world. 465 // draw over the whole world.
robertphillips 2013/05/16 13:14:45 // GetPathDevBounds sets the bound to the device's
jvanverth1 2013/05/16 13:20:04 Change this comment?
bsalomon 2013/05/16 19:59:07 Done.
bsalomon 2013/05/16 19:59:07 Done.
464 bounds.setLTRB(0, 0, 466 bounds = devBounds;
465 SkIntToScalar(drawState->getRenderTarget()->width ()),
466 SkIntToScalar(drawState->getRenderTarget()->heigh t()));
467 SkMatrix vmi; 467 SkMatrix vmi;
468 // mapRect through persp matrix may not be correct 468 // mapRect through persp matrix may not be correct
469 if (!drawState->getViewMatrix().hasPerspective() && 469 if (!drawState->getViewMatrix().hasPerspective() &&
470 drawState->getViewInverse(&vmi)) { 470 drawState->getViewInverse(&vmi)) {
471 vmi.mapRect(&bounds); 471 vmi.mapRect(&bounds);
472 } else { 472 } else {
473 adcd.set(drawState); 473 adcd.set(drawState);
474 } 474 }
475 } else { 475 } else {
476 bounds = path.getBounds(); 476 bounds = path.getBounds();
477 } 477 }
478 GrDrawTarget::AutoGeometryAndStatePush agasp(target, GrDrawTarget::k Preserve_ASRInit); 478 GrDrawTarget::AutoGeometryAndStatePush agasp(target, GrDrawTarget::k Preserve_ASRInit);
479 target->drawSimpleRect(bounds, NULL); 479 target->drawSimpleRect(bounds, NULL);
480 } else { 480 } else {
481 if (passCount > 1) { 481 if (passCount > 1) {
482 drawState->enableState(GrDrawState::kNoColorWrites_StateBit); 482 drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
483 } 483 }
484 if (indexCnt) { 484 if (indexCnt) {
485 target->drawIndexed(primType, 0, 0, 485 target->drawIndexed(primType, 0, 0,
486 vertexCnt, indexCnt); 486 vertexCnt, indexCnt, &devBounds);
487 } else { 487 } else {
488 target->drawNonIndexed(primType, 0, vertexCnt); 488 target->drawNonIndexed(primType, 0, vertexCnt, &devBounds);
489 } 489 }
490 } 490 }
491 } 491 }
492 }
493 return true; 492 return true;
494 } 493 }
495 494
496 bool GrDefaultPathRenderer::canDrawPath(const SkPath& path, 495 bool GrDefaultPathRenderer::canDrawPath(const SkPath& path,
497 const SkStrokeRec& stroke, 496 const SkStrokeRec& stroke,
498 const GrDrawTarget* target, 497 const GrDrawTarget* target,
499 bool antiAlias) const { 498 bool antiAlias) const {
500 // this class can draw any path with any fill but doesn't do any anti-aliasi ng. 499 // this class can draw any path with any fill but doesn't do any anti-aliasi ng.
501 return (stroke.isFillStyle() || stroke.isHairlineStyle()) && !antiAlias; 500 return (stroke.isFillStyle() || stroke.isHairlineStyle()) && !antiAlias;
502 } 501 }
503 502
504 bool GrDefaultPathRenderer::onDrawPath(const SkPath& path, 503 bool GrDefaultPathRenderer::onDrawPath(const SkPath& path,
505 const SkStrokeRec& stroke, 504 const SkStrokeRec& stroke,
506 GrDrawTarget* target, 505 GrDrawTarget* target,
507 bool antiAlias) { 506 bool antiAlias) {
508 return this->internalDrawPath(path, 507 return this->internalDrawPath(path,
509 stroke, 508 stroke,
510 target, 509 target,
511 false); 510 false);
512 } 511 }
513 512
514 void GrDefaultPathRenderer::onStencilPath(const SkPath& path, 513 void GrDefaultPathRenderer::onStencilPath(const SkPath& path,
515 const SkStrokeRec& stroke, 514 const SkStrokeRec& stroke,
516 GrDrawTarget* target) { 515 GrDrawTarget* target) {
517 GrAssert(SkPath::kInverseEvenOdd_FillType != path.getFillType()); 516 GrAssert(SkPath::kInverseEvenOdd_FillType != path.getFillType());
518 GrAssert(SkPath::kInverseWinding_FillType != path.getFillType()); 517 GrAssert(SkPath::kInverseWinding_FillType != path.getFillType());
519 this->internalDrawPath(path, stroke, target, true); 518 this->internalDrawPath(path, stroke, target, true);
520 } 519 }
OLDNEW
« no previous file with comments | « src/gpu/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698