Flutter Engine
The Flutter Engine
third_party
skia
src
core
SkDrawProcs.h
Go to the documentation of this file.
1
/*
2
* Copyright 2011 Google Inc.
3
*
4
* Use of this source code is governed by a BSD-style license that can be
5
* found in the LICENSE file.
6
*/
7
8
#ifndef SkDrawProcs_DEFINED
9
#define SkDrawProcs_DEFINED
10
11
#include "
include/core/SkPaint.h
"
12
#include "
include/core/SkScalar.h
"
13
class
SkMatrix
;
14
15
bool
SkDrawTreatAAStrokeAsHairline
(
SkScalar
strokeWidth
,
const
SkMatrix
&,
16
SkScalar
*
coverage
);
17
18
/**
19
* If the current paint is set to stroke and the stroke-width when applied to
20
* the matrix is <= 1.0, then this returns true, and sets coverage (simulating
21
* a stroke by drawing a hairline with partial coverage). If any of these
22
* conditions are false, then this returns false and coverage is ignored.
23
*/
24
inline
bool
SkDrawTreatAsHairline
(
const
SkPaint
&
paint
,
const
SkMatrix
&
matrix
,
25
SkScalar
*
coverage
) {
26
if
(
SkPaint::kStroke_Style
!=
paint
.getStyle()) {
27
return
false
;
28
}
29
30
SkScalar
strokeWidth
=
paint
.getStrokeWidth();
31
if
(0 ==
strokeWidth
) {
32
*
coverage
=
SK_Scalar1
;
33
return
true
;
34
}
35
36
if
(!
paint
.isAntiAlias()) {
37
return
false
;
38
}
39
40
return
SkDrawTreatAAStrokeAsHairline
(
strokeWidth
,
matrix
,
coverage
);
41
}
42
43
#endif
strokeWidth
static const int strokeWidth
Definition:
BlurTest.cpp:60
SkDrawTreatAsHairline
bool SkDrawTreatAsHairline(const SkPaint &paint, const SkMatrix &matrix, SkScalar *coverage)
Definition:
SkDrawProcs.h:24
SkDrawTreatAAStrokeAsHairline
bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix &, SkScalar *coverage)
Definition:
SkDrawBase.cpp:262
SkPaint.h
SkScalar.h
SK_Scalar1
#define SK_Scalar1
Definition:
SkScalar.h:18
SkMatrix
Definition:
SkMatrix.h:54
SkPaint
Definition:
SkPaint.h:44
SkPaint::kStroke_Style
@ kStroke_Style
set to stroke geometry
Definition:
SkPaint.h:194
paint
const Paint & paint
Definition:
color_source.cc:38
SkScalar
float SkScalar
Definition:
extension.cpp:12
SkRecords::matrix
unsigned useCenter Optional< SkMatrix > matrix
Definition:
SkRecords.h:258
generate_fir_coeff.coverage
def coverage
Definition:
generate_fir_coeff.py:84
Generated on Sun Jun 23 2024 21:56:12 for Flutter Engine by
1.9.4