blob: 929275e3ad91a743b7787d1573cb57a4fbc404fa [file] [log] [blame]
tomhudson@google.comd0c1a062012-07-12 17:23:52 +00001/*
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.comaa72eab2012-07-19 18:01:07 +00009
bsalomon4a339522015-10-06 08:40:50 -070010GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
brianosman54f30c12016-07-18 10:53:52 -070011 sk_sp<GrColorSpaceXform> colorSpaceXform,
Brian Salomon2ebd0c82016-10-03 17:15:28 -040012 const SkMatrix& m)
13 : fCoordTransform(m, texture, GrTextureParams::kNone_FilterMode)
Brian Salomon0bbecb22016-11-17 11:38:22 -050014 , fTextureSampler(texture)
brianosman54f30c12016-07-18 10:53:52 -070015 , fColorSpaceXform(std::move(colorSpaceXform)) {
bsalomon@google.com77af6802013-10-02 13:04:56 +000016 this->addCoordTransform(&fCoordTransform);
Brian Salomon0bbecb22016-11-17 11:38:22 -050017 this->addTextureSampler(&fTextureSampler);
bsalomon@google.comae81d5c2013-03-20 17:32:27 +000018}
19
bsalomon4a339522015-10-06 08:40:50 -070020GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
brianosman54f30c12016-07-18 10:53:52 -070021 sk_sp<GrColorSpaceXform> colorSpaceXform,
bsalomon@google.comae81d5c2013-03-20 17:32:27 +000022 const SkMatrix& m,
Brian Salomon2ebd0c82016-10-03 17:15:28 -040023 GrTextureParams::FilterMode filterMode)
24 : fCoordTransform(m, texture, filterMode)
Brian Salomon0bbecb22016-11-17 11:38:22 -050025 , fTextureSampler(texture, filterMode)
brianosman54f30c12016-07-18 10:53:52 -070026 , fColorSpaceXform(std::move(colorSpaceXform)) {
bsalomon@google.com77af6802013-10-02 13:04:56 +000027 this->addCoordTransform(&fCoordTransform);
Brian Salomon0bbecb22016-11-17 11:38:22 -050028 this->addTextureSampler(&fTextureSampler);
bsalomon@google.comc7818882013-03-20 19:19:53 +000029}
30
bsalomon4a339522015-10-06 08:40:50 -070031GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
brianosman54f30c12016-07-18 10:53:52 -070032 sk_sp<GrColorSpaceXform> colorSpaceXform,
bsalomon@google.comc7818882013-03-20 19:19:53 +000033 const SkMatrix& m,
Brian Salomon2ebd0c82016-10-03 17:15:28 -040034 const GrTextureParams& params)
35 : fCoordTransform(m, texture, params.filterMode())
Brian Salomon0bbecb22016-11-17 11:38:22 -050036 , fTextureSampler(texture, params)
brianosman54f30c12016-07-18 10:53:52 -070037 , fColorSpaceXform(std::move(colorSpaceXform)) {
bsalomon@google.com77af6802013-10-02 13:04:56 +000038 this->addCoordTransform(&fCoordTransform);
Brian Salomon0bbecb22016-11-17 11:38:22 -050039 this->addTextureSampler(&fTextureSampler);
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000040}
41
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000042GrSingleTextureEffect::~GrSingleTextureEffect() {
tomhudson@google.comd0c1a062012-07-12 17:23:52 +000043}