Chromium Code Reviews| Index: cc/output/render_surface_filters.cc |
| diff --git a/cc/output/render_surface_filters.cc b/cc/output/render_surface_filters.cc |
| index 34e056dad521be2fa8a3260c904790aceee3fa3d..581a6717c6ec4a5824734cf6d6fe239cdb25a4e8 100644 |
| --- a/cc/output/render_surface_filters.cc |
| +++ b/cc/output/render_surface_filters.cc |
| @@ -263,9 +263,22 @@ skia::RefPtr<SkImageFilter> RenderSurfaceFilters::BuildImageFilter( |
| break; |
| } |
| case FilterOperation::ALPHA_THRESHOLD: { |
| - skia::RefPtr<SkImageFilter> alpha_filter = skia::AdoptRef( |
| - SkAlphaThresholdFilter::Create( |
| - op.region(), op.amount(), op.outer_threshold())); |
| + // Scale the region by the device_scale_factor to properly handle |
| + // HiDPI devices. Since there is no SkRegion scaling, we convert to |
| + // a path, scale the path and then convert back to a SkRegion. |
| + SkPath path; |
| + op.region().getBoundaryPath(&path); |
| + SkMatrix scale; |
| + scale.setScale(op.device_scale_factor(), op.device_scale_factor()); |
| + path.transform(scale); |
| + SkRegion clip; |
| + clip.setRect(0, 0, size.width(), size.height()); |
| + SkRegion scaled_shape; |
| + scaled_shape.setPath(path, clip); |
| + |
| + skia::RefPtr<SkImageFilter> alpha_filter = |
| + skia::AdoptRef(SkAlphaThresholdFilter::Create( |
|
danakj
2014/06/17 21:35:28
Can we just add the scale to this SkAlphaThreshold
garykac
2014/07/10 23:02:24
Done.
|
| + scaled_shape, op.amount(), op.outer_threshold())); |
|
danakj
2014/06/17 21:42:01
If you put a transform on the ui::Layer with a sca
garykac
2014/07/10 23:02:24
I tested this and we need to pass the layer scale
|
| if (image_filter.get()) { |
| image_filter = skia::AdoptRef(SkComposeImageFilter::Create( |
| alpha_filter.get(), image_filter.get())); |