| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 GraphicsContext& context = paintInfo.context; | 31 GraphicsContext& context = paintInfo.context; |
| 32 LayoutRect contentRect = m_layoutVideo.contentBoxRect(); | 32 LayoutRect contentRect = m_layoutVideo.contentBoxRect(); |
| 33 contentRect.moveBy(paintOffset); | 33 contentRect.moveBy(paintOffset); |
| 34 | 34 |
| 35 Optional<ClipRecorder> clipRecorder; | 35 Optional<ClipRecorder> clipRecorder; |
| 36 if (!contentRect.contains(rect)) { | 36 if (!contentRect.contains(rect)) { |
| 37 clipRecorder.emplace(context, m_layoutVideo, paintInfo.displayItemTypeFo
rClipping(), contentRect); | 37 clipRecorder.emplace(context, m_layoutVideo, paintInfo.displayItemTypeFo
rClipping(), contentRect); |
| 38 } | 38 } |
| 39 | 39 |
| 40 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou
tVideo, paintInfo.phase, paintOffset)) | 40 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou
tVideo, paintInfo.phase)) |
| 41 return; | 41 return; |
| 42 | 42 |
| 43 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInf
o.phase, contentRect, paintOffset); | 43 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInf
o.phase, contentRect); |
| 44 | 44 |
| 45 // Video frames are only painted in software for printing or capturing node
images via web APIs. | 45 // Video frames are only painted in software for printing or capturing node
images via web APIs. |
| 46 bool forceSoftwareVideoPaint = paintInfo.globalPaintFlags() & GlobalPaintFla
ttenCompositingLayers; | 46 bool forceSoftwareVideoPaint = paintInfo.globalPaintFlags() & GlobalPaintFla
ttenCompositingLayers; |
| 47 | 47 |
| 48 if (displayingPoster || !forceSoftwareVideoPaint) { | 48 if (displayingPoster || !forceSoftwareVideoPaint) { |
| 49 // This will display the poster image, if one is present, and otherwise
paint nothing. | 49 // This will display the poster image, if one is present, and otherwise
paint nothing. |
| 50 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); | 50 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); |
| 51 } else { | 51 } else { |
| 52 SkPaint videoPaint = context.fillPaint(); | 52 SkPaint videoPaint = context.fillPaint(); |
| 53 videoPaint.setColor(SK_ColorBLACK); | 53 videoPaint.setColor(SK_ColorBLACK); |
| 54 m_layoutVideo.videoElement()->paintCurrentFrame(context.canvas(), pixelS
nappedIntRect(rect), &videoPaint); | 54 m_layoutVideo.videoElement()->paintCurrentFrame(context.canvas(), pixelS
nappedIntRect(rect), &videoPaint); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |