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

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

Issue 1728093005: Move Budgeted enum out of SkSurface, use in GrTextureProvider (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add aliases for Chrome Created 4 years, 9 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 | « src/gpu/GrGpu.h ('k') | src/gpu/GrGpuResource.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 * 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 8
9 #include "GrGpu.h" 9 #include "GrGpu.h"
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // By default, GrRenderTargets are GL's normal orientation so that they 81 // By default, GrRenderTargets are GL's normal orientation so that they
82 // can be drawn to by the outside world without the client having 82 // can be drawn to by the outside world without the client having
83 // to render upside down. 83 // to render upside down.
84 if (kDefault_GrSurfaceOrigin == origin) { 84 if (kDefault_GrSurfaceOrigin == origin) {
85 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin; 85 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr igin;
86 } else { 86 } else {
87 return origin; 87 return origin;
88 } 88 }
89 } 89 }
90 90
91 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, bool budgeted, 91 GrTexture* GrGpu::createTexture(const GrSurfaceDesc& origDesc, SkBudgeted budget ed,
92 const void* srcData, size_t rowBytes) { 92 const void* srcData, size_t rowBytes) {
93 GrSurfaceDesc desc = origDesc; 93 GrSurfaceDesc desc = origDesc;
94 94
95 if (!this->caps()->isConfigTexturable(desc.fConfig)) { 95 if (!this->caps()->isConfigTexturable(desc.fConfig)) {
96 return nullptr; 96 return nullptr;
97 } 97 }
98 98
99 bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag); 99 bool isRT = SkToBool(desc.fFlags & kRenderTarget_GrSurfaceFlag);
100 if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { 100 if (isRT && !this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
101 return nullptr; 101 return nullptr;
(...skipping 11 matching lines...) Expand all
113 if (desc.fWidth > maxRTSize || desc.fHeight > maxRTSize) { 113 if (desc.fWidth > maxRTSize || desc.fHeight > maxRTSize) {
114 return nullptr; 114 return nullptr;
115 } 115 }
116 } else { 116 } else {
117 int maxSize = this->caps()->maxTextureSize(); 117 int maxSize = this->caps()->maxTextureSize();
118 if (desc.fWidth > maxSize || desc.fHeight > maxSize) { 118 if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
119 return nullptr; 119 return nullptr;
120 } 120 }
121 } 121 }
122 122
123 GrGpuResource::LifeCycle lifeCycle = budgeted ? GrGpuResource::kCached_LifeC ycle : 123 GrGpuResource::LifeCycle lifeCycle = SkBudgeted::kYes == budgeted ?
124 GrGpuResource::kUncached_Lif eCycle; 124 GrGpuResource::kCached_LifeCycle :
125 GrGpuResource::kUncached_LifeCycle;
125 126
126 desc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount()); 127 desc.fSampleCnt = SkTMin(desc.fSampleCnt, this->caps()->maxSampleCount());
127 // Attempt to catch un- or wrongly initialized sample counts; 128 // Attempt to catch un- or wrongly initialized sample counts;
128 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64); 129 SkASSERT(desc.fSampleCnt >= 0 && desc.fSampleCnt <= 64);
129 130
130 desc.fOrigin = resolve_origin(desc.fOrigin, isRT); 131 desc.fOrigin = resolve_origin(desc.fOrigin, isRT);
131 132
132 if (GrPixelConfigIsCompressed(desc.fConfig)) { 133 if (GrPixelConfigIsCompressed(desc.fConfig)) {
133 // We shouldn't be rendering into this 134 // We shouldn't be rendering into this
134 SkASSERT(!isRT); 135 SkASSERT(!isRT);
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 399 }
399 400
400 GrVertices::Iterator iter; 401 GrVertices::Iterator iter;
401 const GrNonInstancedVertices* verts = iter.init(vertices); 402 const GrNonInstancedVertices* verts = iter.init(vertices);
402 do { 403 do {
403 this->onDraw(args, *verts); 404 this->onDraw(args, *verts);
404 fStats.incNumDraws(); 405 fStats.incNumDraws();
405 } while ((verts = iter.next())); 406 } while ((verts = iter.next()));
406 } 407 }
407 408
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.h ('k') | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698