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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } else { | 355 } else { |
356 // TODO: Our CPU stretch doesn't filter. But we create separate | 356 // TODO: Our CPU stretch doesn't filter. But we create separate |
357 // stretched textures when the texture params is either filtered or | 357 // stretched textures when the texture params is either filtered or |
358 // not. Either implement filtered stretch blit on CPU or just create | 358 // not. Either implement filtered stretch blit on CPU or just create |
359 // one when FBO case fails. | 359 // one when FBO case fails. |
360 | 360 |
361 rtDesc.fFlags = kNone_GrTextureFlags; | 361 rtDesc.fFlags = kNone_GrTextureFlags; |
362 // no longer need to clamp at min RT size. | 362 // no longer need to clamp at min RT size. |
363 rtDesc.fWidth = GrNextPow2(desc.fWidth); | 363 rtDesc.fWidth = GrNextPow2(desc.fWidth); |
364 rtDesc.fHeight = GrNextPow2(desc.fHeight); | 364 rtDesc.fHeight = GrNextPow2(desc.fHeight); |
| 365 |
| 366 // We shouldn't be resizing a compressed texture. |
| 367 SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); |
| 368 |
365 size_t bpp = GrBytesPerPixel(desc.fConfig); | 369 size_t bpp = GrBytesPerPixel(desc.fConfig); |
366 SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fH
eight); | 370 SkAutoSMalloc<128*128*4> stretchedPixels(bpp * rtDesc.fWidth * rtDesc.fH
eight); |
367 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight, | 371 stretch_image(stretchedPixels.get(), rtDesc.fWidth, rtDesc.fHeight, |
368 srcData, desc.fWidth, desc.fHeight, bpp); | 372 srcData, desc.fWidth, desc.fHeight, bpp); |
369 | 373 |
370 size_t stretchedRowBytes = rtDesc.fWidth * bpp; | 374 size_t stretchedRowBytes = rtDesc.fWidth * bpp; |
371 | 375 |
372 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo
wBytes); | 376 texture = fGpu->createTexture(rtDesc, stretchedPixels.get(), stretchedRo
wBytes); |
373 SkASSERT(NULL != texture); | 377 SkASSERT(NULL != texture); |
374 } | 378 } |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 SkSafeRef(resource); | 1837 SkSafeRef(resource); |
1834 return resource; | 1838 return resource; |
1835 } | 1839 } |
1836 | 1840 |
1837 /////////////////////////////////////////////////////////////////////////////// | 1841 /////////////////////////////////////////////////////////////////////////////// |
1838 #if GR_CACHE_STATS | 1842 #if GR_CACHE_STATS |
1839 void GrContext::printCacheStats() const { | 1843 void GrContext::printCacheStats() const { |
1840 fResourceCache->printStats(); | 1844 fResourceCache->printStats(); |
1841 } | 1845 } |
1842 #endif | 1846 #endif |
OLD | NEW |