| 1 |
/* |
| 2 |
* Copyright 2016 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 GrPathStencilSettings_DEFINED |
| 9 |
#define GrPathStencilSettings_DEFINED |
| 10 |
|
| 11 |
#include "src/gpu/ganesh/GrUserStencilSettings.h" |
| 12 |
|
| 13 |
//////////////////////////////////////////////////////////////////////////////// |
| 14 |
// Stencil rules for paths |
| 15 |
|
| 16 |
////// Even/Odd |
| 17 |
|
| 18 |
static constexpr GrUserStencilSettings gEOStencilPass( |
| 19 |
GrUserStencilSettings::StaticInit< |
| 20 |
0xffff, |
| 21 |
GrUserStencilTest::kAlwaysIfInClip, |
| 22 |
0xffff, |
| 23 |
GrUserStencilOp::kInvert, |
| 24 |
GrUserStencilOp::kKeep, |
| 25 |
0xffff>() |
| 26 |
); |
| 27 |
|
| 28 |
// ok not to check clip b/c stencil pass only wrote inside clip |
| 29 |
static constexpr GrUserStencilSettings gEOColorPass( |
| 30 |
GrUserStencilSettings::StaticInit< |
| 31 |
0x0000, |
| 32 |
GrUserStencilTest::kNotEqual, |
| 33 |
0xffff, |
| 34 |
GrUserStencilOp::kZero, |
| 35 |
GrUserStencilOp::kZero, |
| 36 |
0xffff>() |
| 37 |
); |
| 38 |
|
| 39 |
// have to check clip b/c outside clip will always be zero. |
| 40 |
static constexpr GrUserStencilSettings gInvEOColorPass( |
| 41 |
GrUserStencilSettings::StaticInit< |
| 42 |
0x0000, |
| 43 |
GrUserStencilTest::kEqualIfInClip, |
| 44 |
0xffff, |
| 45 |
GrUserStencilOp::kZero, |
| 46 |
GrUserStencilOp::kZero, |
| 47 |
0xffff>() |
| 48 |
); |
| 49 |
|
| 50 |
////// Winding |
| 51 |
|
| 52 |
static constexpr GrUserStencilSettings gWindStencilPass ( |
| 53 |
GrUserStencilSettings::StaticInitSeparate< |
| 54 |
0xffff, 0xffff, |
| 55 |
GrUserStencilTest::kAlwaysIfInClip, GrUserStencilTest::kAlwaysIfInClip, |
| 56 |
0xffff, 0xffff, |
| 57 |
GrUserStencilOp::kIncWrap, GrUserStencilOp::kDecWrap, |
| 58 |
GrUserStencilOp::kKeep, GrUserStencilOp::kKeep, |
| 59 |
0xffff, 0xffff>() |
| 60 |
); |
| 61 |
|
| 62 |
static constexpr GrUserStencilSettings gWindColorPass( |
| 63 |
GrUserStencilSettings::StaticInit< |
| 64 |
0x0000, |
| 65 |
GrUserStencilTest::kLessIfInClip, // "0 < stencil" is equivalent to "0 != stencil". |
| 66 |
0xffff, |
| 67 |
GrUserStencilOp::kZero, |
| 68 |
GrUserStencilOp::kZero, |
| 69 |
0xffff>() |
| 70 |
); |
| 71 |
|
| 72 |
static constexpr GrUserStencilSettings gInvWindColorPass( |
| 73 |
GrUserStencilSettings::StaticInit< |
| 74 |
0x0000, |
| 75 |
GrUserStencilTest::kEqualIfInClip, |
| 76 |
0xffff, |
| 77 |
GrUserStencilOp::kZero, |
| 78 |
GrUserStencilOp::kZero, |
| 79 |
0xffff>() |
| 80 |
); |
| 81 |
|
| 82 |
////// Normal render to stencil |
| 83 |
|
| 84 |
// Sometimes the default path renderer can draw a path directly to the stencil |
| 85 |
// buffer without having to first resolve the interior / exterior. |
| 86 |
static constexpr GrUserStencilSettings gDirectToStencil( |
| 87 |
GrUserStencilSettings::StaticInit< |
| 88 |
0x0000, |
| 89 |
GrUserStencilTest::kAlwaysIfInClip, |
| 90 |
0xffff, |
| 91 |
GrUserStencilOp::kZero, |
| 92 |
GrUserStencilOp::kIncMaybeClamp, |
| 93 |
0xffff>() |
| 94 |
); |
| 95 |
|
| 96 |
#endif |