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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gm.h"
|
2017-03-22 17:47:51 +00:00
|
|
|
#include "sk_tool_utils.h"
|
2015-05-11 21:52:11 +00:00
|
|
|
|
|
|
|
#include "SkBlurMask.h"
|
|
|
|
#include "SkCanvas.h"
|
2018-03-14 17:01:17 +00:00
|
|
|
#include "SkMaskFilter.h"
|
2015-05-11 21:52:11 +00:00
|
|
|
#include "SkTextBlob.h"
|
|
|
|
|
|
|
|
// This test ensures that glyphs whose point size is less than the SkGlyphCache's maxmium, but
|
|
|
|
// 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
|
|
|
|
2018-12-22 22:37:30 +00:00
|
|
|
SkFont font(sk_tool_utils::create_portable_typeface(), 256);
|
|
|
|
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
|
|
|
}
|