WindowSurface.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef _MOZILLA_WIDGET_WINDOW_SURFACE_H
  7. #define _MOZILLA_WIDGET_WINDOW_SURFACE_H
  8. #include "mozilla/gfx/2D.h"
  9. #include "Units.h"
  10. namespace mozilla {
  11. namespace widget {
  12. // A class for drawing to double-buffered windows.
  13. class WindowSurface {
  14. public:
  15. virtual ~WindowSurface() {}
  16. // Locks a region of the window for drawing, returning a draw target
  17. // capturing the bounds of the provided region.
  18. // Implementations must permit invocation from any thread.
  19. virtual already_AddRefed<gfx::DrawTarget> Lock(const LayoutDeviceIntRegion& aRegion) = 0;
  20. // Swaps the provided invalid region from the back buffer to the window.
  21. // Implementations must permit invocation from any thread.
  22. virtual void Commit(const LayoutDeviceIntRegion& aInvalidRegion) = 0;
  23. // Whether the window surface represents a fallback method.
  24. virtual bool IsFallback() const { return false; }
  25. };
  26. } // namespace widget
  27. } // namespace mozilla
  28. #endif // _MOZILLA_WIDGET_WINDOW_SURFACE_H