From b74ef035a42af8acf028abd129cb59862cb15c46 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Thu, 10 Aug 2017 12:46:01 -0400 Subject: 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 Commit-Queue: Brian Salomon --- src/gpu/GrPaint.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gpu/GrPaint.cpp') 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)); } -- cgit v1.2.3