diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-07-13 09:36:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-13 14:07:02 +0000 |
commit | 68990be759f663bafdb7c1b746adce15557cda7f (patch) | |
tree | b982e218f45fa02188bb38fe767797ff6315edcf /src/gpu/effects/GrSimpleTextureEffect.h | |
parent | c20b5f83595073c02009ff3c0a8a77aca6ad1e71 (diff) |
Re-land of "converted GrSimpleTextureEffect to sksl"
This reverts commit baf981f71614e7a2fbe6af2726e65126d431ed8e.
Bug: skia:
Change-Id: I36f6bfb616f1ec2b89043e3a6f7cbdf473bc9588
Reviewed-on: https://skia-review.googlesource.com/22369
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/effects/GrSimpleTextureEffect.h')
-rw-r--r-- | src/gpu/effects/GrSimpleTextureEffect.h | 97 |
1 files changed, 51 insertions, 46 deletions
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index 5013e3dce8..aed91d7c10 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -1,77 +1,82 @@ /* - * Copyright 2013 Google Inc. + * Copyright 2017 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 GrSimpleTextureEffect.fp; do not modify. + */ #ifndef GrSimpleTextureEffect_DEFINED #define GrSimpleTextureEffect_DEFINED - -#include "GrSingleTextureEffect.h" -#include "GrTextureProxy.h" - -class GrInvariantOutput; - -/** - * The output color of this effect is a modulation of the input color and a sample from a texture. - * It allows explicit specification of the filtering and wrap modes (GrSamplerParams) and accepts - * a matrix that is used to compute texture coordinates from local coordinates. - */ -class GrSimpleTextureEffect : public GrSingleTextureEffect { +#include "SkTypes.h" +#if SK_SUPPORT_GPU +#include "GrFragmentProcessor.h" +#include "GrCoordTransform.h" +#include "GrColorSpaceXform.h" +#include "effects/GrProxyMove.h" +class GrSimpleTextureEffect : public GrFragmentProcessor { public: - /* unfiltered, clamp mode */ + sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; } + SkMatrix44 matrix() const { return fMatrix; } + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix) { return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(std::move(proxy), - std::move(colorSpaceXform), matrix, - GrSamplerParams::kNone_FilterMode)); + new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, + GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode))); } - /* clamp mode */ + static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, GrSamplerParams::FilterMode filterMode) { return sk_sp<GrFragmentProcessor>( - new GrSimpleTextureEffect(std::move(proxy), - std::move(colorSpaceXform), - matrix, filterMode)); - } + new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, + GrSamplerParams(SkShader::kClamp_TileMode, filterMode))); + } static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy, sk_sp<GrColorSpaceXform> colorSpaceXform, const SkMatrix& matrix, const GrSamplerParams& p) { - return sk_sp<GrFragmentProcessor>(new GrSimpleTextureEffect(std::move(proxy), - std::move(colorSpaceXform), - matrix, p)); + return sk_sp<GrFragmentProcessor>( + new GrSimpleTextureEffect(std::move(proxy), std::move(colorSpaceXform), matrix, p)); } - - ~GrSimpleTextureEffect() override {} - - const char* name() const override { return "SimpleTexture"; } - + const char* name() const override { return "SimpleTextureEffect"; } private: - GrSimpleTextureEffect(sk_sp<GrTextureProxy>, - sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, - GrSamplerParams::FilterMode); - - GrSimpleTextureEffect(sk_sp<GrTextureProxy>, - sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, - const GrSamplerParams&); - + GrSimpleTextureEffect(sk_sp<GrTextureProxy> image, sk_sp<GrColorSpaceXform> colorXform, SkMatrix44 matrix, + GrSamplerParams samplerParams +) + : INHERITED((OptimizationFlags) + kCompatibleWithCoverageAsAlpha_OptimizationFlag | + (GrPixelConfigIsOpaque(image->config()) ? kPreservesOpaqueInput_OptimizationFlag : + kNone_OptimizationFlags) +) + , fImage(std::move(image), + samplerParams +) + , fColorXform(colorXform) + , fMatrix(matrix) + , fImageCoordTransform( + matrix +, fImage.proxy()) { + this->addTextureSampler(&fImage); + this->addCoordTransform(&fImageCoordTransform); + this->initClassID<GrSimpleTextureEffect>(); + } GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - - void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; - - bool onIsEqual(const GrFragmentProcessor& other) const override { return true; } - + void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) const override; + bool onIsEqual(const GrFragmentProcessor&) const override; GR_DECLARE_FRAGMENT_PROCESSOR_TEST - - typedef GrSingleTextureEffect INHERITED; + TextureSampler fImage; + sk_sp<GrColorSpaceXform> fColorXform; + SkMatrix44 fMatrix; + GrCoordTransform fImageCoordTransform; + typedef GrFragmentProcessor INHERITED; }; - +#endif #endif |