2015-05-11 21:52:11 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "gm/gm.h"
|
|
|
|
#include "tools/ToolUtils.h"
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkMaskFilter.h"
|
|
|
|
#include "include/core/SkTextBlob.h"
|
|
|
|
#include "src/core/SkBlurMask.h"
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2019-01-16 16:23:29 +00:00
|
|
|
// This test ensures that glyphs whose point size is less than the SkStrike's maxmium, but
|
2015-05-11 21:52:11 +00:00
|
|
|
// who have a large blur, are still handled correctly
|
2015-09-09 15:16:41 +00:00
|
|
|
DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600) {
|
2018-12-22 22:37:30 +00:00
|
|
|
const char text[] = "Hamburgefons";
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2019-03-20 16:12:10 +00:00
|
|
|
SkFont font(ToolUtils::create_portable_typeface(), 256);
|
2018-12-22 22:37:30 +00:00
|
|
|
auto blob = SkTextBlob::MakeFromText(text, strlen(text), font);
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2018-12-22 22:37:30 +00:00
|
|
|
// setup up maskfilter
|
|
|
|
const SkScalar kSigma = SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(40));
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2018-12-22 22:37:30 +00:00
|
|
|
SkPaint blurPaint;
|
|
|
|
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, kSigma));
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2018-12-22 22:37:30 +00:00
|
|
|
canvas->drawTextBlob(blob, 10, 200, blurPaint);
|
|
|
|
canvas->drawTextBlob(blob, 10, 200, SkPaint());
|
2015-05-11 21:52:11 +00:00
|
|
|
|
2018-12-22 22:37:30 +00:00
|
|
|
size_t len = strlen(text);
|
|
|
|
canvas->drawSimpleText(text, len, kUTF8_SkTextEncoding, 10, 500, font, blurPaint);
|
|
|
|
canvas->drawSimpleText(text, len, kUTF8_SkTextEncoding, 10, 500, font, SkPaint());
|
2015-05-11 21:52:11 +00:00
|
|
|
}
|