| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrContext_DEFINED | 8 #ifndef GrContext_DEFINED |
| 9 #define GrContext_DEFINED | 9 #define GrContext_DEFINED |
| 10 | 10 |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 return NULL; | 1091 return NULL; |
| 1092 } | 1092 } |
| 1093 GrTexture* texture = fTexture; | 1093 GrTexture* texture = fTexture; |
| 1094 fTexture = NULL; | 1094 fTexture = NULL; |
| 1095 | 1095 |
| 1096 // This GrAutoScratchTexture has a ref from lockAndRefScratchTexture, wh
ich we give up now. | 1096 // This GrAutoScratchTexture has a ref from lockAndRefScratchTexture, wh
ich we give up now. |
| 1097 // The cache also has a ref which we are lending to the caller of detach
(). When the caller | 1097 // The cache also has a ref which we are lending to the caller of detach
(). When the caller |
| 1098 // lets go of the ref and the ref count goes to 0 internal_dispose will
see this flag is | 1098 // lets go of the ref and the ref count goes to 0 internal_dispose will
see this flag is |
| 1099 // set and re-ref the texture, thereby restoring the cache's ref. | 1099 // set and re-ref the texture, thereby restoring the cache's ref. |
| 1100 SkASSERT(texture->getRefCnt() > 1); | 1100 SkASSERT(texture->getRefCnt() > 1); |
| 1101 texture->setFlag((GrTextureFlags) GrTexture::kReturnToCache_FlagBit); | 1101 texture->impl()->setFlag((GrTextureFlags) GrTextureImpl::kReturnToCache_
FlagBit); |
| 1102 texture->unref(); | 1102 texture->unref(); |
| 1103 SkASSERT(NULL != texture->getCacheEntry()); | 1103 SkASSERT(NULL != texture->getCacheEntry()); |
| 1104 | 1104 |
| 1105 return texture; | 1105 return texture; |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 GrTexture* set(GrContext* context, | 1108 GrTexture* set(GrContext* context, |
| 1109 const GrTextureDesc& desc, | 1109 const GrTextureDesc& desc, |
| 1110 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch
TexMatch) { | 1110 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch
TexMatch) { |
| 1111 this->reset(); | 1111 this->reset(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 GrTexture* texture() { return fTexture; } | 1125 GrTexture* texture() { return fTexture; } |
| 1126 | 1126 |
| 1127 private: | 1127 private: |
| 1128 GrContext* fContext; | 1128 GrContext* fContext; |
| 1129 GrTexture* fTexture; | 1129 GrTexture* fTexture; |
| 1130 }; | 1130 }; |
| 1131 | 1131 |
| 1132 #endif | 1132 #endif |
| OLD | NEW |