void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { Image* image = m_snapshotResource->image().get(); if (!image || image->isNull()) return; LayoutUnit cWidth = contentWidth(); LayoutUnit cHeight = contentHeight(); if (!cWidth || !cHeight) return; GraphicsContext& context = paintInfo.context(); LayoutSize contentSize(cWidth, cHeight); LayoutPoint contentLocation = location() + paintOffset; contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); LayoutRect rect(contentLocation, contentSize); IntRect alignedRect = snappedIntRect(rect); if (alignedRect.width() <= 0 || alignedRect.height() <= 0) return; bool useLowQualityScaling = shouldPaintAtLowQuality(context, *image, image, alignedRect.size()); ImageOrientationDescription orientationDescription(shouldRespectImageOrientation()); #if ENABLE(CSS_IMAGE_ORIENTATION) orientationDescription.setImageOrientationEnum(style().imageOrientation()); #endif context.drawImage(*image, alignedRect, ImagePaintingOptions(orientationDescription, useLowQualityScaling)); }
void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { Image* image = m_snapshotResource->image().get(); if (!image || image->isNull()) return; LayoutUnit cWidth = contentWidth(); LayoutUnit cHeight = contentHeight(); if (!cWidth || !cHeight) return; GraphicsContext* context = paintInfo.context; #if PLATFORM(MAC) if (style()->highlight() != nullAtom && !context->paintingDisabled()) paintCustomHighlight(toPoint(paintOffset - location()), style()->highlight(), true); #endif LayoutSize contentSize(cWidth, cHeight); LayoutPoint contentLocation = location() + paintOffset; contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); LayoutRect rect(contentLocation, contentSize); IntRect alignedRect = pixelSnappedIntRect(rect); if (alignedRect.width() <= 0 || alignedRect.height() <= 0) return; bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size()); ImageOrientationDescription orientationDescription; #if ENABLE(CSS_IMAGE_ORIENTATION) orientationDescription.setImageOrientationEnum(style()->imageOrientation()); #endif context->drawImage(image, style()->colorSpace(), alignedRect, CompositeSourceOver, orientationDescription, useLowQualityScaling); }
InterpolationQuality ImageQualityController::chooseInterpolationQuality(GraphicsContext* context, const LayoutObject* object, Image* image, const void* layer, const LayoutSize& layoutSize) { if (object->style()->imageRendering() == ImageRenderingPixelated) return InterpolationNone; if (InterpolationDefault == InterpolationLow) return InterpolationLow; if (shouldPaintAtLowQuality(context, object, image, layer, layoutSize)) return InterpolationLow; // For images that are potentially animated we paint them at medium quality. if (image && image->maybeAnimated()) return InterpolationMedium; return InterpolationDefault; }
InterpolationQuality ImageQualityController::chooseInterpolationQuality( const LayoutObject& object, Image* image, const void* layer, const LayoutSize& layoutSize) { if (object.style()->imageRendering() == ImageRenderingPixelated) return InterpolationNone; if (InterpolationDefault == InterpolationLow) return InterpolationLow; if (shouldPaintAtLowQuality( object, image, layer, layoutSize, object.frameView()->page()->chromeClient().lastFrameTimeMonotonic())) return InterpolationLow; // For images that are potentially animated we paint them at medium quality. if (image && image->maybeAnimated()) return InterpolationMedium; return InterpolationDefault; }