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

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

Issue 1483103003: Make onPrepareDraws const (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge Created 5 years, 1 month 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/GrNinePatch.cpp ('k') | src/gpu/batches/GrTInstanceBatch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrNonAAStrokeRectBatch.cpp
diff --git a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
index 2f80884b61f878a22cb1ad61ab337987aebe4210..d036b90c27ceb7b8df4b08e28b9e558cfba0a013 100644
--- a/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
+++ b/src/gpu/batches/GrNonAAStrokeRectBatch.cpp
@@ -70,6 +70,9 @@ public:
geometry.fRect = rect;
geometry.fStrokeWidth = strokeWidth;
geometry.fColor = color;
+
+ // Sort the rect for hairlines
+ geometry.fRect.sort();
}
void appendAndUpdateBounds(GrColor color, const SkMatrix& viewMatrix, const SkRect& rect,
@@ -102,7 +105,7 @@ private:
}
}
- void onPrepareDraws(Target* target) override {
+ void onPrepareDraws(Target* target) const override {
SkAutoTUnref<const GrGeometryProcessor> gp;
{
using namespace GrDefaultGeoProcFactory;
@@ -121,7 +124,7 @@ private:
SkASSERT(vertexStride == sizeof(GrDefaultGeoProcFactory::PositionAttr));
- Geometry& args = fGeoData[0];
+ const Geometry& args = fGeoData[0];
int vertexCount = kVertsPerHairlineRect;
if (args.fStrokeWidth > 0) {
@@ -142,10 +145,8 @@ private:
SkPoint* vertex = reinterpret_cast<SkPoint*>(verts);
GrPrimitiveType primType;
-
if (args.fStrokeWidth > 0) {;
primType = kTriangleStrip_GrPrimitiveType;
- args.fRect.sort();
init_stroke_rect_strip(vertex, args.fRect, args.fStrokeWidth);
} else {
// hairline
« no previous file with comments | « src/gpu/batches/GrNinePatch.cpp ('k') | src/gpu/batches/GrTInstanceBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698