/src/mozilla-central/widget/InProcessCompositorWidget.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #include "InProcessCompositorWidget.h" |
6 | | |
7 | | #include "mozilla/VsyncDispatcher.h" |
8 | | #include "nsBaseWidget.h" |
9 | | |
10 | | #if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING) |
11 | | #include "mozilla/widget/AndroidCompositorWidget.h" |
12 | | #endif |
13 | | |
14 | | namespace mozilla { |
15 | | namespace widget { |
16 | | |
17 | | // Platforms with no OOP compositor process support use |
18 | | // InProcessCompositorWidget by default. |
19 | | #if !defined(MOZ_WIDGET_SUPPORTS_OOP_COMPOSITING) |
20 | | /* static */ RefPtr<CompositorWidget> |
21 | | CompositorWidget::CreateLocal(const CompositorWidgetInitData& aInitData, |
22 | | const layers::CompositorOptions& aOptions, |
23 | | nsIWidget* aWidget) |
24 | | { |
25 | | MOZ_ASSERT(aWidget); |
26 | | #ifdef MOZ_WIDGET_ANDROID |
27 | | return new AndroidCompositorWidget(aOptions, static_cast<nsBaseWidget*>(aWidget)); |
28 | | #else |
29 | | return new InProcessCompositorWidget(aOptions, static_cast<nsBaseWidget*>(aWidget)); |
30 | | #endif |
31 | | } |
32 | | #endif |
33 | | |
34 | | InProcessCompositorWidget::InProcessCompositorWidget(const layers::CompositorOptions& aOptions, |
35 | | nsBaseWidget* aWidget) |
36 | | : CompositorWidget(aOptions) |
37 | | , mWidget(aWidget) |
38 | 0 | { |
39 | 0 | } |
40 | | |
41 | | bool |
42 | | InProcessCompositorWidget::PreRender(WidgetRenderingContext* aContext) |
43 | 0 | { |
44 | 0 | return mWidget->PreRender(aContext); |
45 | 0 | } |
46 | | |
47 | | void |
48 | | InProcessCompositorWidget::PostRender(WidgetRenderingContext* aContext) |
49 | 0 | { |
50 | 0 | mWidget->PostRender(aContext); |
51 | 0 | } |
52 | | |
53 | | void |
54 | | InProcessCompositorWidget::DrawWindowUnderlay(WidgetRenderingContext* aContext, |
55 | | LayoutDeviceIntRect aRect) |
56 | 0 | { |
57 | 0 | mWidget->DrawWindowUnderlay(aContext, aRect); |
58 | 0 | } |
59 | | |
60 | | void |
61 | | InProcessCompositorWidget::DrawWindowOverlay(WidgetRenderingContext* aContext, |
62 | | LayoutDeviceIntRect aRect) |
63 | 0 | { |
64 | 0 | mWidget->DrawWindowOverlay(aContext, aRect); |
65 | 0 | } |
66 | | |
67 | | already_AddRefed<gfx::DrawTarget> |
68 | | InProcessCompositorWidget::StartRemoteDrawing() |
69 | 0 | { |
70 | 0 | return mWidget->StartRemoteDrawing(); |
71 | 0 | } |
72 | | |
73 | | already_AddRefed<gfx::DrawTarget> |
74 | | InProcessCompositorWidget::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion, |
75 | | layers::BufferMode* aBufferMode) |
76 | 0 | { |
77 | 0 | return mWidget->StartRemoteDrawingInRegion(aInvalidRegion, aBufferMode); |
78 | 0 | } |
79 | | |
80 | | void |
81 | | InProcessCompositorWidget::EndRemoteDrawing() |
82 | 0 | { |
83 | 0 | mWidget->EndRemoteDrawing(); |
84 | 0 | } |
85 | | |
86 | | void |
87 | | InProcessCompositorWidget::EndRemoteDrawingInRegion(gfx::DrawTarget* aDrawTarget, |
88 | | LayoutDeviceIntRegion& aInvalidRegion) |
89 | 0 | { |
90 | 0 | mWidget->EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion); |
91 | 0 | } |
92 | | |
93 | | void |
94 | | InProcessCompositorWidget::CleanupRemoteDrawing() |
95 | 0 | { |
96 | 0 | mWidget->CleanupRemoteDrawing(); |
97 | 0 | } |
98 | | |
99 | | void |
100 | | InProcessCompositorWidget::CleanupWindowEffects() |
101 | 0 | { |
102 | 0 | mWidget->CleanupWindowEffects(); |
103 | 0 | } |
104 | | |
105 | | bool |
106 | | InProcessCompositorWidget::InitCompositor(layers::Compositor* aCompositor) |
107 | 0 | { |
108 | 0 | return mWidget->InitCompositor(aCompositor); |
109 | 0 | } |
110 | | |
111 | | LayoutDeviceIntSize |
112 | | InProcessCompositorWidget::GetClientSize() |
113 | 0 | { |
114 | 0 | return mWidget->GetClientSize(); |
115 | 0 | } |
116 | | |
117 | | uint32_t |
118 | | InProcessCompositorWidget::GetGLFrameBufferFormat() |
119 | 0 | { |
120 | 0 | return mWidget->GetGLFrameBufferFormat(); |
121 | 0 | } |
122 | | |
123 | | uintptr_t |
124 | | InProcessCompositorWidget::GetWidgetKey() |
125 | 0 | { |
126 | 0 | return reinterpret_cast<uintptr_t>(mWidget); |
127 | 0 | } |
128 | | |
129 | | nsIWidget* |
130 | | InProcessCompositorWidget::RealWidget() |
131 | 0 | { |
132 | 0 | return mWidget; |
133 | 0 | } |
134 | | |
135 | | void |
136 | | InProcessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) |
137 | 0 | { |
138 | 0 | if (RefPtr<CompositorVsyncDispatcher> cvd = mWidget->GetCompositorVsyncDispatcher()) { |
139 | 0 | cvd->SetCompositorVsyncObserver(aObserver); |
140 | 0 | } |
141 | 0 | } |
142 | | |
143 | | } // namespace widget |
144 | | } // namespace mozilla |
145 | | |