8 #ifndef GrGpuResourceRef_DEFINED
9 #define GrGpuResourceRef_DEFINED
11 #include "GrGpuResource.h"
12 #include "GrRenderTarget.h"
13 #include "GrTexture.h"
82 mutable bool fPendingIO;
85 typedef SkNoncopyable INHERITED;
99 T*
get()
const {
return static_cast<T*
>(this->getResource()); }
159 this->reset(resource);
162 void reset(T* resource) {
166 resource->addPendingRead();
168 case kWrite_GrIOType:
169 resource->addPendingWrite();
172 resource->addPendingRead();
173 resource->addPendingWrite();
178 fResource = resource;
185 explicit operator bool()
const {
return SkToBool(fResource); }
188 return fResource == other.fResource;
191 T*
get()
const {
return fResource; }
198 fResource->completedRead();
200 case kWrite_GrIOType:
201 fResource->completedWrite();
204 fResource->completedRead();
205 fResource->completedWrite();
Base class for objects that can be kept in the GrResourceCache.
Definition: GrGpuResource.h:140
void pendingIOComplete() const
Called to indicate that the previous pending IO is complete.
void removeRef() const
Called when the program element/draw state is no longer owned by GrDrawTarget-client code...
Templated version of GrGpuResourceRef to enforce type safety.
Definition: GrGpuResourceRef.h:91
void set(T *resource, GrIOType ioType)
Adopts a ref from the caller.
Definition: GrGpuResourceRef.h:103
This is similar to GrTGpuResourceRef but can only be in the pending IO state.
Definition: GrGpuResourceRef.h:156
void setResource(GrGpuResource *, GrIOType)
Adopts a ref from the caller.
virtual GrRenderTarget * asRenderTarget()
Definition: GrSurface.h:66
#define SkToBool(cond)
Returns 0 or 1 based on the condition.
Definition: SkTypes.h:287
Base class for GrProcessor.
Definition: GrProgramElement.h:44
virtual GrTexture * asTexture()
Definition: GrSurface.h:60
Definition: GrSurface.h:21
This class is intended only for internal use in core Gr code.
Definition: GrGpuResourceRef.h:37
void reset()
Shortcut for calling setResource() with NULL.
void markPendingIO() const
Called by owning GrProgramElement when the program element is first scheduled for execution...
GrTGpuResourceRef(T *resource, GrIOType ioType)
Adopts a ref from the caller.
Definition: GrGpuResourceRef.h:97
GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
Definition: GrRenderTarget.h:26
bool ownsPendingIO() const
Does this object own a pending read or write on the resource it is wrapping.
Definition: GrGpuResourceRef.h:44
Definition: GrTexture.h:19