diff options
author | bsalomon <bsalomon@google.com> | 2016-02-01 12:09:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-01 12:09:07 -0800 |
commit | 8610002ff81fb5d81d1b7c312b5d0a8b05b41e13 (patch) | |
tree | 62e033879e0547c06741d3b67a9b67de5aa7f2f0 /src/core/SkColorMatrixFilterRowMajor255.h | |
parent | 3b7af78e813d182d61483fbfc317f26507adf778 (diff) |
Move SkColorMatrixFilter implementation to core.
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1648933002
Review URL: https://codereview.chromium.org/1648933002
Diffstat (limited to 'src/core/SkColorMatrixFilterRowMajor255.h')
-rw-r--r-- | src/core/SkColorMatrixFilterRowMajor255.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/core/SkColorMatrixFilterRowMajor255.h b/src/core/SkColorMatrixFilterRowMajor255.h new file mode 100644 index 0000000000..453dd41bff --- /dev/null +++ b/src/core/SkColorMatrixFilterRowMajor255.h @@ -0,0 +1,44 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkColorMatrixFilter_DEFINED +#define SkColorMatrixFilter_DEFINED + +#include "SkColorFilter.h" + +class SK_API SkColorMatrixFilterRowMajor255 : public SkColorFilter { +public: + explicit SkColorMatrixFilterRowMajor255(const SkScalar array[20]); + + void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const override; + void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override; + uint32_t getFlags() const override; + bool asColorMatrix(SkScalar matrix[20]) const override; + SkColorFilter* newComposed(const SkColorFilter*) const override; + +#if SK_SUPPORT_GPU + const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; +#endif + + SK_TO_STRING_OVERRIDE() + + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter) + +protected: + void flatten(SkWriteBuffer&) const override; + +private: + SkScalar fMatrix[20]; + float fTranspose[20]; // for Sk4s + uint32_t fFlags; + + void initState(const SkScalar array[20]); + + typedef SkColorFilter INHERITED; +}; + +#endif |