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

Side by Side Diff: webrtc/modules/desktop_capture/screen_drawer.h

Issue 2268093002: [WebRTC] A real ScreenCapturer test (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Resolve review comments Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <memory> 16 #include <memory>
17 17
18 #include "webrtc/modules/desktop_capture/color.h"
18 #include "webrtc/modules/desktop_capture/desktop_geometry.h" 19 #include "webrtc/modules/desktop_capture/desktop_geometry.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 // A set of platform independent functions to draw various of shapes on the 23 // A set of basic platform dependent functions to draw various shapes on the
23 // screen. This class is for testing ScreenCapturer* implementations only, and 24 // screen.
25 // Usually ScreenPainter is preferred, instead of using this class directly. As
Jamie 2016/08/26 22:29:10 ScreenPainter no longer exists. Please update the
Hzj_jie 2016/08/29 21:57:28 Done.
26 // ScreenPainter provides more complex shapes by using ScreenDrawer for each
27 // platform. This class is for testing ScreenCapturer* implementations only, and
24 // should not be used in production logic. 28 // should not be used in production logic.
25 class ScreenDrawer { 29 class ScreenDrawer {
26 public: 30 public:
27 // Creates a ScreenDrawer for the current platform. 31 // Creates a ScreenDrawer for the current platform, returns nullptr if no
32 // ScreenDrawer implementation available.
28 static std::unique_ptr<ScreenDrawer> Create(); 33 static std::unique_ptr<ScreenDrawer> Create();
29 34
30 ScreenDrawer() {} 35 ScreenDrawer() {}
31 virtual ~ScreenDrawer() {} 36 virtual ~ScreenDrawer() {}
32 37
33 // Returns a rect, on which this instance can draw. 38 // Returns a rectangle, on which this instance can draw. This rectangle maps
39 // to the physical monitor, i.e. a dot drawing at (100, 100) of a ScreenDrawer
40 // will be captured at (100, 100) by a ScreenCapturer.
Jamie 2016/08/26 22:29:10 Assuming it won't break existing code, let's try t
Hzj_jie 2016/08/29 21:57:28 Done. One minor change, 'This region _may_ exclude
Jamie 2016/08/31 17:39:39 That also works (but if you add "may" you also nee
Hzj_jie 2016/08/31 21:22:39 :(
34 virtual DesktopRect DrawableRegion() = 0; 41 virtual DesktopRect DrawableRegion() = 0;
35 42
36 // Draws a rectangle to cover |rect| with color |rgba|. Note, rect.bottom() 43 // Draws a rectangle to cover |rect| with |color|. Note, rect.bottom() and
37 // and rect.right() two lines are not included. 44 // rect.right() two lines are not included. The part of |rect| which is out of
38 virtual void DrawRectangle(DesktopRect rect, uint32_t rgba) = 0; 45 // DrawableRegion() will be ignored.
46 virtual void DrawRectangle(DesktopRect rect, Color color) = 0;
39 47
40 // Clears all content on the screen. 48 // Clears all content on the screen by filling the area with black.
41 virtual void Clear() = 0; 49 virtual void Clear() = 0;
50
51 // Blocks current thread until OS finishes previous Draw* actions.
Jamie 2016/08/26 22:29:10 Since there's only DrawRectangle, Draw* is unneces
Hzj_jie 2016/08/29 21:57:28 Done.
52 // ScreenCapturer should be able to capture the changes after this function
53 // finish.
54 virtual void WaitForPendingPaintings() = 0;
Jamie 2016/08/26 22:29:10 s/Paintings/Draws/ (since that's the verb the corr
Hzj_jie 2016/08/29 21:57:28 Done.
42 }; 55 };
43 56
44 } // namespace webrtc 57 } // namespace webrtc
45 58
46 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_ 59 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_DRAWER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698