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

Unified Diff: src/gpu/batches/GrNonAAFillRectBatch.cpp

Issue 1353683003: Move StrokeRectBatches into .cpp files (Closed) Base URL: https://skia.googlesource.com/skia.git@statics
Patch Set: tweaks Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrNonAAFillRectBatch.h ('k') | src/gpu/batches/GrNonAAStrokeRectBatch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
+
};
///////////////////////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/batches/GrNonAAFillRectBatch.h ('k') | src/gpu/batches/GrNonAAStrokeRectBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698