blob: 7416413f421d69c36ab47a21eb4b143976b75489 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_
#define CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
#include "media/base/video_frame.h"
#include "ui/gfx/native_widget_types.h"
namespace content {
// CursorRenderer is an interface that can be implememented to do cursor
// rendering on a video frame.
//
// In order to track the cursor, the platform-specific implementation
// will listen to mouse events.
class CONTENT_EXPORT CursorRenderer {
public:
virtual ~CursorRenderer() {}
// Clears the cursor state being tracked. Called when there is a need to
// reset the state.
virtual void Clear() = 0;
// Takes a snapshot of the current cursor state and determines whether
// the cursor will be rendered, which cursor image to render, and at what
// location within |region_in_frame| to render it. Returns true if cursor
// needs to be rendered.
virtual bool SnapshotCursorState(const gfx::Rect& region_in_frame) = 0;
// Renders cursor on the |target| video frame.
virtual void RenderOnVideoFrame(
const scoped_refptr<media::VideoFrame>& target) const = 0;
// Returns a weak pointer.
virtual base::WeakPtr<CursorRenderer> GetWeakPtr() = 0;
protected:
enum {
// Minium movement before cursor is rendered on frame.
MIN_MOVEMENT_PIXELS = 15,
// Maximum idle time allowed before we stop rendering the cursor
// on frame.
MAX_IDLE_TIME_SECONDS = 2
};
};
} // namespace content
#endif // CONTENT_BROWSER_MEDIA_CAPTURE_CURSOR_RENDERER_H_
|