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

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

Issue 1512803004: Use refs for GraphicsContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 5 years 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
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 11 matching lines...) Expand all
22 WebMediaPlayer* mediaPlayer = m_layoutVideo.mediaElement()->webMediaPlayer() ; 22 WebMediaPlayer* mediaPlayer = m_layoutVideo.mediaElement()->webMediaPlayer() ;
23 bool displayingPoster = m_layoutVideo.videoElement()->shouldDisplayPosterIma ge(); 23 bool displayingPoster = m_layoutVideo.videoElement()->shouldDisplayPosterIma ge();
24 if (!displayingPoster && !mediaPlayer) 24 if (!displayingPoster && !mediaPlayer)
25 return; 25 return;
26 26
27 LayoutRect rect(m_layoutVideo.videoBox()); 27 LayoutRect rect(m_layoutVideo.videoBox());
28 if (rect.isEmpty()) 28 if (rect.isEmpty())
29 return; 29 return;
30 rect.moveBy(paintOffset); 30 rect.moveBy(paintOffset);
31 31
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<ClipRecorder> clipRecorder; 36 Optional<ClipRecorder> clipRecorder;
37 if (!contentRect.contains(rect)) { 37 if (!contentRect.contains(rect)) {
38 clipRecorder.emplace(*context, m_layoutVideo, paintInfo.displayItemTypeF orClipping(), contentRect); 38 clipRecorder.emplace(context, m_layoutVideo, paintInfo.displayItemTypeFo rClipping(), contentRect);
39 } 39 }
40 40
41 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, m_layo utVideo, paintInfo.phase, paintOffset)) 41 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(context, m_layou tVideo, paintInfo.phase, paintOffset))
42 return; 42 return;
43 43
44 LayoutObjectDrawingRecorder drawingRecorder(*context, m_layoutVideo, paintIn fo.phase, contentRect, paintOffset); 44 LayoutObjectDrawingRecorder drawingRecorder(context, m_layoutVideo, paintInf o.phase, contentRect, paintOffset);
45 45
46 if (displayingPoster) { 46 if (displayingPoster) {
47 ImagePainter(m_layoutVideo).paintIntoRect(context, rect); 47 ImagePainter(m_layoutVideo).paintIntoRect(context, rect);
48 } else if ((paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLaye rs) || !m_layoutVideo.acceleratedRenderingInUse()) { 48 } else if ((paintInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLaye rs) || !m_layoutVideo.acceleratedRenderingInUse()) {
49 SkPaint videoPaint = context->fillPaint(); 49 SkPaint videoPaint = context.fillPaint();
50 videoPaint.setColor(SK_ColorBLACK); 50 videoPaint.setColor(SK_ColorBLACK);
51 m_layoutVideo.videoElement()->paintCurrentFrame(context->canvas(), pixel SnappedIntRect(rect), &videoPaint); 51 m_layoutVideo.videoElement()->paintCurrentFrame(context.canvas(), pixelS nappedIntRect(rect), &videoPaint);
52 } 52 }
53 } 53 }
54 54
55 } // namespace blink 55 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ThemePainterMac.mm ('k') | third_party/WebKit/Source/core/paint/ViewPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698