diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-31 14:23:28 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-31 14:23:28 +0000 |
commit | 111755936db2691ae0344a0a8700be3e36134c2a (patch) | |
tree | 0233bf4f44e94f83d0cb9d80c49d98828a4d5d23 /include/gpu/GrSamplerState.h | |
parent | 9aabfc789e410c2da9c34a38597338165398ce16 (diff) |
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
Diffstat (limited to 'include/gpu/GrSamplerState.h')
-rw-r--r-- | include/gpu/GrSamplerState.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/gpu/GrSamplerState.h b/include/gpu/GrSamplerState.h index a48150262a..618b0b165c 100644 --- a/include/gpu/GrSamplerState.h +++ b/include/gpu/GrSamplerState.h @@ -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; } |