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

Side by Side Diff: src/gpu/effects/GrTextureDomain.cpp

Issue 1320433002: Fix for MSAN unintialized value (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 break; 139 break;
140 } 140 }
141 } 141 }
142 } 142 }
143 143
144 void GrTextureDomain::GLDomain::setData(const GrGLProgramDataManager& pdman, 144 void GrTextureDomain::GLDomain::setData(const GrGLProgramDataManager& pdman,
145 const GrTextureDomain& textureDomain, 145 const GrTextureDomain& textureDomain,
146 GrSurfaceOrigin textureOrigin) { 146 GrSurfaceOrigin textureOrigin) {
147 SkASSERT(textureDomain.mode() == fMode); 147 SkASSERT(textureDomain.mode() == fMode);
148 if (kIgnore_Mode != textureDomain.mode()) { 148 if (kIgnore_Mode != textureDomain.mode()) {
149 GrGLfloat values[4] = { 149 GrGLfloat values[kPrevDomainCount] = {
150 SkScalarToFloat(textureDomain.domain().left()), 150 SkScalarToFloat(textureDomain.domain().left()),
151 SkScalarToFloat(textureDomain.domain().top()), 151 SkScalarToFloat(textureDomain.domain().top()),
152 SkScalarToFloat(textureDomain.domain().right()), 152 SkScalarToFloat(textureDomain.domain().right()),
153 SkScalarToFloat(textureDomain.domain().bottom()) 153 SkScalarToFloat(textureDomain.domain().bottom())
154 }; 154 };
155 // vertical flip if necessary 155 // vertical flip if necessary
156 if (kBottomLeft_GrSurfaceOrigin == textureOrigin) { 156 if (kBottomLeft_GrSurfaceOrigin == textureOrigin) {
157 values[1] = 1.0f - values[1]; 157 values[1] = 1.0f - values[1];
158 values[3] = 1.0f - values[3]; 158 values[3] = 1.0f - values[3];
159 // The top and bottom were just flipped, so correct the ordering 159 // The top and bottom were just flipped, so correct the ordering
160 // of elements so that values = (l, t, r, b). 160 // of elements so that values = (l, t, r, b).
161 SkTSwap(values[1], values[3]); 161 SkTSwap(values[1], values[3]);
162 } 162 }
163 if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) { 163 if (0 != memcmp(values, fPrevDomain, kPrevDomainCount * sizeof(GrGLfloat ))) {
164 pdman.set4fv(fDomainUni, 1, values); 164 pdman.set4fv(fDomainUni, 1, values);
165 memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat)); 165 memcpy(fPrevDomain, values, kPrevDomainCount * sizeof(GrGLfloat));
166 } 166 }
167 } 167 }
168 } 168 }
169 169
170 170
171 ////////////////////////////////////////////////////////////////////////////// 171 //////////////////////////////////////////////////////////////////////////////
172 172
173 class GrGLTextureDomainEffect : public GrGLFragmentProcessor { 173 class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
174 public: 174 public:
175 GrGLTextureDomainEffect(const GrProcessor&); 175 GrGLTextureDomainEffect(const GrProcessor&);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 300 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
301 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 301 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
302 return GrTextureDomainEffect::Create(d->fProcDataManager, 302 return GrTextureDomainEffect::Create(d->fProcDataManager,
303 d->fTextures[texIdx], 303 d->fTextures[texIdx],
304 matrix, 304 matrix,
305 domain, 305 domain,
306 mode, 306 mode,
307 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 307 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
308 coords); 308 coords);
309 } 309 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698