Index: include/gpu/GrTextureAccess.h |
diff --git a/include/gpu/GrTextureAccess.h b/include/gpu/GrTextureAccess.h |
index df0bdfda0fd7fce56225b76eb22d9dcdfc641e5f..e3ded34ff8c54ebb5ee9d5caef890d7ef3a82137 100644 |
--- a/include/gpu/GrTextureAccess.h |
+++ b/include/gpu/GrTextureAccess.h |
@@ -10,101 +10,10 @@ |
#include "GrGpuResourceRef.h" |
#include "GrTexture.h" |
+#include "GrTextureParams.h" |
#include "SkRefCnt.h" |
#include "SkShader.h" |
-/** |
- * Represents the filtering and tile modes used to access a texture. It is mostly used with |
- * GrTextureAccess (defined below). Also, some of the texture cache methods require knowledge about |
- * filtering and tiling to perform a cache lookup. If it wasn't for this latter usage this would |
- * be folded into GrTextureAccess. The default is clamp tile modes and no filtering. |
- */ |
-class GrTextureParams { |
-public: |
- GrTextureParams() { |
- this->reset(); |
- } |
- |
- enum FilterMode { |
- kNone_FilterMode, |
- kBilerp_FilterMode, |
- kMipMap_FilterMode |
- }; |
- |
- GrTextureParams(SkShader::TileMode tileXAndY, FilterMode filterMode) { |
- this->reset(tileXAndY, filterMode); |
- } |
- |
- GrTextureParams(const SkShader::TileMode tileModes[2], FilterMode filterMode) { |
- this->reset(tileModes, filterMode); |
- } |
- |
- GrTextureParams(const GrTextureParams& params) { |
- *this = params; |
- } |
- |
- GrTextureParams& operator= (const GrTextureParams& params) { |
- fTileModes[0] = params.fTileModes[0]; |
- fTileModes[1] = params.fTileModes[1]; |
- fFilterMode = params.fFilterMode; |
- return *this; |
- } |
- |
- void reset() { |
- this->reset(SkShader::kClamp_TileMode, kNone_FilterMode); |
- } |
- |
- void reset(SkShader::TileMode tileXAndY, FilterMode filterMode) { |
- fTileModes[0] = fTileModes[1] = tileXAndY; |
- fFilterMode = filterMode; |
- } |
- |
- void reset(const SkShader::TileMode tileModes[2], FilterMode filterMode) { |
- fTileModes[0] = tileModes[0]; |
- fTileModes[1] = tileModes[1]; |
- fFilterMode = filterMode; |
- } |
- |
- void setClampNoFilter() { |
- fTileModes[0] = fTileModes[1] = SkShader::kClamp_TileMode; |
- fFilterMode = kNone_FilterMode; |
- } |
- |
- void setClamp() { |
- fTileModes[0] = fTileModes[1] = SkShader::kClamp_TileMode; |
- } |
- |
- void setFilterMode(FilterMode filterMode) { fFilterMode = filterMode; } |
- |
- void setTileModeX(const SkShader::TileMode tm) { fTileModes[0] = tm; } |
- void setTileModeY(const SkShader::TileMode tm) { fTileModes[1] = tm; } |
- void setTileModeXAndY(const SkShader::TileMode tm) { fTileModes[0] = fTileModes[1] = tm; } |
- |
- SkShader::TileMode getTileModeX() const { return fTileModes[0]; } |
- |
- SkShader::TileMode getTileModeY() const { return fTileModes[1]; } |
- |
- bool isTiled() const { |
- return SkShader::kClamp_TileMode != fTileModes[0] || |
- SkShader::kClamp_TileMode != fTileModes[1]; |
- } |
- |
- FilterMode filterMode() const { return fFilterMode; } |
- |
- bool operator== (const GrTextureParams& other) const { |
- return fTileModes[0] == other.fTileModes[0] && |
- fTileModes[1] == other.fTileModes[1] && |
- fFilterMode == other.fFilterMode; |
- } |
- |
- bool operator!= (const GrTextureParams& other) const { return !(*this == other); } |
- |
-private: |
- |
- SkShader::TileMode fTileModes[2]; |
- FilterMode fFilterMode; |
-}; |
- |
/** A class representing the swizzle access pattern for a texture. Note that if the texture is |
* an alpha-only texture then the alpha channel is substituted for other components. Any mangling |
* to handle the r,g,b->a conversions for alpha textures is automatically included in the stage |