Skip unnecessary copies in GrPaint operator ==

Review URL: http://codereview.appspot.com/5846046/



git-svn-id: http://skia.googlecode.com/svn/trunk@3417 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2012-03-16 17:50:37 +00:00
parent f97ef2f98e
commit dddf6f6363

View File

@ -131,20 +131,26 @@ public:
fColorFilterColor = paint.fColorFilterColor; fColorFilterColor = paint.fColorFilterColor;
fColorFilterXfermode = paint.fColorFilterXfermode; fColorFilterXfermode = paint.fColorFilterXfermode;
memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix));
fColorMatrixEnabled = paint.fColorMatrixEnabled; fColorMatrixEnabled = paint.fColorMatrixEnabled;
if (fColorMatrixEnabled) {
memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix));
}
for (int i = 0; i < kMaxTextures; ++i) { for (int i = 0; i < kMaxTextures; ++i) {
GrSafeUnref(fTextures[i]); GrSafeUnref(fTextures[i]);
fTextureSamplers[i] = paint.fTextureSamplers[i];
fTextures[i] = paint.fTextures[i]; fTextures[i] = paint.fTextures[i];
GrSafeRef(fTextures[i]); if (NULL != fTextures[i]) {
fTextureSamplers[i] = paint.fTextureSamplers[i];
fTextures[i]->ref();
}
} }
for (int i = 0; i < kMaxMasks; ++i) { for (int i = 0; i < kMaxMasks; ++i) {
GrSafeUnref(fMaskTextures[i]); GrSafeUnref(fMaskTextures[i]);
fMaskSamplers[i] = paint.fMaskSamplers[i];
fMaskTextures[i] = paint.fMaskTextures[i]; fMaskTextures[i] = paint.fMaskTextures[i];
GrSafeRef(fMaskTextures[i]); if (NULL != fMaskTextures[i]) {
fMaskSamplers[i] = paint.fMaskSamplers[i];
fMaskTextures[i]->ref();
}
} }
return *this; return *this;
} }