Flutter Engine
The Flutter Engine
third_party
skia
gm
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
"
9
#include "
include/core/SkBlurTypes.h
"
10
#include "
include/core/SkCanvas.h
"
11
#include "
include/core/SkFont.h
"
12
#include "
include/core/SkFontTypes.h
"
13
#include "
include/core/SkMaskFilter.h
"
14
#include "
include/core/SkPaint.h
"
15
#include "
include/core/SkScalar.h
"
16
#include "
include/core/SkTextBlob.h
"
17
#include "
include/core/SkTypeface.h
"
18
#include "
src/core/SkBlurMask.h
"
19
#include "
tools/ToolUtils.h
"
20
#include "
tools/fonts/FontToolUtils.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
26
DEF_SIMPLE_GM
(largeglyphblur, canvas, 1920, 600) {
27
const
char
text
[] =
"Hamburgefons"
;
28
29
SkFont
font
(
ToolUtils::DefaultPortableTypeface
(), 256);
30
auto
blob =
SkTextBlob::MakeFromText
(
text
, strlen(
text
),
font
);
31
32
// setup up maskfilter
33
const
SkScalar
kSigma =
SkBlurMask::ConvertRadiusToSigma
(
SkIntToScalar
(40));
34
35
SkPaint
blurPaint;
36
blurPaint.
setMaskFilter
(
SkMaskFilter::MakeBlur
(
kNormal_SkBlurStyle
, kSigma));
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
}
FontToolUtils.h
SkBlurMask.h
SkBlurTypes.h
kNormal_SkBlurStyle
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition:
SkBlurTypes.h:12
SkCanvas.h
SkFontTypes.h
SkTextEncoding::kUTF8
@ kUTF8
uses bytes to represent UTF-8 or ASCII
SkFont.h
SkMaskFilter.h
SkPaint.h
SkScalar.h
SkIntToScalar
#define SkIntToScalar(x)
Definition:
SkScalar.h:57
SkTextBlob.h
SkTypeface.h
ToolUtils.h
SkBlurMask::ConvertRadiusToSigma
static SkScalar SK_SPI ConvertRadiusToSigma(SkScalar radius)
Definition:
SkBlurMask.cpp:39
SkFont
Definition:
SkFont.h:35
SkMaskFilter::MakeBlur
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
Definition:
SkBlurMaskFilterImpl.cpp:535
SkPaint
Definition:
SkPaint.h:44
SkPaint::setMaskFilter
void setMaskFilter(sk_sp< SkMaskFilter > maskFilter)
SkTextBlob::MakeFromText
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
Definition:
SkTextBlob.cpp:788
SkScalar
float SkScalar
Definition:
extension.cpp:12
gm.h
text
std::u16string text
Definition:
keyboard_unittests.cc:332
DEF_SIMPLE_GM
DEF_SIMPLE_GM(largeglyphblur, canvas, 1920, 600)
Definition:
largeglyphblur.cpp:26
ToolUtils::DefaultPortableTypeface
sk_sp< SkTypeface > DefaultPortableTypeface()
Definition:
FontToolUtils.cpp:195
gen_test_font.font
font
Font Metadata and Metrics.
Definition:
gen_test_font.py:26
gn.find_headers.len
len
Definition:
find_headers.py:30
Generated on Sun Jun 23 2024 21:56:00 for Flutter Engine by
1.9.4