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"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkBlurTypes.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkFont.h"
|
|
|
|
#include "include/core/SkFontTypes.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkMaskFilter.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkPaint.h"
|
|
|
|
#include "include/core/SkScalar.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkTextBlob.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "include/core/SkTypeface.h"
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "src/core/SkBlurMask.h"
|
2019-05-01 21:28:53 +00:00
|
|
|
#include "tools/ToolUtils.h"
|
|
|
|
|
|
|
|
#include <string.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);
|
2019-05-07 19:38:46 +00:00
|
|
|
canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, 10, 500, font, blurPaint);
|
|
|
|
canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, 10, 500, font, SkPaint());
|
2015-05-11 21:52:11 +00:00
|
|
|
}
|