• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
8 #include "gm/gm.h"
9 #include "include/core/SkBlurTypes.h"
10 #include "include/core/SkCanvas.h"
11 #include "include/core/SkColor.h"
12 #include "include/core/SkFont.h"
13 #include "include/core/SkMaskFilter.h"
14 #include "include/core/SkPaint.h"
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);
24         paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
25         canvas->drawString("Guest", 20, 10, SkFont(), paint);
26 
27         paint.setMaskFilter(nullptr);
28         paint.setColor(SK_ColorWHITE);
29         canvas->drawString("Guest", 20, 10, SkFont(), paint);
30         canvas->translate(0, 20);
31     }
32 }
33