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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/VideoPainter.h" | 6 #include "core/paint/VideoPainter.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/html/HTMLVideoElement.h" | 10 #include "core/html/HTMLVideoElement.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 GraphicsContext* context = paintInfo.context; | 32 GraphicsContext* context = paintInfo.context; |
33 LayoutRect contentRect = m_layoutVideo.contentBoxRect(); | 33 LayoutRect contentRect = m_layoutVideo.contentBoxRect(); |
34 contentRect.moveBy(paintOffset); | 34 contentRect.moveBy(paintOffset); |
35 | 35 |
36 Optional<FloatClipRecorder> clipRecorder; | 36 Optional<FloatClipRecorder> clipRecorder; |
37 if (!contentRect.contains(rect)) { | 37 if (!contentRect.contains(rect)) { |
38 // TODO(chrishtr): this should be pixel-snapped. | 38 // TODO(chrishtr): this should be pixel-snapped. |
39 clipRecorder.emplace(*context, m_layoutVideo, paintInfo.phase, FloatRect
(contentRect)); | 39 clipRecorder.emplace(*context, m_layoutVideo, paintInfo.phase, FloatRect
(contentRect)); |
40 } | 40 } |
41 | 41 |
42 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layo
utVideo, paintInfo.phase)) | 42 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layo
utVideo, paintInfo.phase, paintOffset)) |
43 return; | 43 return; |
44 | 44 |
45 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutVideo, paintIn
fo.phase, contentRect); | 45 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutVideo, paintIn
fo.phase, contentRect, paintOffset); |
46 | 46 |
47 if (displayingPoster) { | 47 if (displayingPoster) { |
48 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); | 48 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); |
49 } else if ((paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLaye
rs) || !m_layoutVideo.acceleratedRenderingInUse()) { | 49 } else if ((paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLaye
rs) || !m_layoutVideo.acceleratedRenderingInUse()) { |
50 SkPaint videoPaint = context->fillPaint(); | 50 SkPaint videoPaint = context->fillPaint(); |
51 videoPaint.setColor(SK_ColorBLACK); | 51 videoPaint.setColor(SK_ColorBLACK); |
52 m_layoutVideo.videoElement()->paintCurrentFrame(context->canvas(), pixel
SnappedIntRect(rect), &videoPaint); | 52 m_layoutVideo.videoElement()->paintCurrentFrame(context->canvas(), pixel
SnappedIntRect(rect), &videoPaint); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 } // namespace blink | 56 } // namespace blink |
OLD | NEW |