Chromium Code Reviews| 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 #ifndef GrTextureAccess_DEFINED | 8 #ifndef GrTextureAccess_DEFINED |
| 9 #define GrTextureAccess_DEFINED | 9 #define GrTextureAccess_DEFINED |
| 10 | 10 |
| 11 #include "GrColorSpaceXform.h" | |
| 11 #include "GrGpuResourceRef.h" | 12 #include "GrGpuResourceRef.h" |
| 12 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 13 #include "GrTextureParams.h" | 14 #include "GrTextureParams.h" |
| 14 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
| 15 #include "SkShader.h" | 16 #include "SkShader.h" |
| 16 | 17 |
| 17 /** | 18 /** |
| 18 * Used to represent a texture that is required by a GrProcessor. It holds a GrT exture along with | 19 * Used to represent a texture that is required by a GrProcessor. It holds a GrT exture along with |
| 19 * an associated GrTextureParams | 20 * an associated GrTextureParams |
| 20 */ | 21 */ |
| 21 class GrTextureAccess : public SkNoncopyable { | 22 class GrTextureAccess : public SkNoncopyable { |
|
bsalomon
2016/07/15 15:09:24
What do you think about having a constructor for t
Brian Osman
2016/07/15 15:29:01
That was my thought process - I'd sure like to hav
| |
| 22 public: | 23 public: |
| 23 /** | 24 /** |
| 24 * Must be initialized before adding to a GrProcessor's texture access list. | 25 * Must be initialized before adding to a GrProcessor's texture access list. |
| 25 */ | 26 */ |
| 26 GrTextureAccess(); | 27 GrTextureAccess(); |
| 27 | 28 |
| 28 GrTextureAccess(GrTexture*, const GrTextureParams&); | 29 GrTextureAccess(GrTexture*, sk_sp<GrColorSpaceXform> colorSpaceXform, const GrTextureParams&); |
| 29 | 30 |
| 30 explicit GrTextureAccess(GrTexture*, | 31 explicit GrTextureAccess(GrTexture*, sk_sp<GrColorSpaceXform> colorSpaceXfor m, |
| 31 GrTextureParams::FilterMode = GrTextureParams::kNon e_FilterMode, | 32 GrTextureParams::FilterMode = GrTextureParams::kNon e_FilterMode, |
| 32 SkShader::TileMode tileXAndY = SkShader::kClamp_Til eMode, | 33 SkShader::TileMode tileXAndY = SkShader::kClamp_Til eMode, |
| 33 GrShaderFlags visibility = kFragment_GrShaderFlag); | 34 GrShaderFlags visibility = kFragment_GrShaderFlag); |
| 34 | 35 |
| 35 void reset(GrTexture*, const GrTextureParams&, | 36 void reset(GrTexture*, sk_sp<GrColorSpaceXform> colorSpaceXform, const GrTex tureParams&, |
| 36 GrShaderFlags visibility = kFragment_GrShaderFlag); | 37 GrShaderFlags visibility = kFragment_GrShaderFlag); |
| 37 void reset(GrTexture*, | 38 void reset(GrTexture*, sk_sp<GrColorSpaceXform> colorSpaceXform, |
| 38 GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, | 39 GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, |
| 39 SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, | 40 SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, |
| 40 GrShaderFlags visibility = kFragment_GrShaderFlag); | 41 GrShaderFlags visibility = kFragment_GrShaderFlag); |
| 41 | 42 |
| 42 bool operator==(const GrTextureAccess& that) const { | 43 bool operator==(const GrTextureAccess& that) const { |
| 43 return this->getTexture() == that.getTexture() && | 44 return this->getTexture() == that.getTexture() && |
| 44 fParams == that.fParams && | 45 fParams == that.fParams && |
| 45 fVisibility == that.fVisibility; | 46 fVisibility == that.fVisibility && |
| 47 fColorSpaceXform == that.fColorSpaceXform; | |
| 46 } | 48 } |
| 47 | 49 |
| 48 bool operator!=(const GrTextureAccess& other) const { return !(*this == othe r); } | 50 bool operator!=(const GrTextureAccess& other) const { return !(*this == othe r); } |
| 49 | 51 |
| 50 GrTexture* getTexture() const { return fTexture.get(); } | 52 GrTexture* getTexture() const { return fTexture.get(); } |
| 51 GrShaderFlags getVisibility() const { return fVisibility; } | 53 GrShaderFlags getVisibility() const { return fVisibility; } |
| 54 GrColorSpaceXform* getColorSpaceXform() const { return fColorSpaceXform.get( ); } | |
| 52 | 55 |
| 53 /** | 56 /** |
| 54 * For internal use by GrProcessor. | 57 * For internal use by GrProcessor. |
| 55 */ | 58 */ |
| 56 const GrGpuResourceRef* getProgramTexture() const { return &fTexture; } | 59 const GrGpuResourceRef* getProgramTexture() const { return &fTexture; } |
| 57 | 60 |
| 58 const GrTextureParams& getParams() const { return fParams; } | 61 const GrTextureParams& getParams() const { return fParams; } |
| 59 | 62 |
| 60 private: | 63 private: |
| 61 | 64 |
| 62 typedef GrTGpuResourceRef<GrTexture> ProgramTexture; | 65 typedef GrTGpuResourceRef<GrTexture> ProgramTexture; |
| 63 | 66 |
| 64 ProgramTexture fTexture; | 67 ProgramTexture fTexture; |
| 65 GrTextureParams fParams; | 68 GrTextureParams fParams; |
| 66 GrShaderFlags fVisibility; | 69 GrShaderFlags fVisibility; |
| 70 sk_sp<GrColorSpaceXform> fColorSpaceXform; | |
| 67 | 71 |
| 68 typedef SkNoncopyable INHERITED; | 72 typedef SkNoncopyable INHERITED; |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 #endif | 75 #endif |
| OLD | NEW |