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

Side by Side Diff: src/core/SkCanvas.cpp

Issue 1421493003: tunnel down texture-size-constraint to imagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix formating Created 5 years, 2 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 | « include/gpu/GrTextureProvider.h ('k') | src/core/SkImageFilter.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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1301 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1302 if (filter && !dstDev->canHandleImageFilter(filter)) { 1302 if (filter && !dstDev->canHandleImageFilter(filter)) {
1303 SkImageFilter::DeviceProxy proxy(dstDev); 1303 SkImageFilter::DeviceProxy proxy(dstDev);
1304 SkBitmap dst; 1304 SkBitmap dst;
1305 SkIPoint offset = SkIPoint::Make(0, 0); 1305 SkIPoint offset = SkIPoint::Make(0, 0);
1306 const SkBitmap& src = srcDev->accessBitmap(false); 1306 const SkBitmap& src = srcDev->accessBitmap(false);
1307 SkMatrix matrix = *iter.fMatrix; 1307 SkMatrix matrix = *iter.fMatrix;
1308 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1308 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1309 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ()); 1309 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ());
1310 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache ()); 1310 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache ());
1311 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1311 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
1312 SkImageFilter::kApprox_SizeConstraint);
1312 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { 1313 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
1313 SkPaint tmpUnfiltered(*paint); 1314 SkPaint tmpUnfiltered(*paint);
1314 tmpUnfiltered.setImageFilter(nullptr); 1315 tmpUnfiltered.setImageFilter(nullptr);
1315 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(), 1316 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(),
1316 tmpUnfiltered); 1317 tmpUnfiltered);
1317 } 1318 }
1318 } else if (deviceIsBitmapDevice) { 1319 } else if (deviceIsBitmapDevice) {
1319 const SkBitmap& src = static_cast<SkBitmapDevice*>(srcDev)->fBitmap; 1320 const SkBitmap& src = static_cast<SkBitmapDevice*>(srcDev)->fBitmap;
1320 dstDev->drawSprite(iter, src, pos.x(), pos.y(), *paint); 1321 dstDev->drawSprite(iter, src, pos.x(), pos.y(), *paint);
1321 } else { 1322 } else {
(...skipping 30 matching lines...) Expand all
1352 SkImageFilter* filter = paint->getImageFilter(); 1353 SkImageFilter* filter = paint->getImageFilter();
1353 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1354 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1354 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { 1355 if (filter && !iter.fDevice->canHandleImageFilter(filter)) {
1355 SkImageFilter::DeviceProxy proxy(iter.fDevice); 1356 SkImageFilter::DeviceProxy proxy(iter.fDevice);
1356 SkBitmap dst; 1357 SkBitmap dst;
1357 SkIPoint offset = SkIPoint::Make(0, 0); 1358 SkIPoint offset = SkIPoint::Make(0, 0);
1358 SkMatrix matrix = *iter.fMatrix; 1359 SkMatrix matrix = *iter.fMatrix;
1359 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1360 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1360 const SkIRect clipBounds = bitmap.bounds(); 1361 const SkIRect clipBounds = bitmap.bounds();
1361 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte rCache()); 1362 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte rCache());
1362 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1363 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(),
1364 SkImageFilter::kApprox_SizeConstraint);
1363 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { 1365 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
1364 SkPaint tmpUnfiltered(*paint); 1366 SkPaint tmpUnfiltered(*paint);
1365 tmpUnfiltered.setImageFilter(nullptr); 1367 tmpUnfiltered.setImageFilter(nullptr);
1366 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(), 1368 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(),
1367 tmpUnfiltered); 1369 tmpUnfiltered);
1368 } 1370 }
1369 } else { 1371 } else {
1370 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); 1372 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint);
1371 } 1373 }
1372 } 1374 }
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 } 2882 }
2881 2883
2882 if (matrix) { 2884 if (matrix) {
2883 canvas->concat(*matrix); 2885 canvas->concat(*matrix);
2884 } 2886 }
2885 } 2887 }
2886 2888
2887 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2889 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2888 fCanvas->restoreToCount(fSaveCount); 2890 fCanvas->restoreToCount(fSaveCount);
2889 } 2891 }
OLDNEW
« no previous file with comments | « include/gpu/GrTextureProvider.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698