1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 #ifndef GFX_MACIOSURFACEIMAGE_H
8 #define GFX_MACIOSURFACEIMAGE_H
10 #include "ImageContainer.h"
11 #include "mozilla/gfx/MacIOSurface.h"
12 #include "mozilla/gfx/Point.h"
13 #include "mozilla/layers/TextureClient.h"
19 class MacIOSurfaceImage
: public Image
{
21 explicit MacIOSurfaceImage(MacIOSurface
* aSurface
)
22 : Image(nullptr, ImageFormat::MAC_IOSURFACE
), mSurface(aSurface
) {}
24 MacIOSurface
* GetSurface() { return mSurface
; }
26 gfx::IntSize
GetSize() const override
{
27 return gfx::IntSize::Truncate(mSurface
->GetDevicePixelWidth(),
28 mSurface
->GetDevicePixelHeight());
31 already_AddRefed
<gfx::SourceSurface
> GetAsSourceSurface() override
;
33 TextureClient
* GetTextureClient(KnowsCompositor
* aKnowsCompositor
) override
;
35 MacIOSurfaceImage
* AsMacIOSurfaceImage() override
{ return this; }
38 RefPtr
<MacIOSurface
> mSurface
;
39 RefPtr
<TextureClient
> mTextureClient
;
43 } // namespace mozilla
45 #endif // GFX_SHAREDTEXTUREIMAGE_H