Skia
2DGraphicsLibrary
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GrTextureAccess.h
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 #ifndef GrTextureAccess_DEFINED
9 #define GrTextureAccess_DEFINED
10 
11 #include "GrGpuResourceRef.h"
12 #include "GrTexture.h"
13 #include "GrTextureParams.h"
14 #include "SkRefCnt.h"
15 #include "SkShader.h"
16 
21 class GrTextureAccess : public SkNoncopyable {
22 public:
27 
29 
30  explicit GrTextureAccess(GrTexture*,
31  GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
33  GrShaderFlags visibility = kFragment_GrShaderFlag);
34 
35  void reset(GrTexture*, const GrTextureParams&,
36  GrShaderFlags visibility = kFragment_GrShaderFlag);
37  void reset(GrTexture*,
38  GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode,
40  GrShaderFlags visibility = kFragment_GrShaderFlag);
41 
42  bool operator==(const GrTextureAccess& that) const {
43  return this->getTexture() == that.getTexture() &&
44  fParams == that.fParams &&
45  fVisibility == that.fVisibility;
46  }
47 
48  bool operator!=(const GrTextureAccess& other) const { return !(*this == other); }
49 
50  GrTexture* getTexture() const { return fTexture.get(); }
51  GrShaderFlags getVisibility() const { return fVisibility; }
52 
56  const GrGpuResourceRef* getProgramTexture() const { return &fTexture; }
57 
58  const GrTextureParams& getParams() const { return fParams; }
59 
60 private:
61 
62  typedef GrTGpuResourceRef<GrTexture> ProgramTexture;
63 
64  ProgramTexture fTexture;
65  GrTextureParams fParams;
66  GrShaderFlags fVisibility;
67 
68  typedef SkNoncopyable INHERITED;
69 };
70 
71 #endif
Used to represent a texture that is required by a GrProcessor.
Definition: GrTextureAccess.h:21
Represents the filtering and tile modes used to access a texture.
Definition: GrTextureParams.h:17
const GrGpuResourceRef * getProgramTexture() const
For internal use by GrProcessor.
Definition: GrTextureAccess.h:56
Definition: GrGpuResourceRef.h:110
This class is intended only for internal use in core Gr code.
Definition: GrGpuResourceRef.h:37
GrTextureAccess()
Must be initialized before adding to a GrProcessor's texture access list.
TileMode
Definition: SkShader.h:51
replicate the edge color if the shader draws outside of its original bounds
Definition: SkShader.h:55
Definition: GrTexture.h:19