blob: ce445da9d7d13ec038c58d2d980965590e4fca10 [file] [log] [blame]
Brian Osman937d9672019-04-05 11:54:37 -04001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "gm/gm.h"
Ben Wagner7fde8e12019-05-01 17:28:53 -04009#include "include/core/SkCanvas.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkFont.h"
11#include "include/core/SkPaint.h"
12#include "include/core/SkTextBlob.h"
Kevin Lubickbca43ec2023-10-30 10:11:22 -040013#include "tools/fonts/FontToolUtils.h"
Brian Osman937d9672019-04-05 11:54:37 -040014
15DEF_SIMPLE_GM(skbug_8955, canvas, 100, 100) {
16 SkPaint p;
Kevin Lubickbca43ec2023-10-30 10:11:22 -040017 SkFont font = ToolUtils::DefaultPortableFont();
Brian Osman937d9672019-04-05 11:54:37 -040018 font.setSize(50);
19 auto blob = SkTextBlob::MakeFromText("+", 1, font);
20
21 // This bug only appeared when drawing the same text blob. We would generate no glyphs on the
22 // first draw, and fail to mark the blob as having any bitmap runs. That would prevent us from
23 // re-generating the blob on the second draw, even though the matrix had been restored.
24 canvas->save();
25 canvas->scale(0, 0);
26 canvas->drawTextBlob(blob, 30, 60, p);
27 canvas->restore();
28 canvas->drawTextBlob(blob, 30, 60, p);
29}