WindowSurfaceX11SHM.cpp 1003 B

12345678910111213141516171819202122232425262728293031323334
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  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/. */
  6. #include "WindowSurfaceX11SHM.h"
  7. namespace mozilla {
  8. namespace widget {
  9. WindowSurfaceX11SHM::WindowSurfaceX11SHM(Display* aDisplay, Drawable aWindow,
  10. Visual* aVisual, unsigned int aDepth)
  11. {
  12. mFrontImage = new nsShmImage(aDisplay, aWindow, aVisual, aDepth);
  13. mBackImage = new nsShmImage(aDisplay, aWindow, aVisual, aDepth);
  14. }
  15. already_AddRefed<gfx::DrawTarget>
  16. WindowSurfaceX11SHM::Lock(const LayoutDeviceIntRegion& aRegion)
  17. {
  18. mBackImage.swap(mFrontImage);
  19. return mBackImage->CreateDrawTarget(aRegion);
  20. }
  21. void
  22. WindowSurfaceX11SHM::Commit(const LayoutDeviceIntRegion& aInvalidRegion)
  23. {
  24. mBackImage->Put(aInvalidRegion);
  25. }
  26. } // namespace widget
  27. } // namespace mozilla