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 #include "GrResource.h" | 10 #include "GrResource.h" |
11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
12 | 12 |
13 SK_DEFINE_INST_COUNT(GrResource) | |
14 | |
15 GrResource::GrResource(GrGpu* gpu, bool isWrapped) { | 13 GrResource::GrResource(GrGpu* gpu, bool isWrapped) { |
16 fGpu = gpu; | 14 fGpu = gpu; |
17 fCacheEntry = NULL; | 15 fCacheEntry = NULL; |
18 fDeferredRefCount = 0; | 16 fDeferredRefCount = 0; |
19 if (isWrapped) { | 17 if (isWrapped) { |
20 fFlags = kWrapped_FlagBit; | 18 fFlags = kWrapped_FlagBit; |
21 } else { | 19 } else { |
22 fFlags = 0; | 20 fFlags = 0; |
23 } | 21 } |
24 fGpu->insertResource(this); | 22 fGpu->insertResource(this); |
(...skipping 29 matching lines...) Expand all Loading... |
54 } | 52 } |
55 } | 53 } |
56 | 54 |
57 GrContext* GrResource::getContext() { | 55 GrContext* GrResource::getContext() { |
58 if (NULL != fGpu) { | 56 if (NULL != fGpu) { |
59 return fGpu->getContext(); | 57 return fGpu->getContext(); |
60 } else { | 58 } else { |
61 return NULL; | 59 return NULL; |
62 } | 60 } |
63 } | 61 } |
OLD | NEW |