Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: src/gpu/GrTextureProvider.cpp

Issue 1253513004: Fix ImageNewSurface test on S4. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 #include "GrTextureProvider.h" 9 #include "GrTextureProvider.h"
10 #include "GrTexturePriv.h" 10 #include "GrTexturePriv.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD esc, 66 GrTexture* GrTextureProvider::internalRefScratchTexture(const GrSurfaceDesc& inD esc,
67 uint32_t flags) { 67 uint32_t flags) {
68 SkASSERT(!this->isAbandoned()); 68 SkASSERT(!this->isAbandoned());
69 SkASSERT(!GrPixelConfigIsCompressed(inDesc.fConfig)); 69 SkASSERT(!GrPixelConfigIsCompressed(inDesc.fConfig));
70 70
71 SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc); 71 SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
72 72
73 if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_Gr SurfaceFlag)) { 73 if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_Gr SurfaceFlag)) {
74 if (!(kExact_ScratchTextureFlag & flags)) { 74 if (!(kExact_ScratchTextureFlag & flags)) {
75 // bin by pow2 with a reasonable min 75 // bin by pow2 with a reasonable min
76 static const int MIN_SIZE = 16; 76 const int minSize = SkTMin(16, fGpu->caps()->minTextureSize());
77 GrSurfaceDesc* wdesc = desc.writable(); 77 GrSurfaceDesc* wdesc = desc.writable();
78 wdesc->fWidth = SkTMax(MIN_SIZE, GrNextPow2(desc->fWidth)); 78 wdesc->fWidth = SkTMax(minSize, GrNextPow2(desc->fWidth));
79 wdesc->fHeight = SkTMax(MIN_SIZE, GrNextPow2(desc->fHeight)); 79 wdesc->fHeight = SkTMax(minSize, GrNextPow2(desc->fHeight));
80 } 80 }
81 81
82 GrScratchKey key; 82 GrScratchKey key;
83 GrTexturePriv::ComputeScratchKey(*desc, &key); 83 GrTexturePriv::ComputeScratchKey(*desc, &key);
84 uint32_t scratchFlags = 0; 84 uint32_t scratchFlags = 0;
85 if (kNoPendingIO_ScratchTextureFlag & flags) { 85 if (kNoPendingIO_ScratchTextureFlag & flags) {
86 scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag; 86 scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
87 } else if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) { 87 } else if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
88 // If it is not a render target then it will most likely be populate d by 88 // If it is not a render target then it will most likely be populate d by
89 // writePixels() which will trigger a flush if the texture has pendi ng IO. 89 // writePixels() which will trigger a flush if the texture has pendi ng IO.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 resource->resourcePriv().setUniqueKey(key); 127 resource->resourcePriv().setUniqueKey(key);
128 } 128 }
129 129
130 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t { 130 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t {
131 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); 131 return this->isAbandoned() ? false : fCache->hasUniqueKey(key);
132 } 132 }
133 133
134 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) { 134 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) {
135 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); 135 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key);
136 } 136 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698