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

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

Issue 1848613002: Extract subpixel offsets from composited layer transforms when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/LayoutBlock.h" 10 #include "core/layout/LayoutBlock.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return FullyPainted; 89 return FullyPainted;
90 90
91 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags())) 91 if (m_paintLayer.paintsWithTransparency(paintingInfo.getGlobalPaintFlags()))
92 paintFlags |= PaintLayerHaveTransparency; 92 paintFlags |= PaintLayerHaveTransparency;
93 93
94 // Transforms will be applied by property nodes directly for SPv2. 94 // Transforms will be applied by property nodes directly for SPv2.
95 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice. 95 // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying th e transform twice.
96 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_paintLayer.paints WithTransform(paintingInfo.getGlobalPaintFlags()) && !(paintFlags & PaintLayerAp pliedTransform)) 96 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_paintLayer.paints WithTransform(paintingInfo.getGlobalPaintFlags()) && !(paintFlags & PaintLayerAp pliedTransform))
97 return paintLayerWithTransform(context, paintingInfo, paintFlags); 97 return paintLayerWithTransform(context, paintingInfo, paintFlags);
98 98
99
100
99 return paintLayerContentsAndReflection(context, paintingInfo, paintFlags); 101 return paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
100 } 102 }
101 103
102 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContentsAndReflectio n(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLay erFlags paintFlags, FragmentPolicy fragmentPolicy) 104 PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContentsAndReflectio n(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLay erFlags paintFlags, FragmentPolicy fragmentPolicy)
103 { 105 {
104 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant()); 106 ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLay erDescendant());
105 107
106 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; 108 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ;
107 109
108 PaintResult result = FullyPainted; 110 PaintResult result = FullyPainted;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 517 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
516 518
517 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 519 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving
518 // the accumulated error for sub-pixel layout. 520 // the accumulated error for sub-pixel layout.
519 LayoutPoint delta; 521 LayoutPoint delta;
520 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); 522 m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
521 delta.moveBy(fragmentTranslation); 523 delta.moveBy(fragmentTranslation);
522 TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo .getGlobalPaintFlags())); 524 TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo .getGlobalPaintFlags()));
523 IntPoint roundedDelta = roundedIntPoint(delta); 525 IntPoint roundedDelta = roundedIntPoint(delta);
524 transform.translateRight(roundedDelta.x(), roundedDelta.y()); 526 transform.translateRight(roundedDelta.x(), roundedDelta.y());
527 LOG(ERROR) << "PaintLayerPainter::paintFragmentByApplyingTransform: delta x= " << roundedDelta.x() << ", y=" << roundedDelta.y();
525 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); 528 LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
526 529
527 // TODO(jbroman): Put the real transform origin here, instead of using a 530 // TODO(jbroman): Put the real transform origin here, instead of using a
528 // matrix with the origin baked in. 531 // matrix with the origin baked in.
529 FloatPoint3D transformOrigin; 532 FloatPoint3D transformOrigin;
530 Transform3DRecorder transform3DRecorder(context, *m_paintLayer.layoutObject( ), DisplayItem::Transform3DElementTransform, transform, transformOrigin); 533 Transform3DRecorder transform3DRecorder(context, *m_paintLayer.layoutObject( ), DisplayItem::Transform3DElementTransform, transform, transformOrigin);
531 534
532 // Now do a paint with the root layer shifted to be us. 535 // Now do a paint with the root layer shifted to be us.
533 PaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enc losingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), painti ngInfo.getGlobalPaintFlags(), 536 PaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enc losingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), painti ngInfo.getGlobalPaintFlags(),
534 adjustedSubPixelAccumulation); 537 adjustedSubPixelAccumulation);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 777 if (!m_paintLayer.containsDirtyOverlayScrollbars())
775 return; 778 return;
776 779
777 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); 780 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize());
778 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 781 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
779 782
780 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 783 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
781 } 784 }
782 785
783 } // namespace blink 786 } // namespace blink
OLDNEW
« no previous file with comments | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698