blurtextsmallradii.cpp 979 B

1234567891011121314151617181920212223242526272829303132
  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. #include "gm/gm.h"
  8. #include "include/core/SkBlurTypes.h"
  9. #include "include/core/SkCanvas.h"
  10. #include "include/core/SkColor.h"
  11. #include "include/core/SkFont.h"
  12. #include "include/core/SkMaskFilter.h"
  13. #include "include/core/SkPaint.h"
  14. // GM to check the behavior from chrome bug:745290
  15. DEF_SIMPLE_GM(blurSmallRadii, canvas, 100, 100) {
  16. double sigmas[] = {0.5, 0.75, 1.0, 1.5, 2.5};
  17. SkPaint paint;
  18. for (auto sigma : sigmas) {
  19. paint.setColor(SK_ColorBLACK);
  20. paint.setAntiAlias(true);
  21. paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, sigma));
  22. canvas->drawString("Guest", 20, 10, SkFont(), paint);
  23. paint.setMaskFilter(nullptr);
  24. paint.setColor(SK_ColorWHITE);
  25. canvas->drawString("Guest", 20, 10, SkFont(), paint);
  26. canvas->translate(0, 20);
  27. }
  28. }