diff options
-rw-r--r-- | src/gpu/GrGpu.cpp | 23 | ||||
-rw-r--r-- | src/gpu/GrGpu.h | 2 | ||||
-rw-r--r-- | src/gpu/GrGpuGL.cpp | 2 |
3 files changed, 16 insertions, 11 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 39960de054..5ec9948690 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -343,15 +343,20 @@ const GrVertexBuffer* GrGpu::getUnitSquareVertexBuffer() const { //////////////////////////////////////////////////////////////////////////////// -// stencil settings to use when clip is in stencil -GR_STATIC_CONST_SAME_STENCIL(gClipStencilSettings, - kKeep_StencilOp, - kKeep_StencilOp, - kAlwaysIfInClip_StencilFunc, - 0x0000, - 0x0000, - 0x0000); -const GrStencilSettings& GrGpu::gClipStencilSettings = ::gClipStencilSettings; +const GrStencilSettings* GrGpu::GetClipStencilSettings(void) { + // stencil settings to use when clip is in stencil + // NOTE: This is thread-safe on Windows because the implementation of + // GR_STATIC_CONST_SAME_STENCIL simply updates a pointer to an already + // constructed constant structure. + GR_STATIC_CONST_SAME_STENCIL(sClipStencilSettings, + kKeep_StencilOp, + kKeep_StencilOp, + kAlwaysIfInClip_StencilFunc, + 0x0000, + 0x0000, + 0x0000); + return &sClipStencilSettings; +} // mapping of clip-respecting stencil funcs to normal stencil funcs // mapping depends on whether stencil-clipping is in effect. diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h index e617efb8e4..37d1fcf9b5 100644 --- a/src/gpu/GrGpu.h +++ b/src/gpu/GrGpu.h @@ -355,7 +355,7 @@ protected: // stencil settings to clip drawing when stencil clipping is in effect // and the client isn't using the stencil test. - static const GrStencilSettings& gClipStencilSettings; + static const GrStencilSettings* GetClipStencilSettings(void); GrGpuStats fStats; diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp index 70d28d6785..df578c9206 100644 --- a/src/gpu/GrGpuGL.cpp +++ b/src/gpu/GrGpuGL.cpp @@ -1776,7 +1776,7 @@ void GrGpuGL::flushStencil() { if (settings->isDisabled()) { if (stencilClip) { - settings = &gClipStencilSettings; + settings = GetClipStencilSettings(); } } |