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

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

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: No longer exposing SkMipMap and SkCachedData. Created 5 years, 4 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
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 22 matching lines...) Expand all
33 if (!srcData || texture->writePixels(0, 0, desc.fWidth, desc.fHeight , desc.fConfig, 33 if (!srcData || texture->writePixels(0, 0, desc.fWidth, desc.fHeight , desc.fConfig,
34 srcData, rowBytes)) { 34 srcData, rowBytes)) {
35 if (!budgeted) { 35 if (!budgeted) {
36 texture->resourcePriv().makeUnbudgeted(); 36 texture->resourcePriv().makeUnbudgeted();
37 } 37 }
38 return texture; 38 return texture;
39 } 39 }
40 texture->unref(); 40 texture->unref();
41 } 41 }
42 } 42 }
43 return fGpu->createTexture(desc, budgeted, srcData, rowBytes); 43
44 SkMipMapLevel level(srcData, rowBytes);
45 const int levelCount = 1;
46 SkTArray<SkMipMapLevel> texels(levelCount);
47 texels.push_back(level);
48 return createTexture(desc, budgeted, texels);
bsalomon 2015/08/26 18:30:11 style nit, we prepend method calls with "this->"
cblume 2015/08/26 18:58:00 Done.
49 }
50
51 GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, bool budg eted,
52 SkTArray<SkMipMapLevel>& texels) {
53 if (this->isAbandoned()) {
54 return NULL;
55 }
56 if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) &&
57 !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
58 return NULL;
59 }
60
61 return fGpu->createTexture(desc, budgeted, texels);
44 } 62 }
45 63
46 GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, Scrat chTexMatch match, 64 GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& desc, Scrat chTexMatch match,
47 bool calledDuringFlush) { 65 bool calledDuringFlush) {
48 if (this->isAbandoned()) { 66 if (this->isAbandoned()) {
49 return NULL; 67 return NULL;
50 } 68 }
51 // Currently we don't recycle compressed textures as scratch. 69 // Currently we don't recycle compressed textures as scratch.
52 if (GrPixelConfigIsCompressed(desc.fConfig)) { 70 if (GrPixelConfigIsCompressed(desc.fConfig)) {
53 return NULL; 71 return NULL;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 resource->resourcePriv().setUniqueKey(key); 145 resource->resourcePriv().setUniqueKey(key);
128 } 146 }
129 147
130 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t { 148 bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) cons t {
131 return this->isAbandoned() ? false : fCache->hasUniqueKey(key); 149 return this->isAbandoned() ? false : fCache->hasUniqueKey(key);
132 } 150 }
133 151
134 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) { 152 GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKe y& key) {
135 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key); 153 return this->isAbandoned() ? NULL : fCache->findAndRefUniqueResource(key);
136 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698