OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrResource_DEFINED | 8 #ifndef GrResource_DEFINED |
9 #define GrResource_DEFINED | 9 #define GrResource_DEFINED |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 * GrContext automatically releases all its resources. | 61 * GrContext automatically releases all its resources. |
62 */ | 62 */ |
63 const GrContext* getContext() const; | 63 const GrContext* getContext() const; |
64 GrContext* getContext(); | 64 GrContext* getContext(); |
65 | 65 |
66 void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry;
} | 66 void setCacheEntry(GrResourceEntry* cacheEntry) { fCacheEntry = cacheEntry;
} |
67 GrResourceEntry* getCacheEntry() { return fCacheEntry; } | 67 GrResourceEntry* getCacheEntry() { return fCacheEntry; } |
68 | 68 |
69 void incDeferredRefCount() const { SkASSERT(fDeferredRefCount >= 0); ++fDefe
rredRefCount; } | 69 void incDeferredRefCount() const { SkASSERT(fDeferredRefCount >= 0); ++fDefe
rredRefCount; } |
70 void decDeferredRefCount() const { SkASSERT(fDeferredRefCount > 0); --fDefer
redRefCount; } | 70 void decDeferredRefCount() const { SkASSERT(fDeferredRefCount > 0); --fDefer
redRefCount; } |
| 71 int getDeferredRefCount() const { return fDeferredRefCount; } |
71 | 72 |
72 protected: | 73 protected: |
73 /** | 74 /** |
74 * isWrapped indicates we have wrapped a client-created backend resource in
a GrResource. If it | 75 * isWrapped indicates we have wrapped a client-created backend resource in
a GrResource. If it |
75 * is true then the client is responsible for the lifetime of the underlying
backend resource. | 76 * is true then the client is responsible for the lifetime of the underlying
backend resource. |
76 * Otherwise, our onRelease() should free the resource. | 77 * Otherwise, our onRelease() should free the resource. |
77 */ | 78 */ |
78 GrResource(GrGpu* gpu, bool isWrapped); | 79 GrResource(GrGpu* gpu, bool isWrapped); |
79 virtual ~GrResource(); | 80 virtual ~GrResource(); |
80 | 81 |
(...skipping 24 matching lines...) Expand all Loading... |
105 | 106 |
106 enum Flags { | 107 enum Flags { |
107 kWrapped_Flag = 0x1, | 108 kWrapped_Flag = 0x1, |
108 }; | 109 }; |
109 uint32_t fFlags; | 110 uint32_t fFlags; |
110 | 111 |
111 typedef SkRefCnt INHERITED; | 112 typedef SkRefCnt INHERITED; |
112 }; | 113 }; |
113 | 114 |
114 #endif | 115 #endif |
OLD | NEW |