Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
13class SkMatrix;
14
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 */
24inline 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
static const int strokeWidth
Definition BlurTest.cpp:60
bool SkDrawTreatAsHairline(const SkPaint &paint, const SkMatrix &matrix, SkScalar *coverage)
Definition SkDrawProcs.h:24
bool SkDrawTreatAAStrokeAsHairline(SkScalar strokeWidth, const SkMatrix &, SkScalar *coverage)
#define SK_Scalar1
Definition SkScalar.h:18
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
const Paint & paint
float SkScalar
Definition extension.cpp:12