Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: include/effects/SkModeColorFilter.h

Issue 970753002: add compose-colorfilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkColorFilter.h ('k') | src/core/SkColorFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkModeColorFilter.h
diff --git a/include/effects/SkModeColorFilter.h b/include/effects/SkModeColorFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..16c6e13359545af766839c4af90ae00a891d0fbc
--- /dev/null
+++ b/include/effects/SkModeColorFilter.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkModeColorFilter_DEFINED
+#define SkModeColorFilter_DEFINED
+
+#include "SkColorFilter.h"
+#include "SkColorPriv.h"
+#include "SkString.h"
+#include "SkXfermode.h"
+
+class SkModeColorFilter : public SkColorFilter {
+public:
+ SkModeColorFilter(SkColor color, SkXfermode::Mode mode) {
+ fColor = color;
+ fMode = mode;
+ this->updateCache();
+ };
+
+ SkColor getColor() const { return fColor; }
+ SkXfermode::Mode getMode() const { return fMode; }
+ SkPMColor getPMColor() const { return fPMColor; }
+
+ bool asColorMode(SkColor*, SkXfermode::Mode*) const SK_OVERRIDE;
+ uint32_t getFlags() const SK_OVERRIDE;
+ void filterSpan(const SkPMColor shader[], int count, SkPMColor result[]) const SK_OVERRIDE;
+ void filterSpan16(const uint16_t shader[], int count, uint16_t result[]) const SK_OVERRIDE;
+
+#ifndef SK_IGNORE_TO_STRING
+ void toString(SkString* str) const SK_OVERRIDE {
+ str->append("SkModeColorFilter: color: 0x");
+ str->appendHex(fColor);
+ str->append(" mode: ");
+ str->append(SkXfermode::ModeName(fMode));
+ }
+#endif
+
+#if SK_SUPPORT_GPU
+ GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE;
+#endif
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkModeColorFilter)
+
+protected:
+ void flatten(SkWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkColor fColor;
+ SkXfermode::Mode fMode;
+ // cache
+ SkPMColor fPMColor;
+ SkXfermodeProc fProc;
+ SkXfermodeProc16 fProc16;
+
+ void updateCache();
+
+ typedef SkColorFilter INHERITED;
+};
+
+#endif
« no previous file with comments | « include/core/SkColorFilter.h ('k') | src/core/SkColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698