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

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

Issue 459263003: Add a parameter GR_ALWAYS_ALLOCATE_ON_HEAP to allow for only ever creating temporary buffers on the… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 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 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 371
372 rtDesc.fFlags = kNone_GrTextureFlags; 372 rtDesc.fFlags = kNone_GrTextureFlags;
373 // no longer need to clamp at min RT size. 373 // no longer need to clamp at min RT size.
374 rtDesc.fWidth = GrNextPow2(desc.fWidth); 374 rtDesc.fWidth = GrNextPow2(desc.fWidth);
375 rtDesc.fHeight = GrNextPow2(desc.fHeight); 375 rtDesc.fHeight = GrNextPow2(desc.fHeight);
376 376
377 // We shouldn't be resizing a compressed texture. 377 // We shouldn't be resizing a compressed texture.
378 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); 378 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig));
379 379
380 size_t bpp = GrBytesPerPixel(desc.fConfig); 380 size_t bpp = GrBytesPerPixel(desc.fConfig);
381 #if GR_ALWAYS_ALLOCATE_ON_HEAP
382 SkAutoMalloc stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHeight);
383 #else
381 SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fH eight); 384 SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fH eight);
385 #endif
382 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight, 386 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight,
383 srcData, desc.fWidth, desc.fHeight, bpp); 387 srcData, desc.fWidth, desc.fHeight, bpp);
384 388
385 size_t stretchedRowBytes = rtDesc.fWidth * bpp; 389 size_t stretchedRowBytes = rtDesc.fWidth * bpp;
386 390
387 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo wBytes); 391 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo wBytes);
388 SkASSERT(NULL != texture); 392 SkASSERT(NULL != texture);
389 } 393 }
390 394
391 return texture; 395 return texture;
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 fDrawBuffer->removeGpuTraceMarker(marker); 1920 fDrawBuffer->removeGpuTraceMarker(marker);
1917 } 1921 }
1918 } 1922 }
1919 1923
1920 /////////////////////////////////////////////////////////////////////////////// 1924 ///////////////////////////////////////////////////////////////////////////////
1921 #if GR_CACHE_STATS 1925 #if GR_CACHE_STATS
1922 void GrContext::printCacheStats() const { 1926 void GrContext::printCacheStats() const {
1923 fResourceCache->printStats(); 1927 fResourceCache->printStats();
1924 } 1928 }
1925 #endif 1929 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698