bsalomon@google.com | 047696c | 2012-09-11 13:29:29 +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 "GrTextureAccess.h" |
bsalomon@google.com | b8eb2e8 | 2013-03-28 13:46:42 +0000 | [diff] [blame] | 9 | #include "GrColor.h" |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 10 | #include "GrTexture.h" |
| 11 | |
bsalomon | cdee009 | 2016-01-08 13:20:12 -0800 | [diff] [blame] | 12 | GrTextureAccess::GrTextureAccess() {} |
bsalomon@google.com | 047696c | 2012-09-11 13:29:29 +0000 | [diff] [blame] | 13 | |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 14 | GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& params) { |
| 15 | this->reset(texture, params); |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 16 | } |
| 17 | |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 18 | GrTextureAccess::GrTextureAccess(GrTexture* texture, |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 19 | GrTextureParams::FilterMode filterMode, |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 20 | SkShader::TileMode tileXAndY, |
cdalton | a6b92ad | 2016-04-11 12:03:08 -0700 | [diff] [blame] | 21 | GrShaderFlags visibility) { |
| 22 | this->reset(texture, filterMode, tileXAndY, visibility); |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 23 | } |
| 24 | |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 25 | void GrTextureAccess::reset(GrTexture* texture, |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 26 | const GrTextureParams& params, |
cdalton | a6b92ad | 2016-04-11 12:03:08 -0700 | [diff] [blame] | 27 | GrShaderFlags visibility) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 28 | SkASSERT(texture); |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 29 | fTexture.set(SkRef(texture), kRead_GrIOType); |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 30 | fParams = params; |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 31 | fVisibility = visibility; |
bsalomon@google.com | 1ce49fc | 2012-09-18 14:14:49 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | void GrTextureAccess::reset(GrTexture* texture, |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 35 | GrTextureParams::FilterMode filterMode, |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 36 | SkShader::TileMode tileXAndY, |
cdalton | a6b92ad | 2016-04-11 12:03:08 -0700 | [diff] [blame] | 37 | GrShaderFlags visibility) { |
bsalomon | 49f085d | 2014-09-05 13:34:00 -0700 | [diff] [blame] | 38 | SkASSERT(texture); |
bsalomon | bcf0a52 | 2014-10-08 08:40:09 -0700 | [diff] [blame] | 39 | fTexture.set(SkRef(texture), kRead_GrIOType); |
humper@google.com | b86add1 | 2013-07-25 18:49:07 +0000 | [diff] [blame] | 40 | fParams.reset(tileXAndY, filterMode); |
cdalton | 9c3f143 | 2016-03-11 10:07:37 -0800 | [diff] [blame] | 41 | fVisibility = visibility; |
bsalomon@google.com | 6d003d1 | 2012-09-11 15:45:20 +0000 | [diff] [blame] | 42 | } |