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

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

Issue 929243004: adding preabandon flag to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback incorporated Created 5 years, 10 months 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/gpu/SkGr.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 "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 if (!bitmap.getTexture() && !bitmap.readyToDraw()) { 1487 if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
1488 return; 1488 return;
1489 } 1489 }
1490 1490
1491 int w = bitmap.width(); 1491 int w = bitmap.width();
1492 int h = bitmap.height(); 1492 int h = bitmap.height();
1493 1493
1494 GrTexture* texture; 1494 GrTexture* texture;
1495 // draw sprite uses the default texture params 1495 // draw sprite uses the default texture params
1496 AutoBitmapTexture abt(fContext, bitmap, NULL, &texture); 1496 AutoBitmapTexture abt(fContext, bitmap, NULL, &texture);
1497 if (!texture) {
1498 return;
1499 }
1497 1500
1498 SkImageFilter* filter = paint.getImageFilter(); 1501 SkImageFilter* filter = paint.getImageFilter();
1499 // This bitmap will own the filtered result as a texture. 1502 // This bitmap will own the filtered result as a texture.
1500 SkBitmap filteredBitmap; 1503 SkBitmap filteredBitmap;
1501 1504
1502 if (filter) { 1505 if (filter) {
1503 SkIPoint offset = SkIPoint::Make(0, 0); 1506 SkIPoint offset = SkIPoint::Make(0, 0);
1504 SkMatrix matrix(*draw.fMatrix); 1507 SkMatrix matrix(*draw.fMatrix);
1505 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); 1508 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
1506 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); 1509 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 // match and ignore any padding. 1878 // match and ignore any padding.
1876 const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == cinfo.fUsage) ? 1879 const GrContext::ScratchTexMatch match = (kSaveLayer_Usage == cinfo.fUsage) ?
1877 GrContext::kApprox_ScratchTexMat ch : 1880 GrContext::kApprox_ScratchTexMat ch :
1878 GrContext::kExact_ScratchTexMatc h; 1881 GrContext::kExact_ScratchTexMatc h;
1879 texture.reset(fContext->refScratchTexture(desc, match)); 1882 texture.reset(fContext->refScratchTexture(desc, match));
1880 1883
1881 if (texture) { 1884 if (texture) {
1882 SkSurfaceProps props(fSurfaceProps.flags(), cinfo.fPixelGeometry); 1885 SkSurfaceProps props(fSurfaceProps.flags(), cinfo.fPixelGeometry);
1883 return SkGpuDevice::Create(texture->asRenderTarget(), &props, flags); 1886 return SkGpuDevice::Create(texture->asRenderTarget(), &props, flags);
1884 } else { 1887 } else {
1885 SkDebugf("---- failed to create compatible device texture [%d %d]\n", 1888 SkErrorInternals::SetError( kInternalError_SkError,
1886 cinfo.fInfo.width(), cinfo.fInfo.height()); 1889 "---- failed to create compatible device tex ture [%d %d]\n",
1890 cinfo.fInfo.width(), cinfo.fInfo.height());
1887 return NULL; 1891 return NULL;
1888 } 1892 }
1889 } 1893 }
1890 1894
1891 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) { 1895 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) {
1892 // TODO: Change the signature of newSurface to take a budgeted parameter. 1896 // TODO: Change the signature of newSurface to take a budgeted parameter.
1893 static const SkSurface::Budgeted kBudgeted = SkSurface::kNo_Budgeted; 1897 static const SkSurface::Budgeted kBudgeted = SkSurface::kNo_Budgeted;
1894 return SkSurface::NewRenderTarget(fContext, kBudgeted, info, fRenderTarget-> numSamples(), 1898 return SkSurface::NewRenderTarget(fContext, kBudgeted, info, fRenderTarget-> numSamples(),
1895 &props); 1899 &props);
1896 } 1900 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 #endif 1965 #endif
1962 } 1966 }
1963 1967
1964 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1968 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1965 // We always return a transient cache, so it is freed after each 1969 // We always return a transient cache, so it is freed after each
1966 // filter traversal. 1970 // filter traversal.
1967 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1971 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1968 } 1972 }
1969 1973
1970 #endif 1974 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698