From 2cdfade4e8c45abb5793c8547e86b4b93039732b Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Wed, 23 Nov 2011 16:53:42 +0000 Subject: [PATCH] Fix clang static analyzer errors in Gr Review URL: http://codereview.appspot.com/5433055/ git-svn-id: http://skia.googlecode.com/svn/trunk@2743 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/GrGpuGL.cpp | 9 +++++++-- src/gpu/GrGpuGLShaders.cpp | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gpu/GrGpuGL.cpp b/src/gpu/GrGpuGL.cpp index 093a53b14..7e9b10229 100644 --- a/src/gpu/GrGpuGL.cpp +++ b/src/gpu/GrGpuGL.cpp @@ -1763,8 +1763,13 @@ void GrGpuGL::flushStencil() { GrAssert(stencilBits || (GrStencilSettings::gDisabled == fCurrDrawState.fStencilSettings)); - GrGLuint clipStencilMask = 1 << (stencilBits - 1); - GrGLuint userStencilMask = clipStencilMask - 1; + + GrGLuint clipStencilMask = 0; + GrGLuint userStencilMask = ~0; + if (stencilBits > 0) { + clipStencilMask = 1 << (stencilBits - 1); + userStencilMask = clipStencilMask - 1; + } unsigned int frontRef = settings->fFrontFuncRef; unsigned int frontMask = settings->fFrontFuncMask; diff --git a/src/gpu/GrGpuGLShaders.cpp b/src/gpu/GrGpuGLShaders.cpp index bae699d6e..7b364e67f 100644 --- a/src/gpu/GrGpuGLShaders.cpp +++ b/src/gpu/GrGpuGLShaders.cpp @@ -546,7 +546,7 @@ void GrGpuGLShaders::flushRadial2(int s) { // down). float values[6] = { GrScalarToFloat(a), - 1 / (2.f * values[0]), + 1 / (2.f * GrScalarToFloat(a)), GrScalarToFloat(centerX1), GrScalarToFloat(radius0), GrScalarToFloat(GrMul(radius0, radius0)),