• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
9 #include "GrColor.h"
10 #include "GrTexture.h"
11 
GrTextureAccess()12 GrTextureAccess::GrTextureAccess() {}
13 
GrTextureAccess(GrTexture * texture,const GrTextureParams & params)14 GrTextureAccess::GrTextureAccess(GrTexture* texture, const GrTextureParams& params) {
15     this->reset(texture, params);
16 }
17 
GrTextureAccess(GrTexture * texture,GrTextureParams::FilterMode filterMode,SkShader::TileMode tileXAndY)18 GrTextureAccess::GrTextureAccess(GrTexture* texture,
19                                  GrTextureParams::FilterMode filterMode,
20                                  SkShader::TileMode tileXAndY) {
21     this->reset(texture, filterMode, tileXAndY);
22 }
23 
24 
reset(GrTexture * texture,const GrTextureParams & params)25 void GrTextureAccess::reset(GrTexture* texture,
26                             const GrTextureParams& params) {
27     SkASSERT(texture);
28     fTexture.set(SkRef(texture), kRead_GrIOType);
29     fParams = params;
30 }
31 
reset(GrTexture * texture,GrTextureParams::FilterMode filterMode,SkShader::TileMode tileXAndY)32 void GrTextureAccess::reset(GrTexture* texture,
33                             GrTextureParams::FilterMode filterMode,
34                             SkShader::TileMode tileXAndY) {
35     SkASSERT(texture);
36     fTexture.set(SkRef(texture), kRead_GrIOType);
37     fParams.reset(tileXAndY, filterMode);
38 }
39