aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrRectBatchFactory.h
diff options
context:
space:
mode:
authorGravatar dvonbeck <dvonbeck@google.com>2016-08-12 12:50:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-12 12:50:36 -0700
commit09e12a6d4a75d281c47e00a64eeba893ba096f9e (patch)
treec9f8cf03b8b2194ef5163fa6be633c826b5cc021 /src/gpu/batches/GrRectBatchFactory.h
parent8a822ba4a39c9eac8710eafb7ca4f7ac888b5af8 (diff)
Re-adding analytical GeoProc for rectangles
Adapted old GeoProc because its knowledge of the geometry is helpful for computing the distance vector: https://skia.googlesource.com/skia/+/6006d0f8c4f19d19a12de20826f731f52ac822a7/src/gpu/GrAARectRenderer.cpp Added distance vector capabilities to this GeoProc. Modified GrDrawContext to used this GeoProc when drawing anti-aliased vectors with a shader that requires distance vectors. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2230513004 Review-Url: https://codereview.chromium.org/2230513004
Diffstat (limited to 'src/gpu/batches/GrRectBatchFactory.h')
-rw-r--r--src/gpu/batches/GrRectBatchFactory.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gpu/batches/GrRectBatchFactory.h b/src/gpu/batches/GrRectBatchFactory.h
index 4512f6a1f9..c9b6843596 100644
--- a/src/gpu/batches/GrRectBatchFactory.h
+++ b/src/gpu/batches/GrRectBatchFactory.h
@@ -10,9 +10,11 @@
#include "GrAAFillRectBatch.h"
#include "GrAAStrokeRectBatch.h"
+#include "GrAnalyticRectBatch.h"
#include "GrColor.h"
#include "GrNonAAFillRectBatch.h"
#include "GrNonAAStrokeRectBatch.h"
+#include "GrPaint.h"
#include "SkMatrix.h"
class GrBatch;
@@ -37,11 +39,17 @@ inline GrDrawBatch* CreateNonAAFill(GrColor color,
}
}
-inline GrDrawBatch* CreateAAFill(GrColor color,
+inline GrDrawBatch* CreateAAFill(const GrPaint& paint,
const SkMatrix& viewMatrix,
const SkRect& rect,
+ const SkRect& croppedRect,
const SkRect& devRect) {
- return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
+ if (!paint.usesDistanceVectorField()) {
+ return GrAAFillRectBatch::Create(paint.getColor(), viewMatrix, croppedRect, devRect);
+ } else {
+ return GrAnalyticRectBatch::CreateAnalyticRectBatch(paint.getColor(), viewMatrix, rect,
+ croppedRect, devRect);
+ }
}
inline GrDrawBatch* CreateAAFill(GrColor color,