OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrResource_DEFINED | 10 #ifndef GrResource_DEFINED |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 * for this to return NULL. When resources have been release()ed or | 62 * for this to return NULL. When resources have been release()ed or |
63 * abandon()ed they no longer have an owning context. Destroying a | 63 * abandon()ed they no longer have an owning context. Destroying a |
64 * GrContext automatically releases all its resources. | 64 * GrContext automatically releases all its resources. |
65 */ | 65 */ |
66 const GrContext* getContext() const; | 66 const GrContext* getContext() const; |
67 GrContext* getContext(); | 67 GrContext* getContext(); |
68 | 68 |
69 void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry;
} | 69 void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry;
} |
70 GrResourceEntry* getCacheEntry() { return fCacheEntry; } | 70 GrResourceEntry* getCacheEntry() { return fCacheEntry; } |
71 | 71 |
72 void incDeferredRefCount() const { GrAssert(fDeferredRefCount >= 0); ++fDefe
rredRefCount; } | 72 void incDeferredRefCount() const { SkASSERT(fDeferredRefCount >= 0); ++fDefe
rredRefCount; } |
73 void decDeferredRefCount() const { GrAssert(fDeferredRefCount > 0); --fDefer
redRefCount; } | 73 void decDeferredRefCount() const { SkASSERT(fDeferredRefCount > 0); --fDefer
redRefCount; } |
74 | 74 |
75 protected: | 75 protected: |
76 /** | 76 /** |
77 * isWrapped indicates we have wrapped a client-created backend resource in
a GrResource. If it | 77 * isWrapped indicates we have wrapped a client-created backend resource in
a GrResource. If it |
78 * is true then the client is responsible for the lifetime of the underlying
backend resource. | 78 * is true then the client is responsible for the lifetime of the underlying
backend resource. |
79 * Otherwise, our onRelease() should free the resource. | 79 * Otherwise, our onRelease() should free the resource. |
80 */ | 80 */ |
81 GrResource(GrGpu* gpu, bool isWrapped); | 81 GrResource(GrGpu* gpu, bool isWrapped); |
82 virtual ~GrResource(); | 82 virtual ~GrResource(); |
83 | 83 |
(...skipping 24 matching lines...) Expand all Loading... |
108 | 108 |
109 enum Flags { | 109 enum Flags { |
110 kWrapped_Flag = 0x1, | 110 kWrapped_Flag = 0x1, |
111 }; | 111 }; |
112 uint32_t fFlags; | 112 uint32_t fFlags; |
113 | 113 |
114 typedef GrRefCnt INHERITED; | 114 typedef GrRefCnt INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 #endif | 117 #endif |
OLD | NEW |