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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
601 } | 605 } |
602 | 606 |
603 GrRenderTarget* GrContext::wrapBackendRenderTarget(const GrBackendRenderTargetDe sc& desc) { | 607 GrRenderTarget* GrContext::wrapBackendRenderTarget(const GrBackendRenderTargetDe sc& desc) { |
604 return fGpu->wrapBackendRenderTarget(desc); | 608 return fGpu->wrapBackendRenderTarget(desc); |
605 } | 609 } |
606 | 610 |
607 /////////////////////////////////////////////////////////////////////////////// | 611 /////////////////////////////////////////////////////////////////////////////// |
608 | 612 |
609 bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params, | 613 bool GrContext::supportsIndex8PixelConfig(const GrTextureParams* params, |
610 int width, int height) const { | 614 int width, int height) const { |
611 const GrDrawTargetCaps* caps = fGpu->caps(); | 615 const GrDrawTargetCaps* caps = fGpu->caps(); |
robertphillips
2014/05/29 20:08:43
Wrong config?
krajcevski
2014/05/29 20:31:28
Done.
| |
612 if (!caps->eightBitPaletteSupport()) { | 616 if (!caps->isConfigTexturable(kETC1_GrPixelConfig)) { |
613 return false; | 617 return false; |
614 } | 618 } |
615 | 619 |
616 bool isPow2 = GrIsPow2(width) && GrIsPow2(height); | 620 bool isPow2 = GrIsPow2(width) && GrIsPow2(height); |
617 | 621 |
618 if (!isPow2) { | 622 if (!isPow2) { |
619 bool tiled = NULL != params && params->isTiled(); | 623 bool tiled = NULL != params && params->isTiled(); |
620 if (tiled && !caps->npotTextureTileSupport()) { | 624 if (tiled && !caps->npotTextureTileSupport()) { |
621 return false; | 625 return false; |
622 } | 626 } |
(...skipping 1210 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 |