aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-16 17:50:37 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-16 17:50:37 +0000
commitdddf6f6363c39d7bd9bfd15a273f717b34e461b4 (patch)
tree61daec988ce3d5047e1b1e592f386f9359e71f83 /include
parentf97ef2f98ec77da807483715d3c6dc36e12d9c80 (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/gpu/GrPaint.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 827b89024f..62ab164275 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -131,20 +131,26 @@ public:
fColorFilterColor = paint.fColorFilterColor;
fColorFilterXfermode = paint.fColorFilterXfermode;
- memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix));
fColorMatrixEnabled = paint.fColorMatrixEnabled;
-
+ if (fColorMatrixEnabled) {
+ memcpy(fColorMatrix, paint.fColorMatrix, sizeof(fColorMatrix));
+ }
+
for (int i = 0; i < kMaxTextures; ++i) {
GrSafeUnref(fTextures[i]);
- fTextureSamplers[i] = paint.fTextureSamplers[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) {
GrSafeUnref(fMaskTextures[i]);
- fMaskSamplers[i] = paint.fMaskSamplers[i];
fMaskTextures[i] = paint.fMaskTextures[i];
- GrSafeRef(fMaskTextures[i]);
+ if (NULL != fMaskTextures[i]) {
+ fMaskSamplers[i] = paint.fMaskSamplers[i];
+ fMaskTextures[i]->ref();
+ }
}
return *this;
}