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 LayoutSize adjusted_sub_pixel_accumulation; | 838 IntPoint rounded_delta = RoundedIntPoint(delta); |
839 if (transform.IsIdentityOrTranslation()) { | 839 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y()); |
840 IntPoint rounded_delta = RoundedIntPoint(delta); | 840 LayoutSize adjusted_sub_pixel_accumulation = |
841 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y()); | 841 painting_info.sub_pixel_accumulation + (delta - rounded_delta); |
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; | |
848 transform.PostTranslate(delta.X().ToDouble(), delta.Y().ToDouble()); | |
849 } | |
850 | 842 |
851 // TODO(jbroman): Put the real transform origin here, instead of using a | 843 // TODO(jbroman): Put the real transform origin here, instead of using a |
852 // matrix with the origin baked in. | 844 // matrix with the origin baked in. |
853 FloatPoint3D transform_origin; | 845 FloatPoint3D transform_origin; |
854 Transform3DRecorder transform3d_recorder( | 846 Transform3DRecorder transform3d_recorder( |
855 context, paint_layer_.GetLayoutObject(), | 847 context, paint_layer_.GetLayoutObject(), |
856 DisplayItem::kTransform3DElementTransform, transform, transform_origin); | 848 DisplayItem::kTransform3DElementTransform, transform, transform_origin); |
857 | 849 |
858 // Now do a paint with the root layer shifted to be us. | 850 // Now do a paint with the root layer shifted to be us. |
859 PaintLayerPaintingInfo transformed_painting_info( | 851 PaintLayerPaintingInfo transformed_painting_info( |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 context, layout_object, kPaintPhaseClippingMask)) | 1256 context, layout_object, kPaintPhaseClippingMask)) |
1265 return; | 1257 return; |
1266 | 1258 |
1267 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); | 1259 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); |
1268 LayoutObjectDrawingRecorder drawing_recorder( | 1260 LayoutObjectDrawingRecorder drawing_recorder( |
1269 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); | 1261 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); |
1270 context.FillRect(snapped_clip_rect, Color::kBlack); | 1262 context.FillRect(snapped_clip_rect, Color::kBlack); |
1271 } | 1263 } |
1272 | 1264 |
1273 } // namespace blink | 1265 } // namespace blink |
OLD | NEW |