diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gpu/GrPaint.h | 18 |
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; } |