| Index: src/gpu/batches/GrNonAAFillRectBatch.cpp
|
| diff --git a/src/gpu/batches/GrNonAAFillRectBatch.cpp b/src/gpu/batches/GrNonAAFillRectBatch.cpp
|
| index 6eabba68728b42990fed73f79e355ec0c82b7a50..54edb7d7c925ed7eb58591e634862b5f3a36e796 100644
|
| --- a/src/gpu/batches/GrNonAAFillRectBatch.cpp
|
| +++ b/src/gpu/batches/GrNonAAFillRectBatch.cpp
|
| @@ -188,54 +188,59 @@ typedef GrTInstanceBatch<NonAAFillRectBatchImp> NonAAFillRectBatchSimple;
|
| typedef GrTInstanceBatch<NonAAFillRectBatchPerspectiveImp> NonAAFillRectBatchPerspective;
|
|
|
| namespace GrNonAAFillRectBatch {
|
| +
|
| GrDrawBatch* Create(GrColor color,
|
| const SkMatrix& viewMatrix,
|
| const SkRect& rect,
|
| const SkRect* localRect,
|
| const SkMatrix* localMatrix) {
|
| -
|
| - /* Perspective has to be handled in a slow path for now */
|
| - if (viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective())) {
|
| - NonAAFillRectBatchPerspective* batch = NonAAFillRectBatchPerspective::Create();
|
| - NonAAFillRectBatchPerspective::Geometry& geo = *batch->geometry();
|
| -
|
| - geo.fColor = color;
|
| - geo.fViewMatrix = viewMatrix;
|
| - geo.fRect = rect;
|
| - geo.fHasLocalRect = SkToBool(localRect);
|
| - geo.fHasLocalMatrix = SkToBool(localMatrix);
|
| - if (localMatrix) {
|
| - geo.fLocalMatrix = *localMatrix;
|
| - }
|
| - if (localRect) {
|
| - geo.fLocalRect = *localRect;
|
| - }
|
| -
|
| - batch->init();
|
| - return batch;
|
| + SkASSERT(!viewMatrix.hasPerspective() && (!localMatrix || !localMatrix->hasPerspective()));
|
| + NonAAFillRectBatchSimple* batch = NonAAFillRectBatchSimple::Create();
|
| + NonAAFillRectBatchSimple::Geometry& geo = *batch->geometry();
|
| +
|
| + geo.fColor = color;
|
| + geo.fViewMatrix = viewMatrix;
|
| + geo.fRect = rect;
|
| +
|
| + if (localRect && localMatrix) {
|
| + geo.fLocalQuad.setFromMappedRect(*localRect, *localMatrix);
|
| + } else if (localRect) {
|
| + geo.fLocalQuad.set(*localRect);
|
| + } else if (localMatrix) {
|
| + geo.fLocalQuad.setFromMappedRect(rect, *localMatrix);
|
| } else {
|
| - // TODO bubble these up as separate calls
|
| - NonAAFillRectBatchSimple* batch = NonAAFillRectBatchSimple::Create();
|
| - NonAAFillRectBatchSimple::Geometry& geo = *batch->geometry();
|
| -
|
| - geo.fColor = color;
|
| - geo.fViewMatrix = viewMatrix;
|
| - geo.fRect = rect;
|
| -
|
| - if (localRect && localMatrix) {
|
| - geo.fLocalQuad.setFromMappedRect(*localRect, *localMatrix);
|
| - } else if (localRect) {
|
| - geo.fLocalQuad.set(*localRect);
|
| - } else if (localMatrix) {
|
| - geo.fLocalQuad.setFromMappedRect(rect, *localMatrix);
|
| - } else {
|
| - geo.fLocalQuad.set(rect);
|
| - }
|
| + geo.fLocalQuad.set(rect);
|
| + }
|
| +
|
| + batch->init();
|
| + return batch;
|
| +}
|
|
|
| - batch->init();
|
| - return batch;
|
| +GrDrawBatch* CreateWithPerspective(GrColor color,
|
| + const SkMatrix& viewMatrix,
|
| + const SkRect& rect,
|
| + const SkRect* localRect,
|
| + const SkMatrix* localMatrix) {
|
| + SkASSERT(viewMatrix.hasPerspective() || (localMatrix && localMatrix->hasPerspective()));
|
| + NonAAFillRectBatchPerspective* batch = NonAAFillRectBatchPerspective::Create();
|
| + NonAAFillRectBatchPerspective::Geometry& geo = *batch->geometry();
|
| +
|
| + geo.fColor = color;
|
| + geo.fViewMatrix = viewMatrix;
|
| + geo.fRect = rect;
|
| + geo.fHasLocalRect = SkToBool(localRect);
|
| + geo.fHasLocalMatrix = SkToBool(localMatrix);
|
| + if (localMatrix) {
|
| + geo.fLocalMatrix = *localMatrix;
|
| }
|
| + if (localRect) {
|
| + geo.fLocalRect = *localRect;
|
| + }
|
| +
|
| + batch->init();
|
| + return batch;
|
| }
|
| +
|
| };
|
|
|
| ///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|