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

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

Issue 728433002: Revert of move to modify onCreateDevice virtual (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 | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.cpp » ('j') | 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 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1744 return false; 1744 return false;
1745 } 1745 }
1746 1746
1747 void SkGpuDevice::flush() { 1747 void SkGpuDevice::flush() {
1748 DO_DEFERRED_CLEAR(); 1748 DO_DEFERRED_CLEAR();
1749 fRenderTarget->prepareForExternalRead(); 1749 fRenderTarget->prepareForExternalRead();
1750 } 1750 }
1751 1751
1752 /////////////////////////////////////////////////////////////////////////////// 1752 ///////////////////////////////////////////////////////////////////////////////
1753 1753
1754 SkBaseDevice* SkGpuDevice::onCreateCompatibleDevice(const CreateInfo& cinfo) { 1754 SkBaseDevice* SkGpuDevice::onCreateDevice(const SkImageInfo& info, Usage usage) {
1755 GrSurfaceDesc desc; 1755 GrSurfaceDesc desc;
1756 desc.fConfig = fRenderTarget->config(); 1756 desc.fConfig = fRenderTarget->config();
1757 desc.fFlags = kRenderTarget_GrSurfaceFlag; 1757 desc.fFlags = kRenderTarget_GrSurfaceFlag;
1758 desc.fWidth = cinfo.fInfo.width(); 1758 desc.fWidth = info.width();
1759 desc.fHeight = cinfo.fInfo.height(); 1759 desc.fHeight = info.height();
1760 desc.fSampleCnt = fRenderTarget->numSamples(); 1760 desc.fSampleCnt = fRenderTarget->numSamples();
1761 1761
1762 SkAutoTUnref<GrTexture> texture; 1762 SkAutoTUnref<GrTexture> texture;
1763 // Skia's convention is to only clear a device if it is non-opaque. 1763 // Skia's convention is to only clear a device if it is non-opaque.
1764 unsigned flags = cinfo.fInfo.isOpaque() ? 0 : kNeedClear_Flag; 1764 unsigned flags = info.isOpaque() ? 0 : kNeedClear_Flag;
1765 // If we're using distance field text, enable in the new device 1765 // If we're using distance field text, enable in the new device
1766 flags |= (fFlags & kDFText_Flag) ? kDFText_Flag : 0; 1766 flags |= (fFlags & kDFText_Flag) ? kDFText_Flag : 0;
1767 1767
1768 #if CACHE_COMPATIBLE_DEVICE_TEXTURES 1768 #if CACHE_COMPATIBLE_DEVICE_TEXTURES
1769 // layers are never draw in repeat modes, so we can request an approx 1769 // layers are never draw in repeat modes, so we can request an approx
1770 // match and ignore any padding. 1770 // match and ignore any padding.
1771 const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == cinfo.fUsage) ? 1771 const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == usage) ?
1772 GrContext::kApprox_ScratchTexMat ch : 1772 GrContext::kApprox_ScratchTexMat ch :
1773 GrContext::kExact_ScratchTexMatc h; 1773 GrContext::kExact_ScratchTexMatc h;
1774 texture.reset(fContext->refScratchTexture(desc, match)); 1774 texture.reset(fContext->refScratchTexture(desc, match));
1775 #else 1775 #else
1776 texture.reset(fContext->createUncachedTexture(desc, NULL, 0)); 1776 texture.reset(fContext->createUncachedTexture(desc, NULL, 0));
1777 #endif 1777 #endif
1778 if (texture.get()) { 1778 if (texture.get()) {
1779 return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLega cyFontHost_InitType), flags); 1779 return SkGpuDevice::Create(texture, SkSurfaceProps(SkSurfaceProps::kLega cyFontHost_InitType), flags);
1780 } else { 1780 } else {
1781 SkDebugf("---- failed to create compatible device texture [%d %d]\n", 1781 SkDebugf("---- failed to create compatible device texture [%d %d]\n",
1782 cinfo.fInfo.width(), cinfo.fInfo.height()); 1782 info.width(), info.height());
1783 return NULL; 1783 return NULL;
1784 } 1784 }
1785 } 1785 }
1786 1786
1787 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) { 1787 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) {
1788 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( ), &props); 1788 return SkSurface::NewRenderTarget(fContext, info, fRenderTarget->numSamples( ), &props);
1789 } 1789 }
1790 1790
1791 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture, 1791 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture,
1792 const SkMatrix* matrix, const SkPaint * paint) { 1792 const SkMatrix* matrix, const SkPaint * paint) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 return true; 1843 return true;
1844 } 1844 }
1845 1845
1846 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1846 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1847 // We always return a transient cache, so it is freed after each 1847 // We always return a transient cache, so it is freed after each
1848 // filter traversal. 1848 // filter traversal.
1849 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1849 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1850 } 1850 }
1851 1851
1852 #endif 1852 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698