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()),
// 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));
}
}
}
class GLDomain {
public:
GLDomain() {
- fPrevDomain[0] = SK_FloatNaN;
+ for (int i = 0; i < kPrevDomainCount; i++) {
+ fPrevDomain[i] = SK_FloatNaN;
+ }
SkDEBUGCODE(fMode = (Mode) -1;)
}
}
private:
+ static const int kPrevDomainCount = 4;
SkDEBUGCODE(Mode fMode;)
GrGLProgramDataManager::UniformHandle fDomainUni;
SkString fDomainName;
- GrGLfloat fPrevDomain[4];
+ GrGLfloat fPrevDomain[kPrevDomainCount];
};
protected: