OLD | NEW |
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 Loading... |
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 SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fH
eight); | 381 GrAutoMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fHe
ight); |
382 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight, | 382 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight, |
383 srcData, desc.fWidth, desc.fHeight, bpp); | 383 srcData, desc.fWidth, desc.fHeight, bpp); |
384 | 384 |
385 size_t stretchedRowBytes = rtDesc.fWidth * bpp; | 385 size_t stretchedRowBytes = rtDesc.fWidth * bpp; |
386 | 386 |
387 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo
wBytes); | 387 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo
wBytes); |
388 SkASSERT(NULL != texture); | 388 SkASSERT(NULL != texture); |
389 } | 389 } |
390 | 390 |
391 return texture; | 391 return texture; |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 fDrawBuffer->removeGpuTraceMarker(marker); | 1916 fDrawBuffer->removeGpuTraceMarker(marker); |
1917 } | 1917 } |
1918 } | 1918 } |
1919 | 1919 |
1920 /////////////////////////////////////////////////////////////////////////////// | 1920 /////////////////////////////////////////////////////////////////////////////// |
1921 #if GR_CACHE_STATS | 1921 #if GR_CACHE_STATS |
1922 void GrContext::printCacheStats() const { | 1922 void GrContext::printCacheStats() const { |
1923 fResourceCache->printStats(); | 1923 fResourceCache->printStats(); |
1924 } | 1924 } |
1925 #endif | 1925 #endif |
OLD | NEW |