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

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

Issue 1571033002: remove imagefilter::sizeconstraint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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/GrLayerHoister.cpp ('k') | tests/ImageFilterTest.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 "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 SkMatrix matrix(*draw.fMatrix); 1150 SkMatrix matrix(*draw.fMatrix);
1151 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); 1151 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
1152 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS 1152 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
1153 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height()); 1153 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
1154 #else 1154 #else
1155 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-left, -top); 1155 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-left, -top);
1156 #endif 1156 #endif
1157 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1157 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1158 // This cache is transient, and is freed (along with all its contained 1158 // This cache is transient, and is freed (along with all its contained
1159 // textures) when it goes out of scope. 1159 // textures) when it goes out of scope.
1160 SkImageFilter::Context ctx(matrix, clipBounds, cache, SkImageFilter::kAp prox_SizeConstraint); 1160 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1161 if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredB itmap, 1161 if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredB itmap,
1162 &offset)) { 1162 &offset)) {
1163 texture = (GrTexture*) filteredBitmap.getTexture(); 1163 texture = (GrTexture*) filteredBitmap.getTexture();
1164 w = filteredBitmap.width(); 1164 w = filteredBitmap.width();
1165 h = filteredBitmap.height(); 1165 h = filteredBitmap.height();
1166 left += offset.x(); 1166 left += offset.x();
1167 top += offset.y(); 1167 top += offset.y();
1168 } else { 1168 } else {
1169 return; 1169 return;
1170 } 1170 }
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 SkMatrix matrix(*draw.fMatrix); 1316 SkMatrix matrix(*draw.fMatrix);
1317 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 1317 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
1318 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS 1318 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
1319 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height()); 1319 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height());
1320 #else 1320 #else
1321 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); 1321 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
1322 #endif 1322 #endif
1323 // This cache is transient, and is freed (along with all its contained 1323 // This cache is transient, and is freed (along with all its contained
1324 // textures) when it goes out of scope. 1324 // textures) when it goes out of scope.
1325 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1325 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1326 SkImageFilter::Context ctx(matrix, clipBounds, cache, SkImageFilter::kAp prox_SizeConstraint); 1326 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1327 if (this->filterTexture(fContext, devTex, device->width(), device->heigh t(), 1327 if (this->filterTexture(fContext, devTex, device->width(), device->heigh t(),
1328 filter, ctx, &filteredBitmap, &offset)) { 1328 filter, ctx, &filteredBitmap, &offset)) {
1329 devTex = filteredBitmap.getTexture(); 1329 devTex = filteredBitmap.getTexture();
1330 w = filteredBitmap.width(); 1330 w = filteredBitmap.width();
1331 h = filteredBitmap.height(); 1331 h = filteredBitmap.height();
1332 x += offset.fX; 1332 x += offset.fX;
1333 y += offset.fY; 1333 y += offset.fY;
1334 } else { 1334 } else {
1335 return; 1335 return;
1336 } 1336 }
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1860 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1861 } 1861 }
1862 1862
1863 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1863 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1864 // We always return a transient cache, so it is freed after each 1864 // We always return a transient cache, so it is freed after each
1865 // filter traversal. 1865 // filter traversal.
1866 return SkGpuDevice::NewImageFilterCache(); 1866 return SkGpuDevice::NewImageFilterCache();
1867 } 1867 }
1868 1868
1869 #endif 1869 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerHoister.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698