blob: 4e18d8ecff8a13e97f669dadc4a74ab20f1d8399 [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"
Herb Derbydf33fef2017-08-14 14:58:14 -040015
16// GM to check the behavior from chrome bug:745290
17DEF_SIMPLE_GM(blurSmallRadii, canvas, 100, 100) {
18 double sigmas[] = {0.5, 0.75, 1.0, 1.5, 2.5};
19 SkPaint paint;
20
21 for (auto sigma : sigmas) {
22 paint.setColor(SK_ColorBLACK);
23 paint.setAntiAlias(true);
Mike Reed1be1f8d2018-03-14 13:01:17 -040024 paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
Mike Reedc4745d62019-01-07 09:31:58 -050025 canvas->drawString("Guest", 20, 10, SkFont(), paint);
Herb Derbydf33fef2017-08-14 14:58:14 -040026
27 paint.setMaskFilter(nullptr);
28 paint.setColor(SK_ColorWHITE);
Mike Reedc4745d62019-01-07 09:31:58 -050029 canvas->drawString("Guest", 20, 10, SkFont(), paint);
Herb Derbydf33fef2017-08-14 14:58:14 -040030 canvas->translate(0, 20);
31 }
32}