widget/WindowSurfaceX11SHM.cpp
author Petru Lingurar <petru.lingurar@softvision.ro>
Fri, 06 Jul 2018 16:57:36 +0300
changeset 817991 fbd7ee49e77a19cb82463a480f607133fe4887a8
parent 387839 586815d86b50e44a1cc48c734c4da6efcd8ae8ff
child 489668 cbb8fdf1daf98a15f7d57f6b08d273bdf96aa1a0
child 694109 98e2b4ee9775a2a2b5cc1bb8a390bfe901814f38
permissions -rw-r--r--
Bug 1473872 - Start targeting API 26; r?nalexander MozReview-Commit-ID: GqBiQbRy4bu

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "WindowSurfaceX11SHM.h"

namespace mozilla {
namespace widget {

WindowSurfaceX11SHM::WindowSurfaceX11SHM(Display* aDisplay, Drawable aWindow,
                                         Visual* aVisual, unsigned int aDepth)
{
  mFrontImage = new nsShmImage(aDisplay, aWindow, aVisual, aDepth);
  mBackImage = new nsShmImage(aDisplay, aWindow, aVisual, aDepth);
}

already_AddRefed<gfx::DrawTarget>
WindowSurfaceX11SHM::Lock(const LayoutDeviceIntRegion& aRegion)
{
  mBackImage.swap(mFrontImage);
  return mBackImage->CreateDrawTarget(aRegion);
}

void
WindowSurfaceX11SHM::Commit(const LayoutDeviceIntRegion& aInvalidRegion)
{
  mBackImage->Put(aInvalidRegion);
}

} // namespace widget
} // namespace mozilla