mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=583838; add ANGLE/D3D WebGL support - part 4 - allow CanvasLayerOGL to work with different-type GL contexts; r=bas
This commit is contained in:
parent
9636d54ad1
commit
51835ef8a6
@ -132,13 +132,15 @@ CanvasLayerOGL::Updated(const nsIntRect& aRect)
|
||||
|
||||
mUpdatedRect.UnionRect(mUpdatedRect, aRect);
|
||||
|
||||
if (mCanvasGLContext) {
|
||||
if (mCanvasGLContext &&
|
||||
mCanvasGLContext->GetContextType() == gl()->GetContextType())
|
||||
{
|
||||
if (gl()->BindOffscreenNeedsTexture(mCanvasGLContext) &&
|
||||
mTexture == 0)
|
||||
{
|
||||
MakeTexture();
|
||||
}
|
||||
} else if (mCanvasSurface) {
|
||||
} else {
|
||||
PRBool newTexture = mTexture == 0;
|
||||
if (newTexture) {
|
||||
MakeTexture();
|
||||
@ -149,6 +151,7 @@ CanvasLayerOGL::Updated(const nsIntRect& aRect)
|
||||
}
|
||||
|
||||
nsRefPtr<gfxImageSurface> updatedAreaImageSurface;
|
||||
if (mCanvasSurface) {
|
||||
nsRefPtr<gfxASurface> sourceSurface = mCanvasSurface;
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -184,6 +187,15 @@ CanvasLayerOGL::Updated(const nsIntRect& aRect)
|
||||
ctx->SetSource(sourceSurface);
|
||||
ctx->Paint();
|
||||
}
|
||||
} else if (mCanvasGLContext) {
|
||||
updatedAreaImageSurface =
|
||||
new gfxImageSurface(gfxIntSize(mUpdatedRect.width, mUpdatedRect.height),
|
||||
gfxASurface::ImageFormatARGB32);
|
||||
mCanvasGLContext->ReadPixelsIntoImageSurface(mUpdatedRect.x, mUpdatedRect.y,
|
||||
mUpdatedRect.width,
|
||||
mUpdatedRect.height,
|
||||
updatedAreaImageSurface);
|
||||
}
|
||||
|
||||
if (newTexture) {
|
||||
gl()->fTexImage2D(LOCAL_GL_TEXTURE_2D,
|
||||
@ -231,12 +243,12 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
|
||||
}
|
||||
|
||||
if (mCanvasGLContext) {
|
||||
bool useGLContext = mCanvasGLContext &&
|
||||
mCanvasGLContext->GetContextType() == gl()->GetContextType();
|
||||
|
||||
if (useGLContext) {
|
||||
gl()->BindTex2DOffscreen(mCanvasGLContext);
|
||||
DEBUG_GL_ERROR_CHECK(gl());
|
||||
}
|
||||
|
||||
if (mCanvasGLContext) {
|
||||
program = mOGLManager->GetRGBALayerProgram();
|
||||
} else {
|
||||
program = mOGLManager->GetBGRALayerProgram();
|
||||
@ -253,7 +265,7 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||
|
||||
DEBUG_GL_ERROR_CHECK(gl());
|
||||
|
||||
if (mCanvasGLContext) {
|
||||
if (useGLContext) {
|
||||
gl()->UnbindTex2DOffscreen(mCanvasGLContext);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user