mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 960254 - Part 1: Add new Map/Unmap APIs to DataSourceSurface. r=jrmuizel
This commit is contained in:
parent
370e329706
commit
ccea287183
38
gfx/2d/2D.h
38
gfx/2d/2D.h
@ -23,6 +23,8 @@
|
||||
// solution.
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
|
||||
#ifdef MOZ_ENABLE_FREETYPE
|
||||
#include <string>
|
||||
#endif
|
||||
@ -337,14 +339,30 @@ public:
|
||||
class DataSourceSurface : public SourceSurface
|
||||
{
|
||||
public:
|
||||
DataSourceSurface()
|
||||
: mIsMapped(false)
|
||||
{
|
||||
}
|
||||
|
||||
struct MappedSurface {
|
||||
uint8_t *mData;
|
||||
int32_t mStride;
|
||||
};
|
||||
|
||||
enum MapType {
|
||||
READ,
|
||||
WRITE,
|
||||
READ_WRITE
|
||||
};
|
||||
|
||||
virtual SurfaceType GetType() const { return SurfaceType::DATA; }
|
||||
/*
|
||||
/* [DEPRECATED]
|
||||
* Get the raw bitmap data of the surface.
|
||||
* Can return null if there was OOM allocating surface data.
|
||||
*/
|
||||
virtual uint8_t *GetData() = 0;
|
||||
|
||||
/*
|
||||
/* [DEPRECATED]
|
||||
* Stride of the surface, distance in bytes between the start of the image
|
||||
* data belonging to row y and row y+1. This may be negative.
|
||||
* Can return 0 if there was OOM allocating surface data.
|
||||
@ -357,11 +375,27 @@ public:
|
||||
*/
|
||||
virtual void MarkDirty() {}
|
||||
|
||||
virtual bool Map(MapType, MappedSurface *aMappedSurface)
|
||||
{
|
||||
aMappedSurface->mData = GetData();
|
||||
aMappedSurface->mStride = Stride();
|
||||
mIsMapped = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void Unmap()
|
||||
{
|
||||
MOZ_ASSERT(mIsMapped);
|
||||
mIsMapped = false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns a DataSourceSurface with the same data as this one, but
|
||||
* guaranteed to have surface->GetType() == SurfaceType::DATA.
|
||||
*/
|
||||
virtual TemporaryRef<DataSourceSurface> GetDataSurface();
|
||||
|
||||
DebugOnly<bool> mIsMapped;
|
||||
};
|
||||
|
||||
/* This is an abstract object that accepts path segments. */
|
||||
|
Loading…
Reference in New Issue
Block a user