Brian Osman | 937d967 | 2019-04-05 11:54:37 -0400 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 7fde8e1 | 2019-05-01 17:28:53 -0400 | [diff] [blame] | 9 | #include "include/core/SkCanvas.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/core/SkFont.h" |
| 11 | #include "include/core/SkPaint.h" |
| 12 | #include "include/core/SkTextBlob.h" |
Brian Osman | 937d967 | 2019-04-05 11:54:37 -0400 | [diff] [blame] | 13 | |
| 14 | DEF_SIMPLE_GM(skbug_8955, canvas, 100, 100) { |
| 15 | SkPaint p; |
| 16 | SkFont font; |
| 17 | font.setSize(50); |
| 18 | auto blob = SkTextBlob::MakeFromText("+", 1, font); |
| 19 | |
| 20 | // This bug only appeared when drawing the same text blob. We would generate no glyphs on the |
| 21 | // first draw, and fail to mark the blob as having any bitmap runs. That would prevent us from |
| 22 | // re-generating the blob on the second draw, even though the matrix had been restored. |
| 23 | canvas->save(); |
| 24 | canvas->scale(0, 0); |
| 25 | canvas->drawTextBlob(blob, 30, 60, p); |
| 26 | canvas->restore(); |
| 27 | canvas->drawTextBlob(blob, 30, 60, p); |
| 28 | } |