1 /* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_widget_AndroidCompositorWidget_h
7 #define mozilla_widget_AndroidCompositorWidget_h
9 #include "CompositorWidget.h"
10 #include "AndroidNativeWindow.h"
16 class PlatformCompositorWidgetDelegate
: public CompositorWidgetDelegate
{
18 virtual void NotifyClientSizeChanged(
19 const LayoutDeviceIntSize
& aClientSize
) = 0;
21 // CompositorWidgetDelegate Overrides
22 PlatformCompositorWidgetDelegate
* AsPlatformSpecificDelegate() override
{
27 class AndroidCompositorWidgetInitData
;
29 class AndroidCompositorWidget
: public CompositorWidget
{
31 AndroidCompositorWidget(const AndroidCompositorWidgetInitData
& aInitData
,
32 const layers::CompositorOptions
& aOptions
);
33 ~AndroidCompositorWidget() override
;
35 EGLNativeWindowType
GetEGLNativeWindow();
37 // CompositorWidget overrides
39 already_AddRefed
<gfx::DrawTarget
> StartRemoteDrawingInRegion(
40 const LayoutDeviceIntRegion
& aInvalidRegion
,
41 layers::BufferMode
* aBufferMode
) override
;
42 void EndRemoteDrawingInRegion(
43 gfx::DrawTarget
* aDrawTarget
,
44 const LayoutDeviceIntRegion
& aInvalidRegion
) override
;
46 bool OnResumeComposition() override
;
48 AndroidCompositorWidget
* AsAndroid() override
{ return this; }
50 LayoutDeviceIntSize
GetClientSize() override
;
51 void NotifyClientSizeChanged(const LayoutDeviceIntSize
& aClientSize
);
55 java::sdk::Surface::GlobalRef mSurface
;
56 ANativeWindow
* mNativeWindow
;
57 ANativeWindow_Buffer mBuffer
;
59 LayoutDeviceIntSize mClientSize
;
62 // Called whenever the compositor surface may have changed. The derived class
63 // should update mSurface to the new compositor surface.
64 virtual void OnCompositorSurfaceChanged() = 0;
68 } // namespace mozilla
70 #endif // mozilla_widget_AndroidCompositorWidget_h