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

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

Issue 880983008: More cleanup around GrContext, textures, and SkGr.cpp (Closed) Base URL: https://skia.googlesource.com/skia.git@npot_out
Patch Set: rebase Created 5 years, 10 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 | « include/gpu/GrContext.h ('k') | src/gpu/GrTexture.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 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 if (fGpu->caps()->pathRenderingSupport() && renderTarget->getStencilBuffer() && 216 if (fGpu->caps()->pathRenderingSupport() && renderTarget->getStencilBuffer() &&
217 renderTarget->isMultisampled()) { 217 renderTarget->isMultisampled()) {
218 return GrStencilAndCoverTextContext::Create(this, leakyProperties); 218 return GrStencilAndCoverTextContext::Create(this, leakyProperties);
219 } 219 }
220 220
221 return GrDistanceFieldTextContext::Create(this, leakyProperties, enableDista nceFieldFonts); 221 return GrDistanceFieldTextContext::Create(this, leakyProperties, enableDista nceFieldFonts);
222 } 222 }
223 223
224 //////////////////////////////////////////////////////////////////////////////// 224 ////////////////////////////////////////////////////////////////////////////////
225 225
226 bool GrContext::isConfigTexturable(GrPixelConfig config) const {
227 return fGpu->caps()->isConfigTexturable(config);
228 }
229
230 bool GrContext::npotTextureTileSupport() const {
231 return fGpu->caps()->npotTextureTileSupport();
232 }
233
226 GrTexture* GrContext::createTexture(const GrSurfaceDesc& desc, const void* srcDa ta, 234 GrTexture* GrContext::createTexture(const GrSurfaceDesc& desc, const void* srcDa ta,
227 size_t rowBytes) { 235 size_t rowBytes) {
228 return fGpu->createTexture(desc, true, srcData, rowBytes); 236 return fGpu->createTexture(desc, true, srcData, rowBytes);
229 } 237 }
230 238
231 GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM atch match, 239 GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM atch match,
232 bool calledDuringFlush) { 240 bool calledDuringFlush) {
241 // Currently we don't recycle compressed textures as scratch.
242 if (GrPixelConfigIsCompressed(inDesc.fConfig)) {
243 return NULL;
244 }
245
233 // kNoStencil has no meaning if kRT isn't set. 246 // kNoStencil has no meaning if kRT isn't set.
234 SkASSERT((inDesc.fFlags & kRenderTarget_GrSurfaceFlag) || 247 SkASSERT((inDesc.fFlags & kRenderTarget_GrSurfaceFlag) ||
235 !(inDesc.fFlags & kNoStencil_GrSurfaceFlag)); 248 !(inDesc.fFlags & kNoStencil_GrSurfaceFlag));
236 249
237 // Make sure caller has checked for renderability if kRT is set. 250 // Make sure caller has checked for renderability if kRT is set.
238 SkASSERT(!(inDesc.fFlags & kRenderTarget_GrSurfaceFlag) || 251 SkASSERT(!(inDesc.fFlags & kRenderTarget_GrSurfaceFlag) ||
239 this->isConfigRenderable(inDesc.fConfig, inDesc.fSampleCnt > 0)); 252 this->isConfigRenderable(inDesc.fConfig, inDesc.fSampleCnt > 0));
240 253
241 SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc); 254 SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
242 255
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 /////////////////////////////////////////////////////////////////////////////// 344 ///////////////////////////////////////////////////////////////////////////////
332 345
333 GrTexture* GrContext::wrapBackendTexture(const GrBackendTextureDesc& desc) { 346 GrTexture* GrContext::wrapBackendTexture(const GrBackendTextureDesc& desc) {
334 return fGpu->wrapBackendTexture(desc); 347 return fGpu->wrapBackendTexture(desc);
335 } 348 }
336 349
337 GrRenderTarget* GrContext::wrapBackendRenderTarget(const GrBackendRenderTargetDe sc& desc) { 350 GrRenderTarget* GrContext::wrapBackendRenderTarget(const GrBackendRenderTargetDe sc& desc) {
338 return fGpu->wrapBackendRenderTarget(desc); 351 return fGpu->wrapBackendRenderTarget(desc);
339 } 352 }
340 353
341 ///////////////////////////////////////////////////////////////////////////////
342
343 bool GrContext::supportsIndex8PixelConfig() const {
344 const GrDrawTargetCaps* caps = fGpu->caps();
345 return caps->isConfigTexturable(kIndex_8_GrPixelConfig);
346 }
347
348
349 //////////////////////////////////////////////////////////////////////////////// 354 ////////////////////////////////////////////////////////////////////////////////
350 355
351 void GrContext::clear(const SkIRect* rect, 356 void GrContext::clear(const SkIRect* rect,
352 const GrColor color, 357 const GrColor color,
353 bool canIgnoreRect, 358 bool canIgnoreRect,
354 GrRenderTarget* renderTarget) { 359 GrRenderTarget* renderTarget) {
355 ASSERT_OWNED_RESOURCE(renderTarget); 360 ASSERT_OWNED_RESOURCE(renderTarget);
356 SkASSERT(renderTarget); 361 SkASSERT(renderTarget);
357 362
358 AutoCheckFlush acf(this); 363 AutoCheckFlush acf(this);
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 } 1576 }
1572 } 1577 }
1573 1578
1574 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1579 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1575 fGpu->removeGpuTraceMarker(marker); 1580 fGpu->removeGpuTraceMarker(marker);
1576 if (fDrawBuffer) { 1581 if (fDrawBuffer) {
1577 fDrawBuffer->removeGpuTraceMarker(marker); 1582 fDrawBuffer->removeGpuTraceMarker(marker);
1578 } 1583 }
1579 } 1584 }
1580 1585
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698