mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 814159 - Part 3: remove the backing surface code from GLContextProviderEGL.cpp - r=benwa
This commit is contained in:
parent
ad163989cd
commit
343745dead
@ -110,23 +110,13 @@ public:
|
||||
|
||||
using namespace mozilla::gfx;
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
static bool gUseBackingSurface = true;
|
||||
#else
|
||||
static bool gUseBackingSurface = false;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
extern nsIntRect gScreenBounds;
|
||||
#endif
|
||||
|
||||
#define EGL_DISPLAY() sEGLLibrary.Display()
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
static GLLibraryEGL sEGLLibrary;
|
||||
|
||||
#define ADD_ATTR_2(_array, _k, _v) do { \
|
||||
(_array).AppendElement(_k); \
|
||||
(_array).AppendElement(_v); \
|
||||
@ -318,13 +308,6 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
char propValue[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.build.version.sdk", propValue, "0");
|
||||
if (atoi(propValue) < 15)
|
||||
gUseBackingSurface = false;
|
||||
#endif
|
||||
|
||||
bool current = MakeCurrent();
|
||||
if (!current) {
|
||||
gfx::LogFailure(NS_LITERAL_CSTRING(
|
||||
@ -1045,24 +1028,15 @@ public:
|
||||
mUpdateFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(GetContentType());
|
||||
}
|
||||
|
||||
if (gUseBackingSurface) {
|
||||
if (mUpdateFormat != gfxImageFormatARGB32) {
|
||||
mTextureFormat = FORMAT_R8G8B8X8;
|
||||
} else {
|
||||
mTextureFormat = FORMAT_R8G8B8A8;
|
||||
}
|
||||
Resize(aSize);
|
||||
if (mUpdateFormat == gfxImageFormatRGB16_565) {
|
||||
mTextureFormat = FORMAT_R8G8B8X8;
|
||||
} else if (mUpdateFormat == gfxImageFormatRGB24) {
|
||||
// RGB24 means really RGBX for Thebes, which means we have to
|
||||
// use the right shader and ignore the uninitialized alpha
|
||||
// value.
|
||||
mTextureFormat = FORMAT_B8G8R8X8;
|
||||
} else {
|
||||
if (mUpdateFormat == gfxImageFormatRGB16_565) {
|
||||
mTextureFormat = FORMAT_R8G8B8X8;
|
||||
} else if (mUpdateFormat == gfxImageFormatRGB24) {
|
||||
// RGB24 means really RGBX for Thebes, which means we have to
|
||||
// use the right shader and ignore the uninitialized alpha
|
||||
// value.
|
||||
mTextureFormat = FORMAT_B8G8R8X8;
|
||||
} else {
|
||||
mTextureFormat = FORMAT_B8G8R8A8;
|
||||
}
|
||||
mTextureFormat = FORMAT_B8G8R8A8;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1082,11 +1056,6 @@ public:
|
||||
DestroyEGLSurface();
|
||||
}
|
||||
|
||||
bool UsingDirectTexture()
|
||||
{
|
||||
return !!mBackingSurface;
|
||||
}
|
||||
|
||||
virtual void GetUpdateRegion(nsIntRegion& aForRegion)
|
||||
{
|
||||
if (mTextureState != Valid) {
|
||||
@ -1095,10 +1064,6 @@ public:
|
||||
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
|
||||
}
|
||||
|
||||
if (UsingDirectTexture()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We can only draw a rectangle, not subregions due to
|
||||
// the way that our texture upload functions work. If
|
||||
// needed, we /could/ do multiple texture uploads if we have
|
||||
@ -1120,11 +1085,6 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mBackingSurface) {
|
||||
mUpdateSurface = mBackingSurface;
|
||||
return mUpdateSurface;
|
||||
}
|
||||
|
||||
//printf_stderr("creating image surface %dx%d format %d\n", mUpdateRect.width, mUpdateRect.height, mUpdateFormat);
|
||||
|
||||
mUpdateSurface =
|
||||
@ -1140,13 +1100,6 @@ public:
|
||||
{
|
||||
NS_ASSERTION(!!mUpdateSurface, "EndUpdate() without BeginUpdate()?");
|
||||
|
||||
if (mBackingSurface && mUpdateSurface == mBackingSurface) {
|
||||
mBackingSurface->SetDeviceOffset(gfxPoint(0, 0));
|
||||
mTextureState = Valid;
|
||||
mUpdateSurface = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
//printf_stderr("EndUpdate: slow path");
|
||||
|
||||
// This is the slower path -- we didn't have any way to set up
|
||||
@ -1260,25 +1213,16 @@ public:
|
||||
return;
|
||||
|
||||
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
|
||||
|
||||
// Try to generate a backin surface first if we have the ability
|
||||
if (gUseBackingSurface) {
|
||||
CreateBackingSurface(gfxIntSize(aSize.width, aSize.height));
|
||||
}
|
||||
|
||||
if (!UsingDirectTexture()) {
|
||||
// If we don't have a backing surface or failed to obtain one,
|
||||
// use the GL Texture failsafe
|
||||
mGLContext->fTexImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
0,
|
||||
GLFormatForImage(mUpdateFormat),
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
0,
|
||||
GLFormatForImage(mUpdateFormat),
|
||||
GLTypeForImage(mUpdateFormat),
|
||||
nullptr);
|
||||
}
|
||||
mGLContext->fTexImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
0,
|
||||
GLFormatForImage(mUpdateFormat),
|
||||
aSize.width,
|
||||
aSize.height,
|
||||
0,
|
||||
GLFormatForImage(mUpdateFormat),
|
||||
GLTypeForImage(mUpdateFormat),
|
||||
nullptr);
|
||||
|
||||
mTextureState = Allocated;
|
||||
mSize = aSize;
|
||||
@ -1318,12 +1262,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfxASurface> GetBackingSurface()
|
||||
{
|
||||
nsRefPtr<gfxASurface> copy = mBackingSurface;
|
||||
return copy.forget();
|
||||
}
|
||||
|
||||
virtual bool CreateEGLSurface(gfxASurface* aSurface)
|
||||
{
|
||||
return false;
|
||||
@ -1338,15 +1276,6 @@ public:
|
||||
mSurface = nullptr;
|
||||
}
|
||||
|
||||
virtual bool CreateBackingSurface(const gfxIntSize& aSize)
|
||||
{
|
||||
ReleaseTexImage();
|
||||
DestroyEGLSurface();
|
||||
mBackingSurface = nullptr;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
typedef gfxImageFormat ImageFormat;
|
||||
|
||||
@ -1354,8 +1283,6 @@ protected:
|
||||
|
||||
nsIntRect mUpdateRect;
|
||||
ImageFormat mUpdateFormat;
|
||||
bool mUsingDirectTexture;
|
||||
nsRefPtr<gfxASurface> mBackingSurface;
|
||||
nsRefPtr<gfxASurface> mUpdateSurface;
|
||||
EGLImage mEGLImage;
|
||||
GLuint mTexture;
|
||||
|
@ -15,6 +15,8 @@
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
GLLibraryEGL sEGLLibrary;
|
||||
|
||||
// should match the order of EGLExtensions, and be null-terminated.
|
||||
static const char *sExtensionNames[] = {
|
||||
"EGL_KHR_image_base",
|
||||
|
Loading…
Reference in New Issue
Block a user