Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1933053002: Use constexpr constructors of GrStencilSettings rather than hacky macro system (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 49c46feeaf62e390b91ccb21d9a3f6e8e0dce243..0f180dc861b92ced07c2ddc9548564894f7642b0 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -269,36 +269,31 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
this->recordBatch(batch);
}
-static const GrStencilSettings& winding_path_stencil_settings() {
- GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
+void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill,
+ const GrStencilAttachment* sb,
+ GrStencilSettings* outStencilSettings) {
+ static constexpr GrStencilSettings kWindingStencilSettings(
kIncClamp_StencilOp,
kIncClamp_StencilOp,
kAlwaysIfInClip_StencilFunc,
- 0xFFFF, 0xFFFF, 0xFFFF);
- return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
-}
+ 0xFFFF, 0xFFFF, 0xFFFF
+ );
-static const GrStencilSettings& even_odd_path_stencil_settings() {
- GR_STATIC_CONST_SAME_STENCIL_STRUCT(gSettings,
+ static constexpr GrStencilSettings kEvenODdStencilSettings(
kInvert_StencilOp,
kInvert_StencilOp,
kAlwaysIfInClip_StencilFunc,
- 0xFFFF, 0xFFFF, 0xFFFF);
- return *GR_CONST_STENCIL_SETTINGS_PTR_FROM_STRUCT_PTR(&gSettings);
-}
-
-void GrDrawTarget::getPathStencilSettingsForFilltype(GrPathRendering::FillType fill,
- const GrStencilAttachment* sb,
- GrStencilSettings* outStencilSettings) {
+ 0xFFFF, 0xFFFF, 0xFFFF
+ );
switch (fill) {
default:
SkFAIL("Unexpected path fill.");
case GrPathRendering::kWinding_FillType:
- *outStencilSettings = winding_path_stencil_settings();
+ *outStencilSettings = kWindingStencilSettings;
break;
case GrPathRendering::kEvenOdd_FillType:
- *outStencilSettings = even_odd_path_stencil_settings();
+ *outStencilSettings = kEvenODdStencilSettings;
break;
}
fClipMaskManager->adjustPathStencilParams(sb, outStencilSettings);
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrPathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698