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 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1527 srcPI.fColorType = swapRAndB ? toggle_colortype32(dstPI.fColorType) : ds tPI.fColorType; | 1527 srcPI.fColorType = swapRAndB ? toggle_colortype32(dstPI.fColorType) : ds tPI.fColorType; |
1528 srcPI.fAlphaType = kPremul_SkAlphaType; | 1528 srcPI.fAlphaType = kPremul_SkAlphaType; |
1529 srcPI.fPixels = buffer; | 1529 srcPI.fPixels = buffer; |
1530 srcPI.fRowBytes = rowBytes; | 1530 srcPI.fRowBytes = rowBytes; |
1531 | 1531 |
1532 return srcPI.convertPixelsTo(&dstPI, width, height); | 1532 return srcPI.convertPixelsTo(&dstPI, width, height); |
1533 } | 1533 } |
1534 return true; | 1534 return true; |
1535 } | 1535 } |
1536 | 1536 |
1537 void GrContext::resolveRenderTarget(GrRenderTarget* target) { | 1537 void GrContext::prepareSurfaceForExternalRead(GrSurface* surface) { |
1538 SkASSERT(target); | 1538 SkASSERT(surface); |
1539 ASSERT_OWNED_RESOURCE(target); | 1539 ASSERT_OWNED_RESOURCE(surface); |
joshualitt
2014/11/03 21:47:45
The original code had a check for needing resolve,
bsalomon
2014/11/03 21:54:16
I did that to try to avoid the flush if the surfac
| |
1540 this->flush(); | 1540 if (surface->surfacePriv().hasPendingIO()) { |
1541 if (fGpu) { | 1541 this->flush(); |
1542 fGpu->resolveRenderTarget(target); | 1542 } |
1543 GrRenderTarget* rt = surface->asRenderTarget(); | |
1544 if (fGpu && rt) { | |
1545 fGpu->resolveRenderTarget(rt); | |
1543 } | 1546 } |
1544 } | 1547 } |
1545 | 1548 |
1546 void GrContext::discardRenderTarget(GrRenderTarget* renderTarget) { | 1549 void GrContext::discardRenderTarget(GrRenderTarget* renderTarget) { |
1547 SkASSERT(renderTarget); | 1550 SkASSERT(renderTarget); |
1548 ASSERT_OWNED_RESOURCE(renderTarget); | 1551 ASSERT_OWNED_RESOURCE(renderTarget); |
1549 AutoRestoreEffects are; | 1552 AutoRestoreEffects are; |
1550 AutoCheckFlush acf(this); | 1553 AutoCheckFlush acf(this); |
1551 GrDrawTarget* target = this->prepareToDraw(NULL, &are, &acf); | 1554 GrDrawTarget* target = this->prepareToDraw(NULL, &are, &acf); |
1552 if (NULL == target) { | 1555 if (NULL == target) { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1779 fResourceCache->printStats(); | 1782 fResourceCache->printStats(); |
1780 } | 1783 } |
1781 #endif | 1784 #endif |
1782 | 1785 |
1783 #if GR_GPU_STATS | 1786 #if GR_GPU_STATS |
1784 const GrContext::GPUStats* GrContext::gpuStats() const { | 1787 const GrContext::GPUStats* GrContext::gpuStats() const { |
1785 return fGpu->gpuStats(); | 1788 return fGpu->gpuStats(); |
1786 } | 1789 } |
1787 #endif | 1790 #endif |
1788 | 1791 |
OLD | NEW |