blob: aaafa490d789f4da705df818d32d0919221d5c49 [file] [log] [blame]
Herb Derbydf33fef2017-08-14 14:58:14 -04001/*
2 * Copyright 2017 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 Wagner6a34f3a2019-05-01 10:59:30 -04009#include "include/core/SkBlurTypes.h"
10#include "include/core/SkCanvas.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "include/core/SkColor.h"
12#include "include/core/SkFont.h"
13#include "include/core/SkMaskFilter.h"
Ben Wagner6a34f3a2019-05-01 10:59:30 -040014#include "include/core/SkPaint.h"
Kevin Lubickbca43ec2023-10-30 10:11:22 -040015#include "tools/fonts/FontToolUtils.h"
Herb Derbydf33fef2017-08-14 14:58:14 -040016
17// GM to check the behavior from chrome bug:745290
18DEF_SIMPLE_GM(blurSmallRadii, canvas, 100, 100) {
19 double sigmas[] = {0.5, 0.75, 1.0, 1.5, 2.5};
20 SkPaint paint;
Kevin Lubickbca43ec2023-10-30 10:11:22 -040021 SkFont font = ToolUtils::DefaultPortableFont();
Herb Derbydf33fef2017-08-14 14:58:14 -040022
23 for (auto sigma : sigmas) {
24 paint.setColor(SK_ColorBLACK);
25 paint.setAntiAlias(true);
Mike Reed1be1f8d2018-03-14 13:01:17 -040026 paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
Kevin Lubickbca43ec2023-10-30 10:11:22 -040027 canvas->drawString("Guest", 20, 10, font, paint);
Herb Derbydf33fef2017-08-14 14:58:14 -040028
29 paint.setMaskFilter(nullptr);
30 paint.setColor(SK_ColorWHITE);
Kevin Lubickbca43ec2023-10-30 10:11:22 -040031 canvas->drawString("Guest", 20, 10, font, paint);
Herb Derbydf33fef2017-08-14 14:58:14 -040032 canvas->translate(0, 20);
33 }
34}