diff --git a/gm/shapes.cpp b/gm/shapes.cpp index f11b02c0bf..19c94ddade 100644 --- a/gm/shapes.cpp +++ b/gm/shapes.cpp @@ -140,10 +140,29 @@ private: const SkRRect& outer = fShapes[i]; const SkRRect& inner = fShapes[(i * 7 + 11) % fSimpleShapeCount]; float s = 0.95f * std::min(outer.rect().width() / inner.rect().width(), - outer.rect().height() / inner.rect().height()); + outer.rect().height() / inner.rect().height()); SkMatrix innerXform; float dx = (rand.nextF() - 0.5f) * (outer.rect().width() - s * inner.rect().width()); float dy = (rand.nextF() - 0.5f) * (outer.rect().height() - s * inner.rect().height()); + // Fixup inner rects so they don't reach outside the outer rect. + switch (i) { + case 0: + s *= .85f; + break; + case 8: + s *= .4f; + dx = dy = 0; + break; + case 5: + s *= .75f; + dx = dy = 0; + break; + case 6: + s *= .65f; + dx = -5; + dy = 10; + break; + } innerXform.setTranslate(outer.rect().centerX() + dx, outer.rect().centerY() + dy); if (s < 1) { innerXform.preScale(s, s);