OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/PaintLayerPainter.h" | 5 #include "core/paint/PaintLayerPainter.h" |
6 | 6 |
7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
9 #include "core/paint/ClipPathClipper.h" | 9 #include "core/paint/ClipPathClipper.h" |
10 #include "core/paint/FilterPainter.h" | 10 #include "core/paint/FilterPainter.h" |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 PaintLayerFlags paint_flags, | 828 PaintLayerFlags paint_flags, |
829 const LayoutPoint& fragment_translation) { | 829 const LayoutPoint& fragment_translation) { |
830 // This involves subtracting out the position of the layer in our current | 830 // This involves subtracting out the position of the layer in our current |
831 // coordinate space, but preserving the accumulated error for sub-pixel | 831 // coordinate space, but preserving the accumulated error for sub-pixel |
832 // layout. | 832 // layout. |
833 LayoutPoint delta; | 833 LayoutPoint delta; |
834 paint_layer_.ConvertToLayerCoords(painting_info.root_layer, delta); | 834 paint_layer_.ConvertToLayerCoords(painting_info.root_layer, delta); |
835 delta.MoveBy(fragment_translation); | 835 delta.MoveBy(fragment_translation); |
836 TransformationMatrix transform( | 836 TransformationMatrix transform( |
837 paint_layer_.RenderableTransform(painting_info.GetGlobalPaintFlags())); | 837 paint_layer_.RenderableTransform(painting_info.GetGlobalPaintFlags())); |
838 IntPoint rounded_delta = RoundedIntPoint(delta); | 838 LayoutSize adjusted_sub_pixel_accumulation; |
839 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y()); | 839 if (transform.IsIdentityOrTranslation()) { |
840 LayoutSize adjusted_sub_pixel_accumulation = | 840 IntPoint rounded_delta = RoundedIntPoint(delta); |
841 painting_info.sub_pixel_accumulation + (delta - rounded_delta); | 841 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y()); |
842 adjusted_sub_pixel_accumulation = | |
843 painting_info.sub_pixel_accumulation + (delta - rounded_delta); | |
844 } else { | |
845 // We can't pass subpixel offsets through a non-translation transform. | |
846 // Bake the offsets into the transform instead. | |
847 delta += painting_info.sub_pixel_accumulation; | |
chrishtr
2017/05/04 18:39:02
Perhaps the bug here that caused issue 716163 is t
| |
848 transform.PostTranslate(delta.X().ToDouble(), delta.Y().ToDouble()); | |
849 } | |
842 | 850 |
843 // TODO(jbroman): Put the real transform origin here, instead of using a | 851 // TODO(jbroman): Put the real transform origin here, instead of using a |
844 // matrix with the origin baked in. | 852 // matrix with the origin baked in. |
845 FloatPoint3D transform_origin; | 853 FloatPoint3D transform_origin; |
846 Transform3DRecorder transform3d_recorder( | 854 Transform3DRecorder transform3d_recorder( |
847 context, paint_layer_.GetLayoutObject(), | 855 context, paint_layer_.GetLayoutObject(), |
848 DisplayItem::kTransform3DElementTransform, transform, transform_origin); | 856 DisplayItem::kTransform3DElementTransform, transform, transform_origin); |
849 | 857 |
850 // Now do a paint with the root layer shifted to be us. | 858 // Now do a paint with the root layer shifted to be us. |
851 PaintLayerPaintingInfo transformed_painting_info( | 859 PaintLayerPaintingInfo transformed_painting_info( |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1256 context, layout_object, kPaintPhaseClippingMask)) | 1264 context, layout_object, kPaintPhaseClippingMask)) |
1257 return; | 1265 return; |
1258 | 1266 |
1259 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); | 1267 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); |
1260 LayoutObjectDrawingRecorder drawing_recorder( | 1268 LayoutObjectDrawingRecorder drawing_recorder( |
1261 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); | 1269 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); |
1262 context.FillRect(snapped_clip_rect, Color::kBlack); | 1270 context.FillRect(snapped_clip_rect, Color::kBlack); |
1263 } | 1271 } |
1264 | 1272 |
1265 } // namespace blink | 1273 } // namespace blink |
OLD | NEW |