diff options
author | Brian Osman <brianosman@google.com> | 2017-07-25 09:59:24 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-25 14:27:33 +0000 |
commit | 10b6ad13f996d2f522bc057d17acea58e43a7f0b (patch) | |
tree | 2e0e4315e9bceca5f259f033b9c7fdf1490d3343 /include/effects | |
parent | 6af2a668f4343bc0db87d27d28b0edc60f5cd6b9 (diff) |
sRGB color filter
Bug: skia:
Change-Id: I9f04b8ce778349218ccd55673bdd1d16a192383c
Reviewed-on: https://skia-review.googlesource.com/26422
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'include/effects')
-rw-r--r-- | include/effects/SkToSRGBColorFilter.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/effects/SkToSRGBColorFilter.h b/include/effects/SkToSRGBColorFilter.h new file mode 100644 index 0000000000..c4d51446ef --- /dev/null +++ b/include/effects/SkToSRGBColorFilter.h @@ -0,0 +1,42 @@ +/* + * Copyright 2017 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef SkToSRGBColorFilter_DEFINED +#define SkToSRGBColorFilter_DEFINED + +#include "SkColorFilter.h" +#include "SkRefCnt.h" + +class SkColorSpace; +class SkRasterPipeline; + +/** + * Color filter that converts from supplied color space to sRGB (both gamut and transfer function). + */ +class SK_API SkToSRGBColorFilter : public SkColorFilter { +public: + static sk_sp<SkColorFilter> Make(sk_sp<SkColorSpace> srcColorSpace); + +#if SK_SUPPORT_GPU + sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*, SkColorSpace*) const override; +#endif + + SK_TO_STRING_OVERRIDE() + SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkToSRGBColorFilter) + +private: + void flatten(SkWriteBuffer&) const override; + SkToSRGBColorFilter(sk_sp<SkColorSpace>); + void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*, + bool shaderIsOpaque) const override; + + sk_sp<SkColorSpace> fSrcColorSpace; + + typedef SkColorFilter INHERITED; +}; + +#endif |