2013-10-31 18:54:14 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#ifndef GFX_MACIOSURFACEIMAGE_H
|
|
|
|
#define GFX_MACIOSURFACEIMAGE_H
|
|
|
|
|
2013-10-31 18:54:14 -07:00
|
|
|
#include "ImageContainer.h"
|
2013-10-31 18:54:14 -07:00
|
|
|
#include "mozilla/gfx/MacIOSurface.h"
|
2013-12-13 09:32:02 -08:00
|
|
|
#include "mozilla/gfx/Point.h"
|
2013-10-31 18:54:14 -07:00
|
|
|
#include "mozilla/layers/TextureClient.h"
|
2013-10-31 18:54:14 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
|
2015-03-18 14:15:38 -07:00
|
|
|
class MacIOSurfaceImage : public Image {
|
2013-10-31 18:54:14 -07:00
|
|
|
public:
|
2015-11-17 00:09:00 -08:00
|
|
|
explicit MacIOSurfaceImage(MacIOSurface* aSurface)
|
|
|
|
: Image(nullptr, ImageFormat::MAC_IOSURFACE),
|
|
|
|
mSurface(aSurface)
|
|
|
|
{}
|
|
|
|
|
2013-10-31 18:54:14 -07:00
|
|
|
MacIOSurface* GetSurface() { return mSurface; }
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
gfx::IntSize GetSize() override {
|
2013-12-20 08:46:29 -08:00
|
|
|
return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
|
2013-10-31 18:54:14 -07:00
|
|
|
}
|
|
|
|
|
2015-06-17 07:00:52 -07:00
|
|
|
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
|
2014-01-27 05:25:50 -08:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual TextureClient* GetTextureClient(CompositableClient* aClient) override;
|
2013-10-31 18:54:14 -07:00
|
|
|
|
2015-11-17 00:09:00 -08:00
|
|
|
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() override {
|
|
|
|
return this;
|
|
|
|
}
|
2013-10-31 18:54:14 -07:00
|
|
|
|
|
|
|
private:
|
2015-10-17 22:24:48 -07:00
|
|
|
RefPtr<MacIOSurface> mSurface;
|
|
|
|
RefPtr<TextureClient> mTextureClient;
|
2013-10-31 18:54:14 -07:00
|
|
|
};
|
|
|
|
|
2015-07-13 08:25:42 -07:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2013-10-31 18:54:14 -07:00
|
|
|
|
|
|
|
#endif // GFX_SHAREDTEXTUREIMAGE_H
|