| 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) | 13 SK_DEFINE_INST_COUNT(GrResource) |
| 14 | 14 |
| 15 GrResource::GrResource(GrGpu* gpu, bool isWrapped) { | 15 GrResource::GrResource(GrGpu* gpu, bool isWrapped) { |
| 16 fGpu = gpu; | 16 fGpu = gpu; |
| 17 fCacheEntry = NULL; | 17 fCacheEntry = NULL; |
| 18 fDeferredRefCount = 0; | 18 fDeferredRefCount = 0; |
| 19 if (isWrapped) { | 19 if (isWrapped) { |
| 20 fFlags = kWrapped_Flag; | 20 fFlags = kWrapped_FlagBit; |
| 21 } else { | 21 } else { |
| 22 fFlags = 0; | 22 fFlags = 0; |
| 23 } | 23 } |
| 24 fGpu->insertResource(this); | 24 fGpu->insertResource(this); |
| 25 } | 25 } |
| 26 | 26 |
| 27 GrResource::~GrResource() { | 27 GrResource::~GrResource() { |
| 28 // subclass should have released this. | 28 // subclass should have released this. |
| 29 SkASSERT(0 == fDeferredRefCount); | 29 SkASSERT(0 == fDeferredRefCount); |
| 30 SkASSERT(!this->isValid()); | 30 SkASSERT(!this->isValid()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 GrContext* GrResource::getContext() { | 57 GrContext* GrResource::getContext() { |
| 58 if (NULL != fGpu) { | 58 if (NULL != fGpu) { |
| 59 return fGpu->getContext(); | 59 return fGpu->getContext(); |
| 60 } else { | 60 } else { |
| 61 return NULL; | 61 return NULL; |
| 62 } | 62 } |
| 63 } | 63 } |
| OLD | NEW |