tomhudson@google.com | d0c1a06 | 2012-07-12 17:23:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "effects/GrSingleTextureEffect.h" |
tomhudson@google.com | aa72eab | 2012-07-19 18:01:07 +0000 | [diff] [blame] | 9 | |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 10 | #include "GrContext.h" |
| 11 | #include "GrTextureProxy.h" |
| 12 | |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 13 | GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, |
brianosman | 54f30c1 | 2016-07-18 10:53:52 -0700 | [diff] [blame] | 14 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 15 | const SkMatrix& m, OptimizationFlags optFlags) |
| 16 | : INHERITED(optFlags) |
| 17 | , fCoordTransform(m, texture, GrSamplerParams::kNone_FilterMode) |
| 18 | , fTextureSampler(texture) |
| 19 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 20 | this->addCoordTransform(&fCoordTransform); |
| 21 | this->addTextureSampler(&fTextureSampler); |
| 22 | } |
| 23 | |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 24 | GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 25 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
| 26 | const SkMatrix& m, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 27 | GrSamplerParams::FilterMode filterMode, |
| 28 | OptimizationFlags optFlags) |
| 29 | : INHERITED(optFlags) |
| 30 | , fCoordTransform(m, texture, filterMode) |
| 31 | , fTextureSampler(texture, filterMode) |
| 32 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 33 | this->addCoordTransform(&fCoordTransform); |
| 34 | this->addTextureSampler(&fTextureSampler); |
| 35 | } |
| 36 | |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 37 | GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture, |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 38 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 39 | const SkMatrix& m, const GrSamplerParams& params, |
| 40 | OptimizationFlags optFlags) |
| 41 | : INHERITED(optFlags) |
| 42 | , fCoordTransform(m, texture, params.filterMode()) |
| 43 | , fTextureSampler(texture, params) |
| 44 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Robert Phillips | 901f29a | 2017-01-24 16:24:41 -0500 | [diff] [blame] | 45 | this->addCoordTransform(&fCoordTransform); |
| 46 | this->addTextureSampler(&fTextureSampler); |
| 47 | } |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 48 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 49 | GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags, |
| 50 | sk_sp<GrTextureProxy> proxy, |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 51 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
| 52 | const SkMatrix& m) |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 53 | : INHERITED(optFlags) |
| 54 | , fCoordTransform(ctx, m, proxy.get(), GrSamplerParams::kNone_FilterMode) |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame^] | 55 | , fTextureSampler(ctx->resourceProvider(), std::move(proxy)) |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 56 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 57 | this->addCoordTransform(&fCoordTransform); |
| 58 | this->addTextureSampler(&fTextureSampler); |
| 59 | } |
| 60 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 61 | GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags, |
| 62 | sk_sp<GrTextureProxy> proxy, |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 63 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
| 64 | const SkMatrix& m, |
| 65 | GrSamplerParams::FilterMode filterMode) |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 66 | : INHERITED(optFlags) |
| 67 | , fCoordTransform(ctx, m, proxy.get(), filterMode) |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame^] | 68 | , fTextureSampler(ctx->resourceProvider(), std::move(proxy), filterMode) |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 69 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 70 | this->addCoordTransform(&fCoordTransform); |
| 71 | this->addTextureSampler(&fTextureSampler); |
| 72 | } |
| 73 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 74 | GrSingleTextureEffect::GrSingleTextureEffect(GrContext* ctx, OptimizationFlags optFlags, |
| 75 | sk_sp<GrTextureProxy> proxy, |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 76 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 77 | const SkMatrix& m, const GrSamplerParams& params) |
| 78 | : INHERITED(optFlags) |
| 79 | , fCoordTransform(ctx, m, proxy.get(), params.filterMode()) |
Brian Osman | 32342f0 | 2017-03-04 08:12:46 -0500 | [diff] [blame^] | 80 | , fTextureSampler(ctx->resourceProvider(), std::move(proxy), params) |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 81 | , fColorSpaceXform(std::move(colorSpaceXform)) { |
Ethan Nicholas | 052fd51 | 2017-01-27 15:34:34 +0000 | [diff] [blame] | 82 | this->addCoordTransform(&fCoordTransform); |
| 83 | this->addTextureSampler(&fTextureSampler); |
| 84 | } |