1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "WindowSurfaceX11SHM.h"
9 namespace mozilla::widget
{
11 WindowSurfaceX11SHM::WindowSurfaceX11SHM(Display
* aDisplay
, Drawable aWindow
,
12 Visual
* aVisual
, unsigned int aDepth
) {
13 mFrontImage
= new nsShmImage(aDisplay
, aWindow
, aVisual
, aDepth
);
14 mBackImage
= new nsShmImage(aDisplay
, aWindow
, aVisual
, aDepth
);
17 already_AddRefed
<gfx::DrawTarget
> WindowSurfaceX11SHM::Lock(
18 const LayoutDeviceIntRegion
& aRegion
) {
19 mBackImage
.swap(mFrontImage
);
20 return mBackImage
->CreateDrawTarget(aRegion
);
23 void WindowSurfaceX11SHM::Commit(const LayoutDeviceIntRegion
& aInvalidRegion
) {
24 mBackImage
->Put(aInvalidRegion
);
27 } // namespace mozilla::widget