| OLD | NEW |
| 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/VideoPainter.h" | 5 #include "core/paint/VideoPainter.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/html/HTMLVideoElement.h" | 9 #include "core/html/HTMLVideoElement.h" |
| 10 #include "core/layout/LayoutVideo.h" | 10 #include "core/layout/LayoutVideo.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Video frames are only painted in software for printing or capturing node
images via web APIs. | 40 // Video frames are only painted in software for printing or capturing node
images via web APIs. |
| 41 bool forceSoftwareVideoPaint = paintInfo.getGlobalPaintFlags() & GlobalPaint
FlattenCompositingLayers; | 41 bool forceSoftwareVideoPaint = paintInfo.getGlobalPaintFlags() & GlobalPaint
FlattenCompositingLayers; |
| 42 | 42 |
| 43 bool paintWithForeignLayer = | 43 bool paintWithForeignLayer = |
| 44 !displayingPoster && !forceSoftwareVideoPaint | 44 !displayingPoster && !forceSoftwareVideoPaint |
| 45 && RuntimeEnabledFeatures::slimmingPaintV2Enabled(); | 45 && RuntimeEnabledFeatures::slimmingPaintV2Enabled(); |
| 46 if (paintWithForeignLayer) { | 46 if (paintWithForeignLayer) { |
| 47 if (WebLayer* layer = m_layoutVideo.mediaElement()->platformLayer()) { | 47 if (WebLayer* layer = m_layoutVideo.mediaElement()->platformLayer()) { |
| 48 IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); | 48 IntRect pixelSnappedRect = pixelSnappedIntRect(contentRect); |
| 49 recordForeignLayer( | 49 recordForeignLayer( |
| 50 context, m_layoutVideo, DisplayItem::ForeignLayerVideo, layer, | 50 context, m_layoutVideo, DisplayItem::kForeignLayerVideo, layer, |
| 51 pixelSnappedRect.location(), pixelSnappedRect.size()); | 51 pixelSnappedRect.location(), pixelSnappedRect.size()); |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 // TODO(trchen): Video rect could overflow the content rect due to object-fi
t. | 56 // TODO(trchen): Video rect could overflow the content rect due to object-fi
t. |
| 57 // Should apply a clip here like EmbeddedObjectPainter does. | 57 // Should apply a clip here like EmbeddedObjectPainter does. |
| 58 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInf
o.phase, contentRect); | 58 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInf
o.phase, contentRect); |
| 59 | 59 |
| 60 if (displayingPoster || !forceSoftwareVideoPaint) { | 60 if (displayingPoster || !forceSoftwareVideoPaint) { |
| 61 // This will display the poster image, if one is present, and otherwise
paint nothing. | 61 // This will display the poster image, if one is present, and otherwise
paint nothing. |
| 62 ImagePainter(m_layoutVideo).paintIntoRect(context, replacedRect, content
Rect); | 62 ImagePainter(m_layoutVideo).paintIntoRect(context, replacedRect, content
Rect); |
| 63 } else { | 63 } else { |
| 64 SkPaint videoPaint = context.fillPaint(); | 64 SkPaint videoPaint = context.fillPaint(); |
| 65 videoPaint.setColor(SK_ColorBLACK); | 65 videoPaint.setColor(SK_ColorBLACK); |
| 66 m_layoutVideo.videoElement()->paintCurrentFrame(context.canvas(), snappe
dReplacedRect, &videoPaint); | 66 m_layoutVideo.videoElement()->paintCurrentFrame(context.canvas(), snappe
dReplacedRect, &videoPaint); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |