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

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

Issue 1345853005: Move determiniation of strokerect rects internal (Closed) Base URL: https://skia.googlesource.com/skia.git@strokerectfix
Patch Set: comment fixed 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
Index: src/gpu/batches/GrRectBatchFactory.cpp
diff --git a/src/gpu/batches/GrRectBatchFactory.cpp b/src/gpu/batches/GrRectBatchFactory.cpp
index f34a8c058a2c307783dc2c3eb522ea924b1d634c..f144d1b5325ec40a0f4fe25bc9dd2f1ccdc1ce87 100644
--- a/src/gpu/batches/GrRectBatchFactory.cpp
+++ b/src/gpu/batches/GrRectBatchFactory.cpp
@@ -13,70 +13,6 @@
namespace GrRectBatchFactory {
-GrDrawBatch* CreateAAStroke(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect& devRect,
- const SkStrokeRec& stroke) {
- SkVector devStrokeSize;
- SkScalar width = stroke.getWidth();
- if (width > 0) {
- devStrokeSize.set(width, width);
- viewMatrix.mapVectors(&devStrokeSize, 1);
- devStrokeSize.setAbs(devStrokeSize);
- } else {
- devStrokeSize.set(SK_Scalar1, SK_Scalar1);
- }
-
- const SkScalar dx = devStrokeSize.fX;
- const SkScalar dy = devStrokeSize.fY;
- const SkScalar rx = SkScalarMul(dx, SK_ScalarHalf);
- const SkScalar ry = SkScalarMul(dy, SK_ScalarHalf);
-
- SkRect devOutside(devRect);
- devOutside.outset(rx, ry);
-
- bool miterStroke = true;
- // For hairlines, make bevel and round joins appear the same as mitered ones.
- // small miter limit means right angles show bevel...
- if ((width > 0) && (stroke.getJoin() != SkPaint::kMiter_Join ||
- stroke.getMiter() < SK_ScalarSqrt2)) {
- miterStroke = false;
- }
-
- SkRect devInside(devRect);
- devInside.inset(rx, ry);
-
- // If we have a degenerate stroking rect(ie the stroke is larger than inner rect) then we
- // make a degenerate inside rect to avoid double hitting. We will also jam all of the points
- // together when we render these rects.
- SkScalar spare;
- {
- SkScalar w = devRect.width() - dx;
- SkScalar h = devRect.height() - dy;
- spare = SkTMin(w, h);
- }
-
- bool degenerate = spare <= 0;
- if (degenerate) {
- devInside.fLeft = devInside.fRight = devRect.centerX();
- devInside.fTop = devInside.fBottom = devRect.centerY();
- }
-
- SkRect devOutsideAssist(devRect);
-
- // For bevel-stroke, use 2 SkRect instances(devOutside and devOutsideAssist)
- // to draw the outer of the rect. Because there are 8 vertices on the outer
- // edge, while vertex number of inner edge is 4, the same as miter-stroke.
- if (!miterStroke) {
- devOutside.inset(0, ry);
- devOutsideAssist.outset(0, ry);
- }
-
- return GrAAStrokeRectBatch::Create(color, viewMatrix, devOutside, devOutsideAssist, devInside,
- miterStroke, degenerate);
-}
-
GrDrawBatch* CreateAAFillNestedRects(GrColor color,
const SkMatrix& viewMatrix,
const SkRect rects[2]) {
« src/gpu/batches/GrAAStrokeRectBatch.cpp ('K') | « src/gpu/batches/GrRectBatchFactory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698