OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 drawState->setDrawFace(drawFace[p]); | 468 drawState->setDrawFace(drawFace[p]); |
469 if (passes[p]) { | 469 if (passes[p]) { |
470 *drawState->stencil() = *passes[p]; | 470 *drawState->stencil() = *passes[p]; |
471 } | 471 } |
472 | 472 |
473 if (lastPassIsBounds && (p == passCount-1)) { | 473 if (lastPassIsBounds && (p == passCount-1)) { |
474 // Reset the XP Factory on drawState | 474 // Reset the XP Factory on drawState |
475 drawState->setXPFactory(backupXPFactory); | 475 drawState->setXPFactory(backupXPFactory); |
476 SkRect bounds; | 476 SkRect bounds; |
477 GrDrawState::AutoViewMatrixRestore avmr; | 477 GrDrawState::AutoViewMatrixRestore avmr; |
| 478 const SkMatrix& viewMatrix = drawState->getViewMatrix(); |
| 479 SkMatrix localMatrix = SkMatrix::I(); |
478 if (reverse) { | 480 if (reverse) { |
479 SkASSERT(drawState->getRenderTarget()); | 481 SkASSERT(drawState->getRenderTarget()); |
480 // draw over the dev bounds (which will be the whole dst surface
for inv fill). | 482 // draw over the dev bounds (which will be the whole dst surface
for inv fill). |
481 bounds = devBounds; | 483 bounds = devBounds; |
482 SkMatrix vmi; | 484 SkMatrix vmi; |
483 // mapRect through persp matrix may not be correct | 485 // mapRect through persp matrix may not be correct |
484 if (!drawState->getViewMatrix().hasPerspective() && | 486 if (!drawState->getViewMatrix().hasPerspective() && |
485 drawState->getViewInverse(&vmi)) { | 487 drawState->getViewInverse(&vmi)) { |
486 vmi.mapRect(&bounds); | 488 vmi.mapRect(&bounds); |
487 } else { | 489 } else { |
| 490 if (!viewMatrix.invert(&localMatrix)) { |
| 491 return false; |
| 492 } |
488 avmr.setIdentity(drawState); | 493 avmr.setIdentity(drawState); |
489 } | 494 } |
490 } else { | 495 } else { |
491 bounds = path.getBounds(); | 496 bounds = path.getBounds(); |
492 } | 497 } |
493 GrDrawTarget::AutoGeometryPush agp(target); | 498 GrDrawTarget::AutoGeometryPush agp(target); |
494 target->drawSimpleRect(drawState, color, bounds); | 499 target->drawRect(drawState, color, bounds, NULL, &localMatrix); |
495 } else { | 500 } else { |
496 if (passCount > 1) { | 501 if (passCount > 1) { |
497 drawState->setDisableColorXPFactory(); | 502 drawState->setDisableColorXPFactory(); |
498 } | 503 } |
499 GrDrawState::AutoRestoreEffects are(drawState); | 504 GrDrawState::AutoRestoreEffects are(drawState); |
500 SkAutoTUnref<const GrGeometryProcessor> gp( | 505 SkAutoTUnref<const GrGeometryProcessor> gp( |
501 GrDefaultGeoProcFactory::Create(color, | 506 GrDefaultGeoProcFactory::Create(color, |
502 GrDefaultGeoProcFactory::kPo
sition_GPType, | 507 GrDefaultGeoProcFactory::kPo
sition_GPType, |
503 false, | 508 false, |
504 newCoverage)); | 509 newCoverage)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 551 } |
547 | 552 |
548 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, | 553 void GrDefaultPathRenderer::onStencilPath(GrDrawTarget* target, |
549 GrDrawState* drawState, | 554 GrDrawState* drawState, |
550 const SkPath& path, | 555 const SkPath& path, |
551 const SkStrokeRec& stroke) { | 556 const SkStrokeRec& stroke) { |
552 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); | 557 SkASSERT(SkPath::kInverseEvenOdd_FillType != path.getFillType()); |
553 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); | 558 SkASSERT(SkPath::kInverseWinding_FillType != path.getFillType()); |
554 this->internalDrawPath(target, drawState, GrColor_WHITE, path, stroke, true)
; | 559 this->internalDrawPath(target, drawState, GrColor_WHITE, path, stroke, true)
; |
555 } | 560 } |
OLD | NEW |