aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/ir/SkSLSwizzle.h
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2018-06-18 14:14:13 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-18 18:40:58 +0000
commitdfbfc738a9edfff7a9804253175e380c230f3d21 (patch)
tree974f1093a905e07601ffff34d04d2e8ed70e6fc4 /src/sksl/ir/SkSLSwizzle.h
parentb831ea22960c684b65f8ead76efe24059d119086 (diff)
added GrSkSLFP and converted DitherEffect to use it
Bug: skia: Change-Id: I84b71165eab1712355f3c7669cee2d33d259f3df Reviewed-on: https://skia-review.googlesource.com/124504 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/sksl/ir/SkSLSwizzle.h')
-rw-r--r--src/sksl/ir/SkSLSwizzle.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sksl/ir/SkSLSwizzle.h b/src/sksl/ir/SkSLSwizzle.h
index b90b78d916..6ed29cfcc0 100644
--- a/src/sksl/ir/SkSLSwizzle.h
+++ b/src/sksl/ir/SkSLSwizzle.h
@@ -115,6 +115,10 @@ struct Swizzle : public Expression {
return fBase->hasSideEffects();
}
+ std::unique_ptr<Expression> clone() const override {
+ return std::unique_ptr<Expression>(new Swizzle(fType, fBase->clone(), fComponents));
+ }
+
String description() const override {
String result = fBase->description() + ".";
for (int x : fComponents) {
@@ -127,6 +131,16 @@ struct Swizzle : public Expression {
const std::vector<int> fComponents;
typedef Expression INHERITED;
+
+private:
+ Swizzle(const Type& type, std::unique_ptr<Expression> base, std::vector<int> components)
+ : INHERITED(base->fOffset, kSwizzle_Kind, type)
+ , fBase(std::move(base))
+ , fComponents(std::move(components)) {
+ SkASSERT(fComponents.size() >= 1 && fComponents.size() <= 4);
+ }
+
+
};
} // namespace