2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2013-11-01 05:54:14 +04:00
|
|
|
* 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-11-01 05:54:14 +04:00
|
|
|
#include "ImageContainer.h"
|
2013-11-01 05:54:14 +04:00
|
|
|
#include "mozilla/gfx/MacIOSurface.h"
|
2013-12-13 21:32:02 +04:00
|
|
|
#include "mozilla/gfx/Point.h"
|
2013-11-01 05:54:14 +04:00
|
|
|
#include "mozilla/layers/TextureClient.h"
|
2013-11-01 05:54:14 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
|
2017-11-30 21:03:02 +03:00
|
|
|
class MacIOSurfaceImage : public Image {
|
2013-11-01 05:54:14 +04:00
|
|
|
public:
|
2015-11-17 11:09:00 +03:00
|
|
|
explicit MacIOSurfaceImage(MacIOSurface* aSurface)
|
2017-11-30 21:03:02 +03:00
|
|
|
: Image(nullptr, ImageFormat::MAC_IOSURFACE), mSurface(aSurface) {}
|
2015-11-17 11:09:00 +03:00
|
|
|
|
2013-11-01 05:54:14 +04:00
|
|
|
MacIOSurface* GetSurface() { return mSurface; }
|
|
|
|
|
2017-11-30 21:03:02 +03:00
|
|
|
gfx::IntSize GetSize() const override {
|
2016-07-26 17:48:30 +03:00
|
|
|
return gfx::IntSize::Truncate(mSurface->GetDevicePixelWidth(),
|
|
|
|
mSurface->GetDevicePixelHeight());
|
2013-11-01 05:54:14 +04:00
|
|
|
}
|
|
|
|
|
2017-11-30 21:03:02 +03:00
|
|
|
already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
|
2014-01-27 17:25:50 +04:00
|
|
|
|
2019-06-07 15:27:05 +03:00
|
|
|
TextureClient* GetTextureClient(KnowsCompositor* aKnowsCompositor) override;
|
2013-11-01 05:54:14 +04:00
|
|
|
|
2017-11-30 21:03:02 +03:00
|
|
|
MacIOSurfaceImage* AsMacIOSurfaceImage() override { return this; }
|
2013-11-01 05:54:14 +04:00
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<MacIOSurface> mSurface;
|
|
|
|
RefPtr<TextureClient> mTextureClient;
|
2013-11-01 05:54:14 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2013-11-01 05:54:14 +04:00
|
|
|
|
|
|
|
#endif // GFX_SHAREDTEXTUREIMAGE_H
|