Chromium Code Reviews| 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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 return pr; | 1698 return pr; |
| 1699 } | 1699 } |
| 1700 | 1700 |
| 1701 //////////////////////////////////////////////////////////////////////////////// | 1701 //////////////////////////////////////////////////////////////////////////////// |
| 1702 bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const { | 1702 bool GrContext::isConfigRenderable(GrPixelConfig config, bool withMSAA) const { |
| 1703 return fGpu->caps()->isConfigRenderable(config, withMSAA); | 1703 return fGpu->caps()->isConfigRenderable(config, withMSAA); |
| 1704 } | 1704 } |
| 1705 | 1705 |
| 1706 int GrContext::getRecommendedSampleCount(GrPixelConfig config, SkScalar dpi) con st { | |
| 1707 if (!this->isConfigRenderable(config, true)) { | |
| 1708 return 0; | |
| 1709 } | |
| 1710 int chosenSampleCount = 0; | |
| 1711 if (fGpu->caps()->pathRenderingSupport()) { | |
| 1712 if (dpi >= 250.0f) { | |
| 1713 chosenSampleCount = 4; | |
| 1714 } else { | |
| 1715 chosenSampleCount = 16; | |
| 1716 } | |
| 1717 } | |
| 1718 return GrMin(fGpu->caps()->maxSampleCount(), chosenSampleCount); | |
|
bsalomon
2014/03/07 18:35:36
maybe:
return chosenSampleCount < fGpu->caps()->m
| |
| 1719 } | |
| 1720 | |
| 1706 void GrContext::setupDrawBuffer() { | 1721 void GrContext::setupDrawBuffer() { |
| 1707 SkASSERT(NULL == fDrawBuffer); | 1722 SkASSERT(NULL == fDrawBuffer); |
| 1708 SkASSERT(NULL == fDrawBufferVBAllocPool); | 1723 SkASSERT(NULL == fDrawBufferVBAllocPool); |
| 1709 SkASSERT(NULL == fDrawBufferIBAllocPool); | 1724 SkASSERT(NULL == fDrawBufferIBAllocPool); |
| 1710 | 1725 |
| 1711 fDrawBufferVBAllocPool = | 1726 fDrawBufferVBAllocPool = |
| 1712 SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, false, | 1727 SkNEW_ARGS(GrVertexBufferAllocPool, (fGpu, false, |
| 1713 DRAW_BUFFER_VBPOOL_BUFFER_SIZE, | 1728 DRAW_BUFFER_VBPOOL_BUFFER_SIZE, |
| 1714 DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS)); | 1729 DRAW_BUFFER_VBPOOL_PREALLOC_BUFFERS)); |
| 1715 fDrawBufferIBAllocPool = | 1730 fDrawBufferIBAllocPool = |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1789 } | 1804 } |
| 1790 return path; | 1805 return path; |
| 1791 } | 1806 } |
| 1792 | 1807 |
| 1793 /////////////////////////////////////////////////////////////////////////////// | 1808 /////////////////////////////////////////////////////////////////////////////// |
| 1794 #if GR_CACHE_STATS | 1809 #if GR_CACHE_STATS |
| 1795 void GrContext::printCacheStats() const { | 1810 void GrContext::printCacheStats() const { |
| 1796 fTextureCache->printStats(); | 1811 fTextureCache->printStats(); |
| 1797 } | 1812 } |
| 1798 #endif | 1813 #endif |
| OLD | NEW |