| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrImageIDTextureAdjuster.h" | 8 #include "GrImageIDTextureAdjuster.h" |
| 9 | 9 |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) { | 84 GrTexture* GrBitmapTextureMaker::refOriginalTexture(bool willBeMipped) { |
| 85 GrTexture* tex; | 85 GrTexture* tex; |
| 86 | 86 |
| 87 if (fOriginalKey.isValid()) { | 87 if (fOriginalKey.isValid()) { |
| 88 tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(f
OriginalKey); | 88 tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(f
OriginalKey); |
| 89 if (tex) { | 89 if (tex) { |
| 90 return tex; | 90 return tex; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 // disable mipmapping until we generate anisotropic mipmap levels |
| 94 willBeMipped = false; |
| 93 if (willBeMipped) { | 95 if (willBeMipped) { |
| 94 tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap); | 96 tex = GrGenerateMipMapsAndUploadToTexture(this->context(), fBitmap); |
| 95 } | 97 } else { |
| 96 if (!tex) { | |
| 97 tex = GrUploadBitmapToTexture(this->context(), fBitmap); | 98 tex = GrUploadBitmapToTexture(this->context(), fBitmap); |
| 98 } | 99 } |
| 99 if (tex && fOriginalKey.isValid()) { | 100 if (tex && fOriginalKey.isValid()) { |
| 100 tex->resourcePriv().setUniqueKey(fOriginalKey); | 101 tex->resourcePriv().setUniqueKey(fOriginalKey); |
| 101 GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); | 102 GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef()); |
| 102 } | 103 } |
| 103 return tex; | 104 return tex; |
| 104 } | 105 } |
| 105 | 106 |
| 106 void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey
* copyKey) { | 107 void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey
* copyKey) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) { | 139 if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) { |
| 139 MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey); | 140 MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey); |
| 140 } | 141 } |
| 141 } | 142 } |
| 142 | 143 |
| 143 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) { | 144 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) { |
| 144 if (fClient) { | 145 if (fClient) { |
| 145 as_IB(fClient)->notifyAddedToCache(); | 146 as_IB(fClient)->notifyAddedToCache(); |
| 146 } | 147 } |
| 147 } | 148 } |
| OLD | NEW |