void GraphicsContext::drawConsumingImageBuffer(std::unique_ptr<ImageBuffer> image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions) { if (!image) return; IntSize imageLogicalSize = image->logicalSize(); drawConsumingImageBuffer(WTFMove(image), destination, FloatRect(FloatPoint(), FloatSize(imageLogicalSize)), imagePaintingOptions); }
PassRefPtr<ShareableBitmap> WebFrame::createSelectionSnapshot() const { std::unique_ptr<ImageBuffer> snapshot = snapshotSelection(*coreFrame(), WebCore::SnapshotOptionsForceBlackText); if (!snapshot) return nullptr; auto sharedSnapshot = ShareableBitmap::createShareable(snapshot->internalSize(), ShareableBitmap::SupportsAlpha); if (!sharedSnapshot) return nullptr; // FIXME: We should consider providing a way to use subpixel antialiasing for the snapshot // if we're compositing this image onto a solid color (e.g. the modern find indicator style). auto graphicsContext = sharedSnapshot->createGraphicsContext(); float deviceScaleFactor = coreFrame()->page()->deviceScaleFactor(); graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); graphicsContext->drawConsumingImageBuffer(WTFMove(snapshot), FloatPoint()); return WTFMove(sharedSnapshot); }