| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkGpuDevice.h" | 8 #include "SkGpuDevice.h" |
| 9 | 9 |
| 10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
| (...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 desc.fWidth = cinfo.fInfo.width(); | 1799 desc.fWidth = cinfo.fInfo.width(); |
| 1800 desc.fHeight = cinfo.fInfo.height(); | 1800 desc.fHeight = cinfo.fInfo.height(); |
| 1801 desc.fSampleCnt = fRenderTarget->desc().fSampleCnt; | 1801 desc.fSampleCnt = fRenderTarget->desc().fSampleCnt; |
| 1802 | 1802 |
| 1803 SkAutoTUnref<GrTexture> texture; | 1803 SkAutoTUnref<GrTexture> texture; |
| 1804 // Skia's convention is to only clear a device if it is non-opaque. | 1804 // Skia's convention is to only clear a device if it is non-opaque. |
| 1805 InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_I
nitContents; | 1805 InitContents init = cinfo.fInfo.isOpaque() ? kUninit_InitContents : kClear_I
nitContents; |
| 1806 | 1806 |
| 1807 // layers are never draw in repeat modes, so we can request an approx | 1807 // layers are never draw in repeat modes, so we can request an approx |
| 1808 // match and ignore any padding. | 1808 // match and ignore any padding. |
| 1809 const GrTextureProvider::ScratchTexMatch match = (kNever_TileUsage == cinfo.
fTileUsage) ? | 1809 if (kNever_TileUsage == cinfo.fTileUsage) { |
| 1810 GrTextureProvider::kApprox_Scr
atchTexMatch : | 1810 texture.reset(fContext->textureProvider()->createApproxTexture(desc)); |
| 1811 GrTextureProvider::kExact_Scra
tchTexMatch; | 1811 } else { |
| 1812 texture.reset(fContext->textureProvider()->refScratchTexture(desc, match)); | 1812 texture.reset(fContext->textureProvider()->createTexture(desc, true)); |
| 1813 } |
| 1813 | 1814 |
| 1814 if (texture) { | 1815 if (texture) { |
| 1815 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry)
; | 1816 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry)
; |
| 1816 return SkGpuDevice::Create( | 1817 return SkGpuDevice::Create( |
| 1817 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height()
, &props, init); | 1818 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height()
, &props, init); |
| 1818 } else { | 1819 } else { |
| 1819 SkErrorInternals::SetError( kInternalError_SkError, | 1820 SkErrorInternals::SetError( kInternalError_SkError, |
| 1820 "---- failed to create gpu device texture [%
d %d]\n", | 1821 "---- failed to create gpu device texture [%
d %d]\n", |
| 1821 cinfo.fInfo.width(), cinfo.fInfo.height()); | 1822 cinfo.fInfo.width(), cinfo.fInfo.height()); |
| 1822 return NULL; | 1823 return NULL; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 #endif | 1898 #endif |
| 1898 } | 1899 } |
| 1899 | 1900 |
| 1900 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1901 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
| 1901 // We always return a transient cache, so it is freed after each | 1902 // We always return a transient cache, so it is freed after each |
| 1902 // filter traversal. | 1903 // filter traversal. |
| 1903 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1904 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
| 1904 } | 1905 } |
| 1905 | 1906 |
| 1906 #endif | 1907 #endif |
| OLD | NEW |