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: */
|
2012-12-13 02:47:28 +04:00
|
|
|
/* 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 SHAREDRGBIMAGE_H_
|
|
|
|
#define SHAREDRGBIMAGE_H_
|
|
|
|
|
2013-08-12 03:17:23 +04:00
|
|
|
#include <stddef.h> // for size_t
|
|
|
|
#include <stdint.h> // for uint8_t
|
|
|
|
#include "ImageContainer.h" // for ISharedImage, Image, etc
|
2013-09-25 00:45:14 +04:00
|
|
|
#include "gfxTypes.h"
|
2015-03-21 19:28:04 +03:00
|
|
|
#include "mozilla/Attributes.h" // for override
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h" // for RefPtr
|
2013-08-12 03:17:23 +04:00
|
|
|
#include "mozilla/gfx/Point.h" // for IntSize
|
|
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
|
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
2012-12-13 02:47:28 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
2013-08-12 03:17:23 +04:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
class ImageClient;
|
2013-08-12 03:17:23 +04:00
|
|
|
class TextureClient;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
|
|
|
already_AddRefed<Image> CreateSharedRGBImage(ImageContainer* aImageContainer,
|
2015-06-03 14:45:24 +03:00
|
|
|
gfx::IntSize aSize,
|
2013-09-25 00:45:13 +04:00
|
|
|
gfxImageFormat aImageFormat);
|
2012-12-13 02:47:28 +04:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
/**
|
|
|
|
* Stores RGB data in shared memory
|
|
|
|
* It is assumed that the image width and stride are equal
|
|
|
|
*/
|
|
|
|
class SharedRGBImage : public Image {
|
|
|
|
public:
|
2014-08-20 08:55:14 +04:00
|
|
|
explicit SharedRGBImage(ImageClient* aCompositable);
|
2014-07-15 19:37:45 +04:00
|
|
|
|
|
|
|
protected:
|
2017-08-24 05:05:59 +03:00
|
|
|
virtual ~SharedRGBImage();
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
public:
|
2019-06-07 15:27:05 +03:00
|
|
|
TextureClient* GetTextureClient(KnowsCompositor* aKnowsCompositor) override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2017-11-30 21:03:02 +03:00
|
|
|
gfx::IntSize GetSize() const override;
|
2013-07-30 13:59:51 +04:00
|
|
|
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
|
2014-01-17 20:22:56 +04:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
bool Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-07-30 13:59:51 +04:00
|
|
|
private:
|
|
|
|
gfx::IntSize mSize;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ImageClient> mCompositable;
|
2015-10-15 18:53:33 +03:00
|
|
|
RefPtr<TextureClient> mTextureClient;
|
2017-01-23 01:06:17 +03:00
|
|
|
nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
|
2013-07-30 13:59:51 +04:00
|
|
|
};
|
|
|
|
|
2012-12-13 02:47:28 +04:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|