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

Unified Diff: cc/render_surface_filters.cc

Issue 12816002: Make zoom filter independent of the layer size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/render_pass.h ('k') | content/common/cc_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/render_surface_filters.cc
diff --git a/cc/render_surface_filters.cc b/cc/render_surface_filters.cc
index d5edeb51069db787921ab3048c00d4afdea0ec23..1933e537275a7b7cf2ae66560e64ffcb9ef13500 100644
--- a/cc/render_surface_filters.cc
+++ b/cc/render_surface_filters.cc
@@ -424,18 +424,23 @@ SkBitmap RenderSurfaceFilters::Apply(const WebKit::WebFilterOperations& filters,
break;
}
case WebKit::WebFilterOperation::FilterTypeZoom: {
+#ifdef NEW_ZOOM_FILTER // TODO(danakj): Remove this when WebKit rolls.
SkPaint paint;
+ int width = state.Source().width();
+ int height = state.Source().height();
skia::RefPtr<SkImageFilter> zoom_filter = skia::AdoptRef(
new SkMagnifierImageFilter(
- SkRect::MakeXYWH(op.zoomRect().x,
- op.zoomRect().y,
- op.zoomRect().width,
- op.zoomRect().height),
- op.amount()));
+ SkRect::MakeXYWH(
+ (width - (width / op.amount())) / 2.f,
+ (height - (height / op.amount())) / 2.f,
+ width / op.amount(),
+ height / op.amount()),
+ op.zoomInset()));
paint.setImageFilter(zoom_filter.get());
canvas->saveLayer(NULL, &paint);
canvas->drawBitmap(state.Source(), 0, 0);
canvas->restore();
+#endif
break;
}
case WebKit::WebFilterOperation::FilterTypeBrightness:
« no previous file with comments | « cc/render_pass.h ('k') | content/common/cc_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698