OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTextureAccess.h" | 8 #include "GrTextureAccess.h" |
9 #include "GrColor.h" | 9 #include "GrColor.h" |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
11 | 11 |
12 GrTextureAccess::GrTextureAccess() {} | 12 GrTextureAccess::GrTextureAccess() {} |
13 | 13 |
14 GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& para
ms) { | 14 GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& para
ms) { |
15 this->reset(texture, params); | 15 this->reset(texture, params); |
16 } | 16 } |
17 | 17 |
18 GrTextureAccess::GrTextureAccess(GrTexture* texture, | 18 GrTextureAccess::GrTextureAccess(GrTexture* texture, |
19 GrTextureParams::FilterMode filterMode, | 19 GrTextureParams::FilterMode filterMode, |
20 SkShader::TileMode tileXAndY, | 20 SkShader::TileMode tileXAndY, |
21 GrShaderFlags visibility, | 21 GrShaderFlags visibility, |
22 GrSLPrecision precision) { | 22 GrSLPrecision precision) { |
23 this->reset(texture, filterMode, tileXAndY, visibility, precision); | 23 this->reset(texture, filterMode, tileXAndY, visibility, precision); |
24 } | 24 } |
25 | 25 |
| 26 GrTextureAccess::GrTextureAccess(GrTexture* texture, |
| 27 GrShaderFlags visibility, |
| 28 GrSLPrecision precision) { |
| 29 this->reset(texture, visibility, precision); |
| 30 } |
| 31 |
26 void GrTextureAccess::reset(GrTexture* texture, | 32 void GrTextureAccess::reset(GrTexture* texture, |
27 const GrTextureParams& params, | 33 const GrTextureParams& params, |
28 GrShaderFlags visibility, | 34 GrShaderFlags visibility, |
29 GrSLPrecision precision) { | 35 GrSLPrecision precision) { |
30 SkASSERT(texture); | 36 SkASSERT(texture); |
| 37 SkASSERT(texture->supportsTextureParams()); |
31 fTexture.set(SkRef(texture), kRead_GrIOType); | 38 fTexture.set(SkRef(texture), kRead_GrIOType); |
32 fParams = params; | 39 fParams = params; |
33 fVisibility = visibility; | 40 fVisibility = visibility; |
34 fPrecision = precision; | 41 fPrecision = precision; |
35 } | 42 } |
36 | 43 |
37 void GrTextureAccess::reset(GrTexture* texture, | 44 void GrTextureAccess::reset(GrTexture* texture, |
38 GrTextureParams::FilterMode filterMode, | 45 GrTextureParams::FilterMode filterMode, |
39 SkShader::TileMode tileXAndY, | 46 SkShader::TileMode tileXAndY, |
40 GrShaderFlags visibility, | 47 GrShaderFlags visibility, |
41 GrSLPrecision precision) { | 48 GrSLPrecision precision) { |
42 SkASSERT(texture); | 49 SkASSERT(texture); |
| 50 SkASSERT(texture->supportsTextureParams()); |
43 fTexture.set(SkRef(texture), kRead_GrIOType); | 51 fTexture.set(SkRef(texture), kRead_GrIOType); |
44 fParams.reset(tileXAndY, filterMode); | 52 fParams.reset(tileXAndY, filterMode); |
45 fVisibility = visibility; | 53 fVisibility = visibility; |
46 fPrecision = precision; | 54 fPrecision = precision; |
47 } | 55 } |
| 56 |
| 57 void GrTextureAccess::reset(GrTexture* texture, GrShaderFlags visibility, GrSLPr
ecision precision) { |
| 58 SkASSERT(texture); |
| 59 SkASSERT(!texture->supportsTextureParams()); |
| 60 fTexture.set(SkRef(texture), kRead_GrIOType); |
| 61 fVisibility = visibility; |
| 62 fPrecision = precision; |
| 63 } |
OLD | NEW |