diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-19 20:10:37 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-19 20:10:46 +0000 |
commit | 6c48e4d11ce80fa5cfef56e13b2d5847fe94a7cc (patch) | |
tree | 57e5d832d16aa9a0447e5102fe9811e39f8403d9 /src/gpu/effects/GrDitherEffect.h | |
parent | 736db1081b378ac8c167dfbc0322470d28c1cb3e (diff) |
Reland "Revert "added GrSkSLFP and converted DitherEffect to use it""
This reverts commit 97ae0c89025dfd791047f5701e57d58da37c125c.
Reason for revert: Breaking ANGLE.
Original change's description:
> Revert "Revert "added GrSkSLFP and converted DitherEffect to use it""
>
> This reverts commit f2030783094e502fb74221077a5ee7cb41287fe4.
>
> Bug: skia:
> Change-Id: Icaaa8b3ea652a8f126bfbcc788a360493a7ebe3e
> Reviewed-on: https://skia-review.googlesource.com/137391
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,robertphillips@google.com,ethannicholas@google.com
Change-Id: I65d6d2707fceab0a99121c528d1b848d23e34bfa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/142588
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/effects/GrDitherEffect.h')
-rw-r--r-- | src/gpu/effects/GrDitherEffect.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h new file mode 100644 index 0000000000..70adc45e6a --- /dev/null +++ b/src/gpu/effects/GrDitherEffect.h @@ -0,0 +1,67 @@ +/* + * Copyright 2018 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/************************************************************************************************** + *** This file was autogenerated from GrDitherEffect.fp; do not modify. + **************************************************************************************************/ +#ifndef GrDitherEffect_DEFINED +#define GrDitherEffect_DEFINED +#include "SkTypes.h" +#include "GrFragmentProcessor.h" +#include "GrCoordTransform.h" +class GrDitherEffect : public GrFragmentProcessor { +public: + int rangeType() const { return fRangeType; } + + static std::unique_ptr<GrFragmentProcessor> Make(GrPixelConfig dstConfig) { + int rangeType; + switch (dstConfig) { + case kGray_8_GrPixelConfig: + case kGray_8_as_Lum_GrPixelConfig: + case kGray_8_as_Red_GrPixelConfig: + case kRGBA_8888_GrPixelConfig: + case kRGB_888_GrPixelConfig: + case kBGRA_8888_GrPixelConfig: + rangeType = 0; + break; + case kRGB_565_GrPixelConfig: + rangeType = 1; + break; + case kRGBA_4444_GrPixelConfig: + rangeType = 2; + break; + case kUnknown_GrPixelConfig: + case kSRGBA_8888_GrPixelConfig: + case kSBGRA_8888_GrPixelConfig: + case kRGBA_1010102_GrPixelConfig: + case kAlpha_half_GrPixelConfig: + case kAlpha_half_as_Red_GrPixelConfig: + case kRGBA_float_GrPixelConfig: + case kRG_float_GrPixelConfig: + case kRGBA_half_GrPixelConfig: + case kAlpha_8_GrPixelConfig: + case kAlpha_8_as_Alpha_GrPixelConfig: + case kAlpha_8_as_Red_GrPixelConfig: + return nullptr; + } + return std::unique_ptr<GrFragmentProcessor>(new GrDitherEffect(rangeType)); + } + GrDitherEffect(const GrDitherEffect& src); + std::unique_ptr<GrFragmentProcessor> clone() const override; + const char* name() const override { return "DitherEffect"; } + +private: + GrDitherEffect(int rangeType) + : INHERITED(kGrDitherEffect_ClassID, kNone_OptimizationFlags), fRangeType(rangeType) {} + GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; + bool onIsEqual(const GrFragmentProcessor&) const override; + GR_DECLARE_FRAGMENT_PROCESSOR_TEST + int fRangeType; + typedef GrFragmentProcessor INHERITED; +}; +#endif |