| 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 "GrGpuObject.h" | 10 #include "GrGpuObject.h" |
| 11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
| 12 | 12 |
| 13 GrGpuObject::GrGpuObject(GrGpu* gpu, bool isWrapped) { | 13 GrGpuObject::GrGpuObject(GrGpu* gpu, bool isWrapped) { |
| 14 fGpu = gpu; | 14 fGpu = gpu; |
| 15 fDeferredRefCount = 0; | |
| 16 if (isWrapped) { | 15 if (isWrapped) { |
| 17 fFlags = kWrapped_FlagBit; | 16 fFlags = kWrapped_FlagBit; |
| 18 } else { | 17 } else { |
| 19 fFlags = 0; | 18 fFlags = 0; |
| 20 } | 19 } |
| 21 fGpu->insertObject(this); | 20 fGpu->insertObject(this); |
| 22 } | 21 } |
| 23 | 22 |
| 24 GrGpuObject::~GrGpuObject() { | 23 GrGpuObject::~GrGpuObject() { |
| 25 // subclass should have released this. | 24 // subclass should have released this. |
| 26 SkASSERT(0 == fDeferredRefCount); | |
| 27 SkASSERT(this->wasDestroyed()); | 25 SkASSERT(this->wasDestroyed()); |
| 28 } | 26 } |
| 29 | 27 |
| 30 void GrGpuObject::release() { | 28 void GrGpuObject::release() { |
| 31 if (NULL != fGpu) { | 29 if (NULL != fGpu) { |
| 32 this->onRelease(); | 30 this->onRelease(); |
| 33 fGpu->removeObject(this); | 31 fGpu->removeObject(this); |
| 34 fGpu = NULL; | 32 fGpu = NULL; |
| 35 } | 33 } |
| 36 } | 34 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 } | 49 } |
| 52 } | 50 } |
| 53 | 51 |
| 54 GrContext* GrGpuObject::getContext() { | 52 GrContext* GrGpuObject::getContext() { |
| 55 if (NULL != fGpu) { | 53 if (NULL != fGpu) { |
| 56 return fGpu->getContext(); | 54 return fGpu->getContext(); |
| 57 } else { | 55 } else { |
| 58 return NULL; | 56 return NULL; |
| 59 } | 57 } |
| 60 } | 58 } |
| OLD | NEW |