void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { MediaPlayer* mediaPlayer = mediaElement()->player(); bool displayingPoster = videoElement()->shouldDisplayPosterImage(); if (!displayingPoster && !mediaPlayer) return; LayoutRect rect = videoBox(); if (rect.isEmpty()) return; rect.moveBy(paintOffset); LayoutRect contentRect = contentBoxRect(); contentRect.moveBy(paintOffset); GraphicsContext* context = paintInfo.context; bool clip = !contentRect.contains(rect); if (clip) { context->save(); context->clip(contentRect); } if (displayingPoster) paintIntoRect(context, rect); else if (document().view() && document().view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) mediaPlayer->paintCurrentFrameInContext(context, pixelSnappedIntRect(rect)); else mediaPlayer->paint(context, pixelSnappedIntRect(rect)); if (clip) context->restore(); }
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { MediaPlayer* mediaPlayer = mediaElement()->player(); bool displayingPoster = videoElement()->shouldDisplayPosterImage(); Page* page = 0; if (Frame* frame = this->frame()) page = frame->page(); if (!displayingPoster && !mediaPlayer) { if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantUnpaintedObject(this, visualOverflowRect()); return; } LayoutRect rect = videoBox(); if (rect.isEmpty()) { if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantUnpaintedObject(this, visualOverflowRect()); return; } rect.moveBy(paintOffset); if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantRepaintedObject(this, rect); if (displayingPoster) paintIntoRect(paintInfo.context, rect); else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) mediaPlayer->paintCurrentFrameInContext(paintInfo.context, pixelSnappedIntRect(rect)); else mediaPlayer->paint(paintInfo.context, pixelSnappedIntRect(rect)); }
void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect) { MediaPlayer* player = HTMLMediaElement::player(); if (!player) return; player->paintCurrentFrameInContext(context, destRect); }
void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext& context, const FloatRect& destRect) { MediaPlayer* player = HTMLMediaElement::player(); if (!player) return; player->setVisible(true); // Make player visible or it won't draw. player->paintCurrentFrameInContext(context, destRect); }
void RenderVideo::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { MediaPlayer* mediaPlayer = videoElement().player(); bool displayingPoster = videoElement().shouldDisplayPosterImage(); Page* page = frame().page(); if (!displayingPoster && !mediaPlayer) { if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantUnpaintedObject(this, visualOverflowRect()); return; } LayoutRect rect = videoBox(); if (rect.isEmpty()) { if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantUnpaintedObject(this, visualOverflowRect()); return; } rect.moveBy(paintOffset); if (page && paintInfo.phase == PaintPhaseForeground) page->addRelevantRepaintedObject(this, rect); LayoutRect contentRect = contentBoxRect(); contentRect.moveBy(paintOffset); GraphicsContext& context = paintInfo.context(); bool clip = !contentRect.contains(rect); GraphicsContextStateSaver stateSaver(context, clip); if (clip) context.clip(contentRect); if (displayingPoster) paintIntoRect(context, rect); else if (!videoElement().isFullscreen() || !mediaPlayer->supportsAcceleratedRendering()) { if (view().frameView().paintBehavior() & PaintBehaviorFlattenCompositingLayers) mediaPlayer->paintCurrentFrameInContext(context, rect); else mediaPlayer->paint(context, rect); } }
void RenderVideo::paintReplaced(PaintInfo& paintInfo, int tx, int ty) { MediaPlayer* mediaPlayer = mediaElement()->player(); bool displayingPoster = videoElement()->shouldDisplayPosterImage(); if (!displayingPoster) { if (!mediaPlayer) return; updatePlayer(); } IntRect rect = videoBox(); if (rect.isEmpty()) return; rect.move(tx, ty); if (displayingPoster) paintIntoRect(paintInfo.context, rect); else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) mediaPlayer->paintCurrentFrameInContext(paintInfo.context, rect); else mediaPlayer->paint(paintInfo.context, rect); }