Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: Source/core/paint/VideoPainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/paint/TableSectionPainter.cpp ('k') | Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 WebMediaPlayer* mediaPlayer = m_layoutVideo.mediaElement()->webMediaPlayer() ; 21 WebMediaPlayer* mediaPlayer = m_layoutVideo.mediaElement()->webMediaPlayer() ;
22 bool displayingPoster = m_layoutVideo.videoElement()->shouldDisplayPosterIma ge(); 22 bool displayingPoster = m_layoutVideo.videoElement()->shouldDisplayPosterIma ge();
23 if (!displayingPoster && !mediaPlayer) 23 if (!displayingPoster && !mediaPlayer)
24 return; 24 return;
25 25
26 LayoutRect rect(m_layoutVideo.videoBox()); 26 LayoutRect rect(m_layoutVideo.videoBox());
27 if (rect.isEmpty()) 27 if (rect.isEmpty())
28 return; 28 return;
29 rect.moveBy(paintOffset); 29 rect.moveBy(paintOffset);
30 30
31 GraphicsContext* context = paintInfo.context;
32 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layo utVideo, paintInfo.phase))
33 return;
34
31 LayoutRect contentRect = m_layoutVideo.contentBoxRect(); 35 LayoutRect contentRect = m_layoutVideo.contentBoxRect();
32 contentRect.moveBy(paintOffset); 36 contentRect.moveBy(paintOffset);
33 GraphicsContext* context = paintInfo.context;
34
35 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutVideo, paintIn fo.phase, contentRect); 37 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutVideo, paintIn fo.phase, contentRect);
36 if (drawingRecorder.canUseCachedDrawing())
37 return;
38 38
39 bool clip = !contentRect.contains(rect); 39 bool clip = !contentRect.contains(rect);
40 if (clip) { 40 if (clip) {
41 context->save(); 41 context->save();
42 context->clip(contentRect); 42 context->clip(contentRect);
43 } 43 }
44 44
45 if (displayingPoster) { 45 if (displayingPoster) {
46 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); 46 ImagePainter(m_layoutVideo).paintIntoRect(context, rect);
47 } else if ((m_layoutVideo.document().view() && m_layoutVideo.document().view ()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) || !m_layoutVideo.a cceleratedRenderingInUse()) { 47 } else if ((m_layoutVideo.document().view() && m_layoutVideo.document().view ()->paintBehavior() & PaintBehaviorFlattenCompositingLayers) || !m_layoutVideo.a cceleratedRenderingInUse()) {
48 SkPaint videoPaint = context->fillPaint(); 48 SkPaint videoPaint = context->fillPaint();
49 videoPaint.setColor(SK_ColorBLACK); 49 videoPaint.setColor(SK_ColorBLACK);
50 m_layoutVideo.videoElement()->paintCurrentFrame(context->canvas(), pixel SnappedIntRect(rect), &videoPaint); 50 m_layoutVideo.videoElement()->paintCurrentFrame(context->canvas(), pixel SnappedIntRect(rect), &videoPaint);
51 } 51 }
52 if (clip) 52 if (clip)
53 context->restore(); 53 context->restore();
54 } 54 }
55 55
56 } // namespace blink 56 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/TableSectionPainter.cpp ('k') | Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698