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 1518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); | 1529 SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0); |
1530 | 1530 |
1531 if (kUnpremul_PixelOpsFlag & flags) { | 1531 if (kUnpremul_PixelOpsFlag & flags) { |
1532 if (!GrPixelConfigIs8888(srcConfig)) { | 1532 if (!GrPixelConfigIs8888(srcConfig)) { |
1533 return false; | 1533 return false; |
1534 } | 1534 } |
1535 effect.reset(this->createUPMToPMEffect(texture, swapRAndB, textureMatrix
)); | 1535 effect.reset(this->createUPMToPMEffect(texture, swapRAndB, textureMatrix
)); |
1536 // handle the unpremul step on the CPU if we couldn't create an effect t
o do it. | 1536 // handle the unpremul step on the CPU if we couldn't create an effect t
o do it. |
1537 if (NULL == effect) { | 1537 if (NULL == effect) { |
1538 SkCanvas::Config8888 srcConfig8888, dstConfig8888; | 1538 SkCanvas::Config8888 srcConfig8888, dstConfig8888; |
1539 GR_DEBUGCODE(bool success = ) | 1539 SkDEBUGCODE(bool success = ) |
1540 grconfig_to_config8888(srcConfig, true, &srcConfig8888); | 1540 grconfig_to_config8888(srcConfig, true, &srcConfig8888); |
1541 SkASSERT(success); | 1541 SkASSERT(success); |
1542 GR_DEBUGCODE(success = ) | 1542 SkDEBUGCODE(success = ) |
1543 grconfig_to_config8888(srcConfig, false, &dstConfig8888); | 1543 grconfig_to_config8888(srcConfig, false, &dstConfig8888); |
1544 SkASSERT(success); | 1544 SkASSERT(success); |
1545 const uint32_t* src = reinterpret_cast<const uint32_t*>(buffer); | 1545 const uint32_t* src = reinterpret_cast<const uint32_t*>(buffer); |
1546 tmpPixels.reset(width * height); | 1546 tmpPixels.reset(width * height); |
1547 SkConvertConfig8888Pixels(tmpPixels.get(), 4 * width, dstConfig8888, | 1547 SkConvertConfig8888Pixels(tmpPixels.get(), 4 * width, dstConfig8888, |
1548 src, rowBytes, srcConfig8888, | 1548 src, rowBytes, srcConfig8888, |
1549 width, height); | 1549 width, height); |
1550 buffer = tmpPixels.get(); | 1550 buffer = tmpPixels.get(); |
1551 rowBytes = 4 * width; | 1551 rowBytes = 4 * width; |
1552 } | 1552 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 return NULL; | 1743 return NULL; |
1744 } | 1744 } |
1745 } | 1745 } |
1746 | 1746 |
1747 /////////////////////////////////////////////////////////////////////////////// | 1747 /////////////////////////////////////////////////////////////////////////////// |
1748 #if GR_CACHE_STATS | 1748 #if GR_CACHE_STATS |
1749 void GrContext::printCacheStats() const { | 1749 void GrContext::printCacheStats() const { |
1750 fTextureCache->printStats(); | 1750 fTextureCache->printStats(); |
1751 } | 1751 } |
1752 #endif | 1752 #endif |
OLD | NEW |