diff options
author | 2014-08-01 10:17:42 -0400 | |
---|---|---|
committer | 2014-08-01 10:17:42 -0400 | |
commit | efea5a72d6c49d51a5a02a92f10930d38e45843c (patch) | |
tree | 83d5acccfa5a46cac4609d13861ad40813eb4256 | |
parent | 5816233d237e5c214f14f1c92eda4a87c898ea11 (diff) |
Remove SK_IGNORE_QUAD_RR_CORNERS_OPT-related code.
Now that the flag is no longer used in Chromium
(https://codereview.chromium.org/426593006/), we can remove it.
R=bsalomon@google.com, reed@google.com, robertphillips@google.com
Review URL: https://codereview.chromium.org/430473012
-rw-r--r-- | src/core/SkPath.cpp | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 7f2e67a327..aa7943cf5a 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -1089,11 +1089,6 @@ void SkPath::addRRect(const SkRRect& rrect, Direction dir) { this->addRect(bounds, dir); } else if (rrect.isOval()) { this->addOval(bounds, dir); -#ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT - } else if (rrect.isSimple()) { - const SkVector& rad = rrect.getSimpleRadii(); - this->addRoundRect(bounds, rad.x(), rad.y(), dir); -#endif } else { fDirection = this->hasOnlyMoveTos() ? dir : kUnknown_Direction; @@ -1135,10 +1130,6 @@ bool SkPath::hasOnlyMoveTos() const { return true; } -#ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT -#define CUBIC_ARC_FACTOR ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3) -#endif - void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, Direction dir) { assert_known_direction(dir); @@ -1151,96 +1142,9 @@ void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, return; } -#ifdef SK_IGNORE_QUAD_RR_CORNERS_OPT - SkScalar w = rect.width(); - SkScalar halfW = SkScalarHalf(w); - SkScalar h = rect.height(); - SkScalar halfH = SkScalarHalf(h); - - if (halfW <= 0 || halfH <= 0) { - return; - } - - bool skip_hori = rx >= halfW; - bool skip_vert = ry >= halfH; - - if (skip_hori && skip_vert) { - this->addOval(rect, dir); - return; - } - - fDirection = this->hasOnlyMoveTos() ? dir : kUnknown_Direction; - - SkAutoPathBoundsUpdate apbu(this, rect); - SkAutoDisableDirectionCheck addc(this); - - if (skip_hori) { - rx = halfW; - } else if (skip_vert) { - ry = halfH; - } - SkScalar sx = SkScalarMul(rx, CUBIC_ARC_FACTOR); - SkScalar sy = SkScalarMul(ry, CUBIC_ARC_FACTOR); - - this->incReserve(17); - this->moveTo(rect.fRight - rx, rect.fTop); // top-right - if (dir == kCCW_Direction) { - if (!skip_hori) { - this->lineTo(rect.fLeft + rx, rect.fTop); // top - } - this->cubicTo(rect.fLeft + rx - sx, rect.fTop, - rect.fLeft, rect.fTop + ry - sy, - rect.fLeft, rect.fTop + ry); // top-left - if (!skip_vert) { - this->lineTo(rect.fLeft, rect.fBottom - ry); // left - } - this->cubicTo(rect.fLeft, rect.fBottom - ry + sy, - rect.fLeft + rx - sx, rect.fBottom, - rect.fLeft + rx, rect.fBottom); // bot-left - if (!skip_hori) { - this->lineTo(rect.fRight - rx, rect.fBottom); // bottom - } - this->cubicTo(rect.fRight - rx + sx, rect.fBottom, - rect.fRight, rect.fBottom - ry + sy, - rect.fRight, rect.fBottom - ry); // bot-right - if (!skip_vert) { - this->lineTo(rect.fRight, rect.fTop + ry); // right - } - this->cubicTo(rect.fRight, rect.fTop + ry - sy, - rect.fRight - rx + sx, rect.fTop, - rect.fRight - rx, rect.fTop); // top-right - } else { - this->cubicTo(rect.fRight - rx + sx, rect.fTop, - rect.fRight, rect.fTop + ry - sy, - rect.fRight, rect.fTop + ry); // top-right - if (!skip_vert) { - this->lineTo(rect.fRight, rect.fBottom - ry); // right - } - this->cubicTo(rect.fRight, rect.fBottom - ry + sy, - rect.fRight - rx + sx, rect.fBottom, - rect.fRight - rx, rect.fBottom); // bot-right - if (!skip_hori) { - this->lineTo(rect.fLeft + rx, rect.fBottom); // bottom - } - this->cubicTo(rect.fLeft + rx - sx, rect.fBottom, - rect.fLeft, rect.fBottom - ry + sy, - rect.fLeft, rect.fBottom - ry); // bot-left - if (!skip_vert) { - this->lineTo(rect.fLeft, rect.fTop + ry); // left - } - this->cubicTo(rect.fLeft, rect.fTop + ry - sy, - rect.fLeft + rx - sx, rect.fTop, - rect.fLeft + rx, rect.fTop); // top-left - if (!skip_hori) { - this->lineTo(rect.fRight - rx, rect.fTop); // top - } - } - this->close(); -#else SkRRect rrect; rrect.setRectXY(rect, rx, ry); this->addRRect(rrect, dir); -#endif } void SkPath::addOval(const SkRect& oval, Direction dir) { |