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

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

Issue 452923002: Remove external SkImageFilter cache, and rename UniqueIDCache -> Cache. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/core/SkBitmapDevice.cpp ('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 8
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 SkImageFilter* filter = paint->getImageFilter(); 1127 SkImageFilter* filter = paint->getImageFilter();
1128 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1128 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1129 if (filter && !dstDev->canHandleImageFilter(filter)) { 1129 if (filter && !dstDev->canHandleImageFilter(filter)) {
1130 SkDeviceImageFilterProxy proxy(dstDev); 1130 SkDeviceImageFilterProxy proxy(dstDev);
1131 SkBitmap dst; 1131 SkBitmap dst;
1132 SkIPoint offset = SkIPoint::Make(0, 0); 1132 SkIPoint offset = SkIPoint::Make(0, 0);
1133 const SkBitmap& src = srcDev->accessBitmap(false); 1133 const SkBitmap& src = srcDev->accessBitmap(false);
1134 SkMatrix matrix = *iter.fMatrix; 1134 SkMatrix matrix = *iter.fMatrix;
1135 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1135 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1136 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ()); 1136 SkIRect clipBounds = SkIRect::MakeWH(srcDev->width(), srcDev->height ());
1137 SkAutoTUnref<SkImageFilter::UniqueIDCache> cache(dstDev->getImageFil terCache()); 1137 SkAutoTUnref<SkImageFilter::Cache> cache(dstDev->getImageFilterCache ());
1138 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1138 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
1139 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) { 1139 if (filter->filterImage(&proxy, src, ctx, &dst, &offset)) {
1140 SkPaint tmpUnfiltered(*paint); 1140 SkPaint tmpUnfiltered(*paint);
1141 tmpUnfiltered.setImageFilter(NULL); 1141 tmpUnfiltered.setImageFilter(NULL);
1142 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(), 1142 dstDev->drawSprite(iter, dst, pos.x() + offset.x(), pos.y() + of fset.y(),
1143 tmpUnfiltered); 1143 tmpUnfiltered);
1144 } 1144 }
1145 } else { 1145 } else {
1146 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); 1146 dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint);
1147 } 1147 }
(...skipping 19 matching lines...) Expand all
1167 paint = &looper.paint(); 1167 paint = &looper.paint();
1168 SkImageFilter* filter = paint->getImageFilter(); 1168 SkImageFilter* filter = paint->getImageFilter();
1169 SkIPoint pos = { x - iter.getX(), y - iter.getY() }; 1169 SkIPoint pos = { x - iter.getX(), y - iter.getY() };
1170 if (filter && !iter.fDevice->canHandleImageFilter(filter)) { 1170 if (filter && !iter.fDevice->canHandleImageFilter(filter)) {
1171 SkDeviceImageFilterProxy proxy(iter.fDevice); 1171 SkDeviceImageFilterProxy proxy(iter.fDevice);
1172 SkBitmap dst; 1172 SkBitmap dst;
1173 SkIPoint offset = SkIPoint::Make(0, 0); 1173 SkIPoint offset = SkIPoint::Make(0, 0);
1174 SkMatrix matrix = *iter.fMatrix; 1174 SkMatrix matrix = *iter.fMatrix;
1175 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() )); 1175 matrix.postTranslate(SkIntToScalar(-pos.x()), SkIntToScalar(-pos.y() ));
1176 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height() ); 1176 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height() );
1177 SkAutoTUnref<SkImageFilter::UniqueIDCache> cache(iter.fDevice->getIm ageFilterCache()); 1177 SkAutoTUnref<SkImageFilter::Cache> cache(iter.fDevice->getImageFilte rCache());
1178 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 1178 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
1179 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { 1179 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) {
1180 SkPaint tmpUnfiltered(*paint); 1180 SkPaint tmpUnfiltered(*paint);
1181 tmpUnfiltered.setImageFilter(NULL); 1181 tmpUnfiltered.setImageFilter(NULL);
1182 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(), 1182 iter.fDevice->drawSprite(iter, dst, pos.x() + offset.x(), pos.y( ) + offset.y(),
1183 tmpUnfiltered); 1183 tmpUnfiltered);
1184 } 1184 }
1185 } else { 1185 } else {
1186 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); 1186 iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint);
1187 } 1187 }
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 if (!supported_for_raster_canvas(info)) { 2504 if (!supported_for_raster_canvas(info)) {
2505 return NULL; 2505 return NULL;
2506 } 2506 }
2507 2507
2508 SkBitmap bitmap; 2508 SkBitmap bitmap;
2509 if (!bitmap.installPixels(info, pixels, rowBytes)) { 2509 if (!bitmap.installPixels(info, pixels, rowBytes)) {
2510 return NULL; 2510 return NULL;
2511 } 2511 }
2512 return SkNEW_ARGS(SkCanvas, (bitmap)); 2512 return SkNEW_ARGS(SkCanvas, (bitmap));
2513 } 2513 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698