Switch sRGB color filter to use GrColorSpaceXformEffect
Guarded for chrome layout tests, then the GrSRGBEffect code can be deleted. Change-Id: Ib04efe79e39a353803e3f8361770f6180f392ab6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278859 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
9a378addaf
commit
6beb1dd941
@ -20,6 +20,7 @@
|
||||
#include "src/core/SkWriteBuffer.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "src/gpu/GrColorSpaceXform.h"
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
#include "src/gpu/effects/generated/GrMixerEffect.h"
|
||||
#endif
|
||||
@ -222,6 +223,7 @@ public:
|
||||
std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(GrRecordingContext*,
|
||||
const GrColorInfo&) const override {
|
||||
// wish our caller would let us know if our input was opaque...
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
GrSRGBEffect::Alpha alpha = GrSRGBEffect::Alpha::kPremul;
|
||||
switch (fDir) {
|
||||
case Direction::kLinearToSRGB:
|
||||
@ -229,6 +231,17 @@ public:
|
||||
case Direction::kSRGBToLinear:
|
||||
return GrSRGBEffect::Make(GrSRGBEffect::Mode::kSRGBToLinear, alpha);
|
||||
}
|
||||
#else
|
||||
SkAlphaType at = kPremul_SkAlphaType;
|
||||
switch (fDir) {
|
||||
case Direction::kLinearToSRGB:
|
||||
return GrColorSpaceXformEffect::Make(sk_srgb_linear_singleton(), at,
|
||||
sk_srgb_singleton(), at);
|
||||
case Direction::kSRGBToLinear:
|
||||
return GrColorSpaceXformEffect::Make(sk_srgb_singleton(), at,
|
||||
sk_srgb_linear_singleton(), at);
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
@ -81,7 +81,12 @@ SkTArray<GrXPFactoryTestFactory*, true>* GrXPFactoryTestFactory::GetFactories()
|
||||
* we verify the count is as expected. If a new factory is added, then these numbers must be
|
||||
* manually adjusted.
|
||||
*/
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
static const int kFPFactoryCount = 36;
|
||||
#else
|
||||
static const int kFPFactoryCount = 35;
|
||||
#endif
|
||||
|
||||
static const int kGPFactoryCount = 14;
|
||||
static const int kXPFactoryCount = 4;
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "src/gpu/glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
|
||||
class GrGLSRGBEffect : public GrGLSLFragmentProcessor {
|
||||
public:
|
||||
void emitCode(EmitArgs& args) override {
|
||||
@ -134,3 +136,4 @@ GrGLSLFragmentProcessor* GrSRGBEffect::onCreateGLSLInstance() const {
|
||||
return new GrGLSRGBEffect;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#include "src/gpu/GrFragmentProcessor.h"
|
||||
|
||||
#if defined(SK_USE_LEGACY_SRGB_COLOR_FILTER)
|
||||
|
||||
class GrSRGBEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
enum class Mode {
|
||||
@ -54,3 +56,5 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user