Use element-by-element assignment in GrSamplerState::operator= instead of memcpy

so that we can handle refcounting correctly.

http://codereview.appspot.com/6262049/



git-svn-id: http://skia.googlecode.com/svn/trunk@4092 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
tomhudson@google.com 2012-05-31 14:23:28 +00:00
parent 9aabfc789e
commit 111755936d

View File

@ -140,7 +140,28 @@ public:
bool operator !=(const GrSamplerState& s) const { return !(*this == s); }
GrSamplerState& operator =(const GrSamplerState s) {
memcpy(this, &s, sizeof(GrSamplerState));
// memcpy() breaks refcounting
fWrapX = s.fWrapX;
fWrapY = s.fWrapY;
fFilterDirection = s.fFilterDirection;
fSampleMode = s.fSampleMode;
fFilter = s.fFilter;
fMatrix = s.fMatrix;
fSwapRAndB = s.fSwapRAndB;
fTextureDomain = s.fTextureDomain;
fRadial2CenterX1 = s.fRadial2CenterX1;
fRadial2Radius0 = s.fRadial2Radius0;
fRadial2PosRoot = s.fRadial2PosRoot;
fKernelWidth = s.fKernelWidth;
if (kConvolution_Filter == kFilter) {
memcpy(fKernel, s.fKernel, MAX_KERNEL_WIDTH * sizeof(float));
}
fCustomStage = s.fCustomStage;
SkSafeRef(fCustomStage);
return *this;
}