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

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

Issue 1616503002: Remove SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS (now unused). (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/effects/SkTileImageFilter.cpp ('k') | 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 "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 bool alphaOnly = kAlpha_8_SkColorType == bitmap.colorType(); 1164 bool alphaOnly = kAlpha_8_SkColorType == bitmap.colorType();
1165 1165
1166 SkImageFilter* filter = paint.getImageFilter(); 1166 SkImageFilter* filter = paint.getImageFilter();
1167 // This bitmap will own the filtered result as a texture. 1167 // This bitmap will own the filtered result as a texture.
1168 SkBitmap filteredBitmap; 1168 SkBitmap filteredBitmap;
1169 1169
1170 if (filter) { 1170 if (filter) {
1171 SkIPoint offset = SkIPoint::Make(0, 0); 1171 SkIPoint offset = SkIPoint::Make(0, 0);
1172 SkMatrix matrix(*draw.fMatrix); 1172 SkMatrix matrix(*draw.fMatrix);
1173 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top)); 1173 matrix.postTranslate(SkIntToScalar(-left), SkIntToScalar(-top));
1174 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
1175 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
1176 #else
1177 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-left, -top); 1174 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-left, -top);
1178 #endif
1179 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1175 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1180 // This cache is transient, and is freed (along with all its contained 1176 // This cache is transient, and is freed (along with all its contained
1181 // textures) when it goes out of scope. 1177 // textures) when it goes out of scope.
1182 SkImageFilter::Context ctx(matrix, clipBounds, cache); 1178 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1183 if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredB itmap, 1179 if (this->filterTexture(fContext, texture, w, h, filter, ctx, &filteredB itmap,
1184 &offset)) { 1180 &offset)) {
1185 texture = (GrTexture*) filteredBitmap.getTexture(); 1181 texture = (GrTexture*) filteredBitmap.getTexture();
1186 w = filteredBitmap.width(); 1182 w = filteredBitmap.width();
1187 h = filteredBitmap.height(); 1183 h = filteredBitmap.height();
1188 left += offset.x(); 1184 left += offset.x();
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 int h = ii.height(); 1328 int h = ii.height();
1333 1329
1334 SkImageFilter* filter = paint.getImageFilter(); 1330 SkImageFilter* filter = paint.getImageFilter();
1335 // This bitmap will own the filtered result as a texture. 1331 // This bitmap will own the filtered result as a texture.
1336 SkBitmap filteredBitmap; 1332 SkBitmap filteredBitmap;
1337 1333
1338 if (filter) { 1334 if (filter) {
1339 SkIPoint offset = SkIPoint::Make(0, 0); 1335 SkIPoint offset = SkIPoint::Make(0, 0);
1340 SkMatrix matrix(*draw.fMatrix); 1336 SkMatrix matrix(*draw.fMatrix);
1341 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 1337 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
1342 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
1343 SkIRect clipBounds = SkIRect::MakeWH(devTex->width(), devTex->height());
1344 #else
1345 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); 1338 SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
1346 #endif
1347 // This cache is transient, and is freed (along with all its contained 1339 // This cache is transient, and is freed (along with all its contained
1348 // textures) when it goes out of scope. 1340 // textures) when it goes out of scope.
1349 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache()); 1341 SkAutoTUnref<SkImageFilter::Cache> cache(getImageFilterCache());
1350 SkImageFilter::Context ctx(matrix, clipBounds, cache); 1342 SkImageFilter::Context ctx(matrix, clipBounds, cache);
1351 if (this->filterTexture(fContext, devTex, device->width(), device->heigh t(), 1343 if (this->filterTexture(fContext, devTex, device->width(), device->heigh t(),
1352 filter, ctx, &filteredBitmap, &offset)) { 1344 filter, ctx, &filteredBitmap, &offset)) {
1353 devTex = filteredBitmap.getTexture(); 1345 devTex = filteredBitmap.getTexture();
1354 w = filteredBitmap.width(); 1346 w = filteredBitmap.width();
1355 h = filteredBitmap.height(); 1347 h = filteredBitmap.height();
1356 x += offset.fX; 1348 x += offset.fX;
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 } 1900 }
1909 1901
1910 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1902 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1911 ASSERT_SINGLE_OWNER 1903 ASSERT_SINGLE_OWNER
1912 // We always return a transient cache, so it is freed after each 1904 // We always return a transient cache, so it is freed after each
1913 // filter traversal. 1905 // filter traversal.
1914 return SkGpuDevice::NewImageFilterCache(); 1906 return SkGpuDevice::NewImageFilterCache();
1915 } 1907 }
1916 1908
1917 #endif 1909 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698