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 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 void GrContext::resolveRenderTarget(GrRenderTarget* target) { | 1433 void GrContext::resolveRenderTarget(GrRenderTarget* target) { |
1434 SkASSERT(target); | 1434 SkASSERT(target); |
1435 ASSERT_OWNED_RESOURCE(target); | 1435 ASSERT_OWNED_RESOURCE(target); |
1436 // In the future we may track whether there are any pending draws to this | 1436 // In the future we may track whether there are any pending draws to this |
1437 // target. We don't today so we always perform a flush. We don't promise | 1437 // target. We don't today so we always perform a flush. We don't promise |
1438 // this to our clients, though. | 1438 // this to our clients, though. |
1439 this->flush(); | 1439 this->flush(); |
1440 fGpu->resolveRenderTarget(target); | 1440 fGpu->resolveRenderTarget(target); |
1441 } | 1441 } |
1442 | 1442 |
| 1443 void GrContext::discardRenderTarget(GrRenderTarget* target) { |
| 1444 SkASSERT(target); |
| 1445 ASSERT_OWNED_RESOURCE(target); |
| 1446 AutoRestoreEffects are; |
| 1447 AutoCheckFlush acf(this); |
| 1448 this->prepareToDraw(NULL, BUFFERED_DRAW, &are, &acf)->discard(target); |
| 1449 } |
| 1450 |
1443 void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
topLeft) { | 1451 void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint*
topLeft) { |
1444 if (NULL == src || NULL == dst) { | 1452 if (NULL == src || NULL == dst) { |
1445 return; | 1453 return; |
1446 } | 1454 } |
1447 ASSERT_OWNED_RESOURCE(src); | 1455 ASSERT_OWNED_RESOURCE(src); |
1448 | 1456 |
1449 // Writes pending to the source texture are not tracked, so a flush | 1457 // Writes pending to the source texture are not tracked, so a flush |
1450 // is required to ensure that the copy captures the most recent contents | 1458 // is required to ensure that the copy captures the most recent contents |
1451 // of the source texture. See similar behavior in | 1459 // of the source texture. See similar behavior in |
1452 // GrContext::resolveRenderTarget. | 1460 // GrContext::resolveRenderTarget. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 } | 1793 } |
1786 return path; | 1794 return path; |
1787 } | 1795 } |
1788 | 1796 |
1789 /////////////////////////////////////////////////////////////////////////////// | 1797 /////////////////////////////////////////////////////////////////////////////// |
1790 #if GR_CACHE_STATS | 1798 #if GR_CACHE_STATS |
1791 void GrContext::printCacheStats() const { | 1799 void GrContext::printCacheStats() const { |
1792 fTextureCache->printStats(); | 1800 fTextureCache->printStats(); |
1793 } | 1801 } |
1794 #endif | 1802 #endif |
OLD | NEW |