blob: 675bc207777b404e2682e91a5519899009560b7d [file] [log] [blame]
bsalomon@google.com047696c2012-09-11 13:29:29 +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 "GrTextureAccess.h"
bsalomon@google.comb8eb2e82013-03-28 13:46:42 +00009#include "GrColor.h"
bsalomon@google.com6d003d12012-09-11 15:45:20 +000010#include "GrTexture.h"
11
bsalomoncdee0092016-01-08 13:20:12 -080012GrTextureAccess::GrTextureAccess() {}
bsalomon@google.com047696c2012-09-11 13:29:29 +000013
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000014GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& params) {
15 this->reset(texture, params);
bsalomon@google.com6d003d12012-09-11 15:45:20 +000016}
17
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000018GrTextureAccess::GrTextureAccess(GrTexture* texture,
humper@google.comb86add12013-07-25 18:49:07 +000019 GrTextureParams::FilterMode filterMode,
cdalton9c3f1432016-03-11 10:07:37 -080020 SkShader::TileMode tileXAndY,
cdaltona6b92ad2016-04-11 12:03:08 -070021 GrShaderFlags visibility) {
22 this->reset(texture, filterMode, tileXAndY, visibility);
bsalomon@google.com6d003d12012-09-11 15:45:20 +000023}
24
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000025void GrTextureAccess::reset(GrTexture* texture,
cdalton9c3f1432016-03-11 10:07:37 -080026 const GrTextureParams& params,
cdaltona6b92ad2016-04-11 12:03:08 -070027 GrShaderFlags visibility) {
bsalomon49f085d2014-09-05 13:34:00 -070028 SkASSERT(texture);
bsalomonbcf0a522014-10-08 08:40:09 -070029 fTexture.set(SkRef(texture), kRead_GrIOType);
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000030 fParams = params;
cdalton9c3f1432016-03-11 10:07:37 -080031 fVisibility = visibility;
bsalomon@google.com1ce49fc2012-09-18 14:14:49 +000032}
33
34void GrTextureAccess::reset(GrTexture* texture,
humper@google.comb86add12013-07-25 18:49:07 +000035 GrTextureParams::FilterMode filterMode,
cdalton9c3f1432016-03-11 10:07:37 -080036 SkShader::TileMode tileXAndY,
cdaltona6b92ad2016-04-11 12:03:08 -070037 GrShaderFlags visibility) {
bsalomon49f085d2014-09-05 13:34:00 -070038 SkASSERT(texture);
bsalomonbcf0a522014-10-08 08:40:09 -070039 fTexture.set(SkRef(texture), kRead_GrIOType);
humper@google.comb86add12013-07-25 18:49:07 +000040 fParams.reset(tileXAndY, filterMode);
cdalton9c3f1432016-03-11 10:07:37 -080041 fVisibility = visibility;
bsalomon@google.com6d003d12012-09-11 15:45:20 +000042}