Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1399)

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 664823003: Revert of Use approximate scratch textures for image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 desc.fFlags = kRenderTarget_GrTextureFlagBit; 1756 desc.fFlags = kRenderTarget_GrTextureFlagBit;
1757 desc.fWidth = info.width(); 1757 desc.fWidth = info.width();
1758 desc.fHeight = info.height(); 1758 desc.fHeight = info.height();
1759 desc.fSampleCnt = fRenderTarget->numSamples(); 1759 desc.fSampleCnt = fRenderTarget->numSamples();
1760 1760
1761 SkAutoTUnref<GrTexture> texture; 1761 SkAutoTUnref<GrTexture> texture;
1762 // Skia's convention is to only clear a device if it is non-opaque. 1762 // Skia's convention is to only clear a device if it is non-opaque.
1763 unsigned flags = info.isOpaque() ? 0 : kNeedClear_Flag; 1763 unsigned flags = info.isOpaque() ? 0 : kNeedClear_Flag;
1764 1764
1765 #if CACHE_COMPATIBLE_DEVICE_TEXTURES 1765 #if CACHE_COMPATIBLE_DEVICE_TEXTURES
1766 // layers are never draw in repeat modes or with mip maps, so we can request an approx 1766 // layers are never draw in repeat modes, so we can request an approx
1767 // match and ignore any padding. Image filters (at present) don't tile their inputs or use mip 1767 // match and ignore any padding.
1768 // maps, either. 1768 const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == usage) ?
1769 const GrContext::ScratchTexMatch match = 1769 GrContext::kApprox_ScratchTexMat ch :
1770 (kSaveLayer_Usage == usage || kImageFilter_Usage == usage) ? 1770 GrContext::kExact_ScratchTexMatc h;
1771 GrContext::kApprox_ScratchTexMatch :
1772 GrContext::kExact_ScratchTexMatch;
1773 texture.reset(fContext->refScratchTexture(desc, match)); 1771 texture.reset(fContext->refScratchTexture(desc, match));
1774 #else 1772 #else
1775 texture.reset(fContext->createUncachedTexture(desc, NULL, 0)); 1773 texture.reset(fContext->createUncachedTexture(desc, NULL, 0));
1776 #endif 1774 #endif
1777 if (texture.get()) { 1775 if (texture.get()) {
1778 return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLega cyFontHost_InitType), flags); 1776 return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLega cyFontHost_InitType), flags);
1779 } else { 1777 } else {
1780 GrPrintf("---- failed to create compatible device texture [%d %d]\n", 1778 GrPrintf("---- failed to create compatible device texture [%d %d]\n",
1781 info.width(), info.height()); 1779 info.width(), info.height());
1782 return NULL; 1780 return NULL;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled); 1835 GrLayerHoister::UnlockLayers(fContext, atlased, nonAtlased, recycled);
1838 1836
1839 return true; 1837 return true;
1840 } 1838 }
1841 1839
1842 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1840 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1843 // We always return a transient cache, so it is freed after each 1841 // We always return a transient cache, so it is freed after each
1844 // filter traversal. 1842 // filter traversal.
1845 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1843 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1846 } 1844 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698