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

Unified Diff: src/core/SkXfermode_proccoeff.h

Issue 23644006: ARM Skia NEON patches - 28 - Xfermode: SIMD modeprocs (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix android build + implement serialization Created 7 years, 2 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 | « src/core/SkXfermode.cpp ('k') | src/opts/SkXfermode_opts_arm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermode_proccoeff.h
diff --git a/src/core/SkXfermode_proccoeff.h b/src/core/SkXfermode_proccoeff.h
new file mode 100644
index 0000000000000000000000000000000000000000..60ebe3ff4c07ed6bd93e2d7ee59c374bd9434de3
--- /dev/null
+++ b/src/core/SkXfermode_proccoeff.h
@@ -0,0 +1,63 @@
+#ifndef SkXfermode_proccoeff_DEFINED
+#define SkXfermode_proccoeff_DEFINED
+
+#include "SkXfermode.h"
+#include "SkFlattenableBuffers.h"
+
+struct ProcCoeff {
+ SkXfermodeProc fProc;
+ SkXfermode::Coeff fSC;
+ SkXfermode::Coeff fDC;
+};
+
+#define CANNOT_USE_COEFF SkXfermode::Coeff(-1)
+
+extern const ProcCoeff gProcCoeffs[];
+
+class SkProcCoeffXfermode : public SkProcXfermode {
+public:
+ SkProcCoeffXfermode(const ProcCoeff& rec, Mode mode)
+ : INHERITED(rec.fProc) {
+ fMode = mode;
+ // these may be valid, or may be CANNOT_USE_COEFF
+ fSrcCoeff = rec.fSC;
+ fDstCoeff = rec.fDC;
+ }
+
+ virtual bool asMode(Mode* mode) const SK_OVERRIDE;
+
+ virtual bool asCoeff(Coeff* sc, Coeff* dc) const SK_OVERRIDE;
+
+#if SK_SUPPORT_GPU
+ virtual bool asNewEffectOrCoeff(GrContext*,
+ GrEffectRef** effect,
+ Coeff* src,
+ Coeff* dst,
+ GrTexture* background) const SK_OVERRIDE;
+#endif
+
+ SK_DEVELOPER_TO_STRING()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkProcCoeffXfermode)
+
+protected:
+ SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {
+ fMode = (SkXfermode::Mode)buffer.read32();
+
+ const ProcCoeff& rec = gProcCoeffs[fMode];
+ // these may be valid, or may be CANNOT_USE_COEFF
+ fSrcCoeff = rec.fSC;
+ fDstCoeff = rec.fDC;
+ // now update our function-ptr in the super class
+ this->INHERITED::setProc(rec.fProc);
+ }
+
+ virtual void flatten(SkFlattenableWriteBuffer& buffer) const SK_OVERRIDE;
+
+private:
+ Mode fMode;
+ Coeff fSrcCoeff, fDstCoeff;
+
+ typedef SkProcXfermode INHERITED;
+};
+
+#endif // #ifndef SkXfermode_proccoeff_DEFINED
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/opts/SkXfermode_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698