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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2847873002: Don't pass subpixel offsets through non-translation transforms (Closed)
Patch Set: Fix LayoutBox::MapVisualRectToContainer()? Created 3 years, 7 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
OLDNEW
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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 PaintLayerFlags paint_flags, 823 PaintLayerFlags paint_flags,
824 const LayoutPoint& fragment_translation) { 824 const LayoutPoint& fragment_translation) {
825 // This involves subtracting out the position of the layer in our current 825 // This involves subtracting out the position of the layer in our current
826 // coordinate space, but preserving the accumulated error for sub-pixel 826 // coordinate space, but preserving the accumulated error for sub-pixel
827 // layout. 827 // layout.
828 LayoutPoint delta; 828 LayoutPoint delta;
829 paint_layer_.ConvertToLayerCoords(painting_info.root_layer, delta); 829 paint_layer_.ConvertToLayerCoords(painting_info.root_layer, delta);
830 delta.MoveBy(fragment_translation); 830 delta.MoveBy(fragment_translation);
831 TransformationMatrix transform( 831 TransformationMatrix transform(
832 paint_layer_.RenderableTransform(painting_info.GetGlobalPaintFlags())); 832 paint_layer_.RenderableTransform(painting_info.GetGlobalPaintFlags()));
833 IntPoint rounded_delta = RoundedIntPoint(delta); 833 LayoutSize adjusted_sub_pixel_accumulation;
834 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y()); 834 if (transform.IsIdentityOrTranslation()) {
835 LayoutSize adjusted_sub_pixel_accumulation = 835 IntPoint rounded_delta = RoundedIntPoint(delta);
836 painting_info.sub_pixel_accumulation + (delta - rounded_delta); 836 transform.PostTranslate(rounded_delta.X(), rounded_delta.Y());
837 adjusted_sub_pixel_accumulation =
838 painting_info.sub_pixel_accumulation + (delta - rounded_delta);
839 } else {
840 // We can't pass subpixel offsets through a non-translation transform.
841 // Bake the offsets into the transform instead.
842 delta += painting_info.sub_pixel_accumulation;
843 transform.PostTranslate(delta.X().ToDouble(), delta.Y().ToDouble());
844 }
837 845
838 // TODO(jbroman): Put the real transform origin here, instead of using a 846 // TODO(jbroman): Put the real transform origin here, instead of using a
839 // matrix with the origin baked in. 847 // matrix with the origin baked in.
840 FloatPoint3D transform_origin; 848 FloatPoint3D transform_origin;
841 Transform3DRecorder transform3d_recorder( 849 Transform3DRecorder transform3d_recorder(
842 context, paint_layer_.GetLayoutObject(), 850 context, paint_layer_.GetLayoutObject(),
843 DisplayItem::kTransform3DElementTransform, transform, transform_origin); 851 DisplayItem::kTransform3DElementTransform, transform, transform_origin);
844 852
845 // Now do a paint with the root layer shifted to be us. 853 // Now do a paint with the root layer shifted to be us.
846 PaintLayerPaintingInfo transformed_painting_info( 854 PaintLayerPaintingInfo transformed_painting_info(
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 context, layout_object, kPaintPhaseClippingMask)) 1259 context, layout_object, kPaintPhaseClippingMask))
1252 return; 1260 return;
1253 1261
1254 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); 1262 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
1255 LayoutObjectDrawingRecorder drawing_recorder( 1263 LayoutObjectDrawingRecorder drawing_recorder(
1256 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); 1264 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect);
1257 context.FillRect(snapped_clip_rect, Color::kBlack); 1265 context.FillRect(snapped_clip_rect, Color::kBlack);
1258 } 1266 }
1259 1267
1260 } // namespace blink 1268 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698