aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-08-25 12:10:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-25 12:10:54 -0700
commitb5fb5af5734dcc31a5e29212db39f0da71f92f2d (patch)
treeb85a6fcf643f90aa117d74f4537b23b5521c02c3
parentafd7c749724ccceb88761c52c196ba371be5fb1c (diff)
Fix for MSAN unintialized value
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp6
-rw-r--r--src/gpu/effects/GrTextureDomain.h7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 3810c3482f..e5ae18c961 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -146,7 +146,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLProgramDataManager& pdman,
GrSurfaceOrigin textureOrigin) {
SkASSERT(textureDomain.mode() == fMode);
if (kIgnore_Mode != textureDomain.mode()) {
- GrGLfloat values[4] = {
+ GrGLfloat values[kPrevDomainCount] = {
SkScalarToFloat(textureDomain.domain().left()),
SkScalarToFloat(textureDomain.domain().top()),
SkScalarToFloat(textureDomain.domain().right()),
@@ -160,9 +160,9 @@ void GrTextureDomain::GLDomain::setData(const GrGLProgramDataManager& pdman,
// of elements so that values = (l, t, r, b).
SkTSwap(values[1], values[3]);
}
- if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) {
+ if (0 != memcmp(values, fPrevDomain, kPrevDomainCount * sizeof(GrGLfloat))) {
pdman.set4fv(fDomainUni, 1, values);
- memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat));
+ memcpy(fPrevDomain, values, kPrevDomainCount * sizeof(GrGLfloat));
}
}
}
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index a2e6652e91..11760fb62b 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -95,7 +95,9 @@ public:
class GLDomain {
public:
GLDomain() {
- fPrevDomain[0] = SK_FloatNaN;
+ for (int i = 0; i < kPrevDomainCount; i++) {
+ fPrevDomain[i] = SK_FloatNaN;
+ }
SkDEBUGCODE(fMode = (Mode) -1;)
}
@@ -137,10 +139,11 @@ public:
}
private:
+ static const int kPrevDomainCount = 4;
SkDEBUGCODE(Mode fMode;)
GrGLProgramDataManager::UniformHandle fDomainUni;
SkString fDomainName;
- GrGLfloat fPrevDomain[4];
+ GrGLfloat fPrevDomain[kPrevDomainCount];
};
protected: