| 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 "GrTextureProvider.h" | 8 #include "GrTextureProvider.h" |
| 9 #include "GrTexturePriv.h" | 9 #include "GrTexturePriv.h" |
| 10 #include "GrResourceCache.h" | 10 #include "GrResourceCache.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 for (int i = 0; i < mipLevelCount; ++i) { | 43 for (int i = 0; i < mipLevelCount; ++i) { |
| 44 if (!texels[i].fPixels) { | 44 if (!texels[i].fPixels) { |
| 45 return nullptr; | 45 return nullptr; |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) && | 49 if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) && |
| 50 !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { | 50 !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
| 51 return nullptr; | 51 return nullptr; |
| 52 } | 52 } |
| 53 if (!GrPixelConfigIsCompressed(desc.fConfig) && | 53 if (!GrPixelConfigIsCompressed(desc.fConfig)) { |
| 54 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { | |
| 55 if (mipLevelCount < 2) { | 54 if (mipLevelCount < 2) { |
| 56 static const uint32_t kFlags = kExact_ScratchTextureFlag | | 55 static const uint32_t kFlags = kExact_ScratchTextureFlag | |
| 57 kNoCreate_ScratchTextureFlag; | 56 kNoCreate_ScratchTextureFlag; |
| 58 if (GrTexture* texture = this->refScratchTexture(desc, kFlags)) { | 57 if (GrTexture* texture = this->refScratchTexture(desc, kFlags)) { |
| 59 if (!mipLevelCount || | 58 if (!mipLevelCount || |
| 60 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.f
Config, | 59 texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.f
Config, |
| 61 texels[0].fPixels, texels[0].fRowBytes)
) { | 60 texels[0].fPixels, texels[0].fRowBytes)
) { |
| 62 if (SkBudgeted::kNo == budgeted) { | 61 if (SkBudgeted::kNo == budgeted) { |
| 63 texture->resourcePriv().makeUnbudgeted(); | 62 texture->resourcePriv().makeUnbudgeted(); |
| 64 } | 63 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 GrTexture* GrTextureProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& ke
y) { | 191 GrTexture* GrTextureProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& ke
y) { |
| 193 ASSERT_SINGLE_OWNER | 192 ASSERT_SINGLE_OWNER |
| 194 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key); | 193 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key); |
| 195 if (resource) { | 194 if (resource) { |
| 196 GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture(); | 195 GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture(); |
| 197 SkASSERT(texture); | 196 SkASSERT(texture); |
| 198 return texture; | 197 return texture; |
| 199 } | 198 } |
| 200 return NULL; | 199 return NULL; |
| 201 } | 200 } |
| OLD | NEW |