void DeprecatedPaintLayerPainter::paintFragmentByApplyingTransform(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTranslation) { // This involves subtracting out the position of the layer in our current coordinate space, but preserving // the accumulated error for sub-pixel layout. LayoutPoint delta; m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); delta.moveBy(fragmentTranslation); TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags())); IntPoint roundedDelta = roundedIntPoint(delta); transform.translateRight(roundedDelta.x(), roundedDelta.y()); LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); Transform3DRecorder transform3DRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::Transform3DElementTransform, transform); // Now do a paint with the root layer shifted to be us. DeprecatedPaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), paintingInfo.globalPaintFlags(), adjustedSubPixelAccumulation, paintingInfo.paintingRoot); paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags, ForceSingleFragment); }
PaintLayerPainter::PaintResult PaintLayerPainter::paintLayer(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) { // https://code.google.com/p/chromium/issues/detail?id=343772 DisableCompositingQueryAsserts disabler; if (m_paintLayer.compositingState() != NotComposited) { if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers) { // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's for printing and drag-image. // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call? paintFlags |= PaintLayerUncachedClipRects; } } // Non self-painting layers without self-painting descendants don't need to be painted as their // layoutObject() should properly paint itself. if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant()) return FullyPainted; if (shouldSuppressPaintingLayer(&m_paintLayer)) return FullyPainted; if (m_paintLayer.layoutObject()->isLayoutView() && toLayoutView(m_paintLayer.layoutObject())->frameView()->shouldThrottleRendering()) return FullyPainted; // If this layer is totally invisible then there is nothing to paint. if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()->hasBackdropFilter()) return FullyPainted; if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) paintFlags |= PaintLayerHaveTransparency; LayerFixedPositionRecorder fixedPositionRecorder(context, *m_paintLayer.layoutObject()); // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying the transform twice. if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(paintFlags & PaintLayerAppliedTransform)) return paintLayerWithTransform(context, paintingInfo, paintFlags); return paintLayerContentsAndReflection(context, paintingInfo, paintFlags); }
PaintLayerPainter::PaintResult PaintLayerPainter::paintFragmentByApplyingTransform(GraphicsContext& context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTranslation) { // This involves subtracting out the position of the layer in our current coordinate space, but preserving // the accumulated error for sub-pixel layout. LayoutPoint delta; m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); delta.moveBy(fragmentTranslation); TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags())); IntPoint roundedDelta = roundedIntPoint(delta); transform.translateRight(roundedDelta.x(), roundedDelta.y()); LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta); // TODO(jbroman): Put the real transform origin here, instead of using a // matrix with the origin baked in. FloatPoint3D transformOrigin; Transform3DRecorder transform3DRecorder(context, *m_paintLayer.layoutObject(), DisplayItem::Transform3DElementTransform, transform, transformOrigin); // Now do a paint with the root layer shifted to be us. PaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), paintingInfo.globalPaintFlags(), adjustedSubPixelAccumulation); transformedPaintingInfo.ancestorHasClipPathClipping = paintingInfo.ancestorHasClipPathClipping; return paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags, ForceSingleFragment); }