crbug_847759.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright 2018 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "gm/gm.h"
  8. #include "include/core/SkCanvas.h"
  9. #include "include/core/SkPaint.h"
  10. #include "include/core/SkPath.h"
  11. DEF_SIMPLE_GM(crbug_847759, canvas, 500, 500) {
  12. // This path exposed an issue in GrAAHairlinePathRenderer. When converting from cubics to quads
  13. // we produced quads where the previously vertical tangents at the left and right tips of the
  14. // squashed oval-like path became slightly non-vertical. This caused a missed pixel of AA just
  15. // outside each tip.
  16. SkPath path;
  17. path.moveTo(97,374.5f);
  18. path.cubicTo(97,359.8644528f,155.8745488f,348,228.5f,348);
  19. path.cubicTo(301.1254512f,348,360,359.8644528f,360,374.5f);
  20. path.cubicTo(360,389.1355472f,301.1254512f,401,228.5f,401);
  21. path.cubicTo(155.8745488f,401,97,389.1355472f,97,374.5f);
  22. path.close();
  23. SkPaint paint;
  24. paint.setAntiAlias(true);
  25. paint.setStrokeWidth(0);
  26. paint.setStrokeMiter(1.5);
  27. paint.setStyle(SkPaint::kStroke_Style);
  28. canvas->translate(-80, -330);
  29. canvas->drawPath(path, paint);
  30. }