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

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

Issue 646213003: Add `SkIRect bounds()` convenience method to SkImageInfo and SkBitmap. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: reed nits Created 6 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/core/SkImageInfo.h ('k') | src/lazy/SkCachingPixelRef.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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasPriv.h" 9 #include "SkCanvasPriv.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 while (iter.next()) { 1253 while (iter.next()) {
1254 paint = &looper.paint(); 1254 paint = &looper.paint();
1255 SkImageFilter* filter = paint->getImageFilter(); 1255 SkImageFilter* filter = paint->getImageFilter();
1256 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1256 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1257 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { 1257 if (filter && !iter.fDevice->canHandleImageFilter(filter)) {
1258 SkDeviceImageFilterProxy proxy(iter.fDevice); 1258 SkDeviceImageFilterProxy proxy(iter.fDevice);
1259 SkBitmap dst; 1259 SkBitmap dst;
1260 SkIPoint offset = SkIPoint::Make(0, 0); 1260 SkIPoint offset = SkIPoint::Make(0, 0);
1261 SkMatrix matrix = *iter.fMatrix; 1261 SkMatrix matrix = *iter.fMatrix;
1262 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1262 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1263 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height() ); 1263 const SkIRect clipBounds = bitmap.bounds();
1264 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte rCache()); 1264 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte rCache());
1265 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1265 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
1266 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { 1266 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
1267 SkPaint tmpUnfiltered(*paint); 1267 SkPaint tmpUnfiltered(*paint);
1268 tmpUnfiltered.setImageFilter(NULL); 1268 tmpUnfiltered.setImageFilter(NULL);
1269 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(), 1269 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(),
1270 tmpUnfiltered); 1270 tmpUnfiltered);
1271 } 1271 }
1272 } else { 1272 } else {
1273 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); 1273 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint);
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 } 2550 }
2551 2551
2552 if (matrix) { 2552 if (matrix) {
2553 canvas->concat(*matrix); 2553 canvas->concat(*matrix);
2554 } 2554 }
2555 } 2555 }
2556 2556
2557 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2557 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2558 fCanvas->restoreToCount(fSaveCount); 2558 fCanvas->restoreToCount(fSaveCount);
2559 } 2559 }
OLDNEW
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/lazy/SkCachingPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698