diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2017-07-12 13:51:34 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-12 13:51:46 +0000 |
commit | baf981f71614e7a2fbe6af2726e65126d431ed8e (patch) | |
tree | 1efed95d65f841bbbe8006165f37d9f03a0c0972 /src/gpu/effects/GrSimpleTextureEffect.h | |
parent | 46b654df9e70bbfacf6dc45d3a2a7ceb13a61edb (diff) |
Revert "converted GrSimpleTextureEffect to sksl"
This reverts commit 46b654df9e70bbfacf6dc45d3a2a7ceb13a61edb.
Reason for revert: making Vulkan mad
Original change's description:
> converted GrSimpleTextureEffect to sksl
>
> Bug: skia:
> Change-Id: If556c6baad75f22135f429759feabaaec095b900
> Reviewed-on: https://skia-review.googlesource.com/21720
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,ethannicholas@google.com
Change-Id: I06fac3d106435e1d58e19cc54a919c5d84784d92
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/22266
Reviewed-by: Ethan Nicholas <ethannicholas@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, 46 insertions, 51 deletions
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h index aed91d7c10..5013e3dce8 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.h +++ b/src/gpu/effects/GrSimpleTextureEffect.h @@ -1,82 +1,77 @@ /* - * Copyright 2017 Google Inc. + * Copyright 2013 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 "SkTypes.h" -#if SK_SUPPORT_GPU -#include "GrFragmentProcessor.h" -#include "GrCoordTransform.h" -#include "GrColorSpaceXform.h" -#include "effects/GrProxyMove.h" -class GrSimpleTextureEffect : public GrFragmentProcessor { -public: - sk_sp<GrColorSpaceXform> colorXform() const { return fColorXform; } - SkMatrix44 matrix() const { return fMatrix; } +#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 { +public: + /* unfiltered, clamp mode */ 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(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode))); + new GrSimpleTextureEffect(std::move(proxy), + std::move(colorSpaceXform), matrix, + 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, - GrSamplerParams(SkShader::kClamp_TileMode, filterMode))); - } + new GrSimpleTextureEffect(std::move(proxy), + std::move(colorSpaceXform), + matrix, 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)); } - const char* name() const override { return "SimpleTextureEffect"; } + + ~GrSimpleTextureEffect() override {} + + const char* name() const override { return "SimpleTexture"; } + private: - 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>(); - } + GrSimpleTextureEffect(sk_sp<GrTextureProxy>, + sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, + GrSamplerParams::FilterMode); + + GrSimpleTextureEffect(sk_sp<GrTextureProxy>, + sk_sp<GrColorSpaceXform>, const SkMatrix& matrix, + const GrSamplerParams&); + GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; - void onGetGLSLProcessorKey(const GrShaderCaps&,GrProcessorKeyBuilder*) const override; - bool onIsEqual(const GrFragmentProcessor&) const override; + + void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override; + + bool onIsEqual(const GrFragmentProcessor& other) const override { return true; } + GR_DECLARE_FRAGMENT_PROCESSOR_TEST - TextureSampler fImage; - sk_sp<GrColorSpaceXform> fColorXform; - SkMatrix44 fMatrix; - GrCoordTransform fImageCoordTransform; - typedef GrFragmentProcessor INHERITED; + + typedef GrSingleTextureEffect INHERITED; }; -#endif + #endif |