aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPaint.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-08-10 12:46:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-10 17:56:45 +0000
commitb74ef035a42af8acf028abd129cb59862cb15c46 (patch)
tree97fb33acaf4a60747675a8084ab027dd61bf8f05 /src/gpu/GrPaint.cpp
parent92e6cc6b2d42f3826b36bd24da7dd3fe8443b114 (diff)
Hide GrPaint copy constructor and add GrPaint::Clone and remove MoveOrNew and MoveOrCopy.
Also makes paint clones use cloned fragment processors. Change-Id: I60efcfc6a46a4f8430a72f4d1ec79c7d99fbe593 Reviewed-on: https://skia-review.googlesource.com/33084 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrPaint.cpp')
-rw-r--r--src/gpu/GrPaint.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp
index d9182d2704..139a2cc89a 100644
--- a/src/gpu/GrPaint.cpp
+++ b/src/gpu/GrPaint.cpp
@@ -11,6 +11,24 @@
#include "effects/GrPorterDuffXferProcessor.h"
#include "effects/GrSimpleTextureEffect.h"
+GrPaint::GrPaint(const GrPaint& that)
+ : fXPFactory(that.fXPFactory)
+ , fColorFragmentProcessors(that.fColorFragmentProcessors.count())
+ , fCoverageFragmentProcessors(that.fCoverageFragmentProcessors.count())
+ , fDisableOutputConversionToSRGB(that.fDisableOutputConversionToSRGB)
+ , fAllowSRGBInputs(that.fAllowSRGBInputs)
+ , fTrivial(that.fTrivial)
+ , fColor(that.fColor) {
+ for (int i = 0; i < that.fColorFragmentProcessors.count(); ++i) {
+ fColorFragmentProcessors.push_back(that.fColorFragmentProcessors[i]->clone());
+ SkASSERT(fColorFragmentProcessors[i]);
+ }
+ for (int i = 0; i < that.fCoverageFragmentProcessors.count(); ++i) {
+ fCoverageFragmentProcessors.push_back(that.fCoverageFragmentProcessors[i]->clone());
+ SkASSERT(fCoverageFragmentProcessors[i]);
+ }
+}
+
void GrPaint::setPorterDuffXPFactory(SkBlendMode mode) {
this->setXPFactory(GrPorterDuffXPFactory::Get(mode));
}