Herb Derby | df33fef | 2017-08-14 14:58:14 -0400 | [diff] [blame] | 1 | /* |
| 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 Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "gm/gm.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 9 | #include "include/core/SkBlurTypes.h" |
| 10 | #include "include/core/SkCanvas.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "include/core/SkColor.h" |
| 12 | #include "include/core/SkFont.h" |
| 13 | #include "include/core/SkMaskFilter.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 14 | #include "include/core/SkPaint.h" |
Herb Derby | df33fef | 2017-08-14 14:58:14 -0400 | [diff] [blame] | 15 | |
| 16 | // GM to check the behavior from chrome bug:745290 |
| 17 | DEF_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 Reed | 1be1f8d | 2018-03-14 13:01:17 -0400 | [diff] [blame] | 24 | paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma)); |
Mike Reed | c4745d6 | 2019-01-07 09:31:58 -0500 | [diff] [blame] | 25 | canvas->drawString("Guest", 20, 10, SkFont(), paint); |
Herb Derby | df33fef | 2017-08-14 14:58:14 -0400 | [diff] [blame] | 26 | |
| 27 | paint.setMaskFilter(nullptr); |
| 28 | paint.setColor(SK_ColorWHITE); |
Mike Reed | c4745d6 | 2019-01-07 09:31:58 -0500 | [diff] [blame] | 29 | canvas->drawString("Guest", 20, 10, SkFont(), paint); |
Herb Derby | df33fef | 2017-08-14 14:58:14 -0400 | [diff] [blame] | 30 | canvas->translate(0, 20); |
| 31 | } |
| 32 | } |