Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
largeglyphblur.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
11#include "include/core/SkFont.h"
18#include "src/core/SkBlurMask.h"
19#include "tools/ToolUtils.h"
21
22#include <string.h>
23
24// This test ensures that glyphs whose point size is less than the SkStrike's maxmium, but
25// who have a large blur, are still handled correctly
26DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600) {
27 const char text[] = "Hamburgefons";
28
30 auto blob = SkTextBlob::MakeFromText(text, strlen(text), font);
31
32 // setup up maskfilter
34
35 SkPaint blurPaint;
37
38 canvas->drawTextBlob(blob, 10, 200, blurPaint);
39 canvas->drawTextBlob(blob, 10, 200, SkPaint());
40
41 size_t len = strlen(text);
42 canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, 10, 500, font, blurPaint);
43 canvas->drawSimpleText(text, len, SkTextEncoding::kUTF8, 10, 500, font, SkPaint());
44}
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition SkBlurTypes.h:12
@ kUTF8
uses bytes to represent UTF-8 or ASCII
#define SkIntToScalar(x)
Definition SkScalar.h:57
static SkScalar SK_SPI ConvertRadiusToSigma(SkScalar radius)
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
float SkScalar
Definition extension.cpp:12
#define DEF_SIMPLE_GM(NAME, CANVAS, W, H)
Definition gm.h:50
std::u16string text
sk_sp< SkTypeface > DefaultPortableTypeface()