Rip out variable offsetting
Bug: skia:
Change-Id: I0ca1f3b60d05ce02d1e53bb8b989c9dc1babddd1
Reviewed-on: https://skia-review.googlesource.com/150915
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/gm/polygonoffset.cpp b/gm/polygonoffset.cpp
index bffb351..705eeda 100644
--- a/gm/polygonoffset.cpp
+++ b/gm/polygonoffset.cpp
@@ -410,26 +410,17 @@
// to test perspective and other variable offset functions
class PolygonOffsetGM : public GM {
public:
- PolygonOffsetGM(bool convexOnly, bool variableOffset)
- : fConvexOnly(convexOnly)
- , fVariableOffset(variableOffset) {
+ PolygonOffsetGM(bool convexOnly)
+ : fConvexOnly(convexOnly) {
this->setBGColor(0xFFFFFFFF);
}
protected:
SkString onShortName() override {
if (fConvexOnly) {
- if (fVariableOffset) {
- return SkString("convex-polygon-inset-v");
- } else {
- return SkString("convex-polygon-inset");
- }
+ return SkString("convex-polygon-inset");
} else {
- if (fVariableOffset) {
- return SkString("simple-polygon-offset-v");
- } else {
- return SkString("simple-polygon-offset");
- }
+ return SkString("simple-polygon-offset");
}
}
SkISize onISize() override { return SkISize::Make(kGMWidth, kGMHeight); }
@@ -563,25 +554,15 @@
SkTDArray<SkPoint> offsetPoly;
size_t count = fConvexOnly ? SK_ARRAY_COUNT(insets) : SK_ARRAY_COUNT(offsets);
- SkScalar localCenterX = bounds.centerX();
for (size_t i = 0; i < count; ++i) {
SkScalar offset = fConvexOnly ? insets[i] : offsets[i];
std::function<SkScalar(const SkPoint&)> offsetFunc;
- if (fVariableOffset) {
- offsetFunc = [offset, localCenterX](const SkPoint& p) {
- return offset + 0.04f*(p.fX - localCenterX);
- };
- } else {
- offsetFunc = [offset](const SkPoint& p) {
- return offset;
- };
- }
bool result;
if (fConvexOnly) {
- result = SkInsetConvexPolygon(data.get(), numPts, offsetFunc, &offsetPoly);
+ result = SkInsetConvexPolygon(data.get(), numPts, offset, &offsetPoly);
} else {
- result = SkOffsetSimplePolygon(data.get(), numPts, offsetFunc, &offsetPoly);
+ result = SkOffsetSimplePolygon(data.get(), numPts, offset, &offsetPoly);
}
if (result) {
SkPath path;
@@ -620,15 +601,12 @@
static constexpr int kGMHeight = 512;
bool fConvexOnly;
- bool fVariableOffset;
typedef GM INHERITED;
};
//////////////////////////////////////////////////////////////////////////////
-DEF_GM(return new PolygonOffsetGM(true, false);)
-DEF_GM(return new PolygonOffsetGM(true, true);)
-DEF_GM(return new PolygonOffsetGM(false, false);)
-DEF_GM(return new PolygonOffsetGM(false, true);)
+DEF_GM(return new PolygonOffsetGM(true);)
+DEF_GM(return new PolygonOffsetGM(false);)
}