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

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

Issue 222723002: Fix matrix adjustment passed to filter processing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 SkBaseDevice* dstDev = iter.fDevice; 1249 SkBaseDevice* dstDev = iter.fDevice;
1250 paint = &looper.paint(); 1250 paint = &looper.paint();
1251 SkImageFilter* filter = paint->getImageFilter(); 1251 SkImageFilter* filter = paint->getImageFilter();
1252 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1252 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1253 if (filter && !dstDev->canHandleImageFilter(filter)) { 1253 if (filter && !dstDev->canHandleImageFilter(filter)) {
1254 SkDeviceImageFilterProxy proxy(dstDev); 1254 SkDeviceImageFilterProxy proxy(dstDev);
1255 SkBitmap dst; 1255 SkBitmap dst;
1256 SkIPoint offset = SkIPoint::Make(0, 0); 1256 SkIPoint offset = SkIPoint::Make(0, 0);
1257 const SkBitmap& src = srcDev->accessBitmap(false); 1257 const SkBitmap& src = srcDev->accessBitmap(false);
1258 SkMatrix matrix = *iter.fMatrix; 1258 SkMatrix matrix = *iter.fMatrix;
1259 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 1259 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1260 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ()); 1260 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ());
1261 SkImageFilter::Context ctx(matrix, clipBounds); 1261 SkImageFilter::Context ctx(matrix, clipBounds);
1262 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { 1262 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
1263 SkPaint tmpUnfiltered(*paint); 1263 SkPaint tmpUnfiltered(*paint);
1264 tmpUnfiltered.setImageFilter(NULL); 1264 tmpUnfiltered.setImageFilter(NULL);
1265 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(), 1265 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(),
1266 tmpUnfiltered); 1266 tmpUnfiltered);
1267 } 1267 }
1268 } else { 1268 } else {
1269 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); 1269 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint);
(...skipping 19 matching lines...) Expand all
1289 1289
1290 while (iter.next()) { 1290 while (iter.next()) {
1291 paint = &looper.paint(); 1291 paint = &looper.paint();
1292 SkImageFilter* filter = paint->getImageFilter(); 1292 SkImageFilter* filter = paint->getImageFilter();
1293 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1293 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1294 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { 1294 if (filter && !iter.fDevice->canHandleImageFilter(filter)) {
1295 SkDeviceImageFilterProxy proxy(iter.fDevice); 1295 SkDeviceImageFilterProxy proxy(iter.fDevice);
1296 SkBitmap dst; 1296 SkBitmap dst;
1297 SkIPoint offset = SkIPoint::Make(0, 0); 1297 SkIPoint offset = SkIPoint::Make(0, 0);
1298 SkMatrix matrix = *iter.fMatrix; 1298 SkMatrix matrix = *iter.fMatrix;
1299 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 1299 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1300 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height() ); 1300 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height() );
1301 SkImageFilter::Context ctx(matrix, clipBounds); 1301 SkImageFilter::Context ctx(matrix, clipBounds);
1302 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { 1302 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
1303 SkPaint tmpUnfiltered(*paint); 1303 SkPaint tmpUnfiltered(*paint);
1304 tmpUnfiltered.setImageFilter(NULL); 1304 tmpUnfiltered.setImageFilter(NULL);
1305 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(), 1305 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(),
1306 tmpUnfiltered); 1306 tmpUnfiltered);
1307 } 1307 }
1308 } else { 1308 } else {
1309 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); 1309 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint);
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2648 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2649 return NULL; 2649 return NULL;
2650 } 2650 }
2651 2651
2652 // should this functionality be moved into allocPixels()? 2652 // should this functionality be moved into allocPixels()?
2653 if (!bitmap.info().isOpaque()) { 2653 if (!bitmap.info().isOpaque()) {
2654 bitmap.eraseColor(0); 2654 bitmap.eraseColor(0);
2655 } 2655 }
2656 return SkNEW_ARGS(SkCanvas, (bitmap)); 2656 return SkNEW_ARGS(SkCanvas, (bitmap));
2657 } 2657 }
OLDNEW
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698