b_119394958.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031
  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/SkColor.h"
  10. #include "include/core/SkPaint.h"
  11. #include "include/core/SkRect.h"
  12. DEF_SIMPLE_GM(b_119394958, canvas, 100, 100) {
  13. // The root cause of this bug was that a stroked arc with round caps was batched with a filled
  14. // circle. The circle op code would choose a GeometryProcessor configuration that expected round
  15. // cap centers as vertex attributes. However, the tessellation code for the filled circle would
  16. // not put in dummy round cap centers and then didn't advance the pointer into which vertex data
  17. // was being written by the expected vertex stride.
  18. SkPaint paint;
  19. paint.setColor(SK_ColorBLUE);
  20. paint.setAntiAlias(true);
  21. canvas->drawCircle(50, 50, 45, paint);
  22. paint.setColor(SK_ColorGREEN);
  23. paint.setStyle(SkPaint::kStroke_Style);
  24. paint.setStrokeWidth(5);
  25. canvas->drawCircle(50, 50, 35, paint);
  26. paint.setColor(SK_ColorRED);
  27. paint.setStrokeCap(SkPaint::kRound_Cap);
  28. canvas->drawArc(SkRect::MakeLTRB(30, 30, 70, 70), 0, 110, false, paint);
  29. }