Source code

Revision control

Other Tools

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/. */
6
7
#ifndef GFX_MACIOSURFACEIMAGE_H
8
#define GFX_MACIOSURFACEIMAGE_H
9
10
#include "ImageContainer.h"
11
#include "mozilla/gfx/MacIOSurface.h"
12
#include "mozilla/gfx/Point.h"
13
#include "mozilla/layers/TextureClient.h"
14
15
namespace mozilla {
16
17
namespace layers {
18
19
class MacIOSurfaceImage : public Image {
20
public:
21
explicit MacIOSurfaceImage(MacIOSurface* aSurface)
22
: Image(nullptr, ImageFormat::MAC_IOSURFACE), mSurface(aSurface) {}
23
24
MacIOSurface* GetSurface() { return mSurface; }
25
26
gfx::IntSize GetSize() const override {
27
return gfx::IntSize::Truncate(mSurface->GetDevicePixelWidth(),
28
mSurface->GetDevicePixelHeight());
29
}
30
31
already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
32
33
TextureClient* GetTextureClient(KnowsCompositor* aKnowsCompositor) override;
34
35
MacIOSurfaceImage* AsMacIOSurfaceImage() override { return this; }
36
37
private:
38
RefPtr<MacIOSurface> mSurface;
39
RefPtr<TextureClient> mTextureClient;
40
};
41
42
} // namespace layers
43
} // namespace mozilla
44
45
#endif // GFX_SHAREDTEXTUREIMAGE_H