skbug_8955.cpp 906 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright 2019 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/SkFont.h"
  10. #include "include/core/SkPaint.h"
  11. #include "include/core/SkTextBlob.h"
  12. DEF_SIMPLE_GM(skbug_8955, canvas, 100, 100) {
  13. SkPaint p;
  14. SkFont font;
  15. font.setSize(50);
  16. auto blob = SkTextBlob::MakeFromText("+", 1, font);
  17. // This bug only appeared when drawing the same text blob. We would generate no glyphs on the
  18. // first draw, and fail to mark the blob as having any bitmap runs. That would prevent us from
  19. // re-generating the blob on the second draw, even though the matrix had been restored.
  20. canvas->save();
  21. canvas->scale(0, 0);
  22. canvas->drawTextBlob(blob, 30, 60, p);
  23. canvas->restore();
  24. canvas->drawTextBlob(blob, 30, 60, p);
  25. }