зеркало из https://github.com/mozilla/pjs.git
Bug 604101 - Part 2 - Use UploadSurfaceToTexture in CairoImageOGL. r=joe a=blocking2.0
This commit is contained in:
Родитель
5a88325c98
Коммит
f60965ddb0
|
@ -429,9 +429,8 @@ ImageLayerOGL::RenderLayer(int,
|
||||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, cairoImage->mTexture.GetTextureID());
|
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, cairoImage->mTexture.GetTextureID());
|
||||||
|
|
||||||
ColorTextureLayerProgram *program =
|
ColorTextureLayerProgram *program =
|
||||||
mOGLManager->GetBasicLayerProgram(CanUseOpaqueSurface(),
|
mOGLManager->GetColorTextureLayerProgram(cairoImage->mLayerProgram);
|
||||||
cairoImage->mASurfaceAsGLContext != 0);
|
|
||||||
|
|
||||||
ApplyFilter(mFilter);
|
ApplyFilter(mFilter);
|
||||||
|
|
||||||
|
@ -680,12 +679,12 @@ CairoImageOGL::SetData(const CairoImage::Data &aData)
|
||||||
mozilla::gl::GLContext *gl = mTexture.GetGLContext();
|
mozilla::gl::GLContext *gl = mTexture.GetGLContext();
|
||||||
gl->MakeCurrent();
|
gl->MakeCurrent();
|
||||||
|
|
||||||
|
GLuint tex = mTexture.GetTextureID();
|
||||||
|
|
||||||
if (mSize != aData.mSize) {
|
if (mSize != aData.mSize) {
|
||||||
gl->fActiveTexture(LOCAL_GL_TEXTURE0);
|
gl->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||||
InitTexture(gl, mTexture.GetTextureID(), LOCAL_GL_RGBA, aData.mSize);
|
InitTexture(gl, tex, LOCAL_GL_RGBA, aData.mSize);
|
||||||
mSize = aData.mSize;
|
mSize = aData.mSize;
|
||||||
} else {
|
|
||||||
gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture.GetTextureID());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mASurfaceAsGLContext) {
|
if (!mASurfaceAsGLContext) {
|
||||||
|
@ -697,22 +696,10 @@ CairoImageOGL::SetData(const CairoImage::Data &aData)
|
||||||
if (mASurfaceAsGLContext)
|
if (mASurfaceAsGLContext)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// XXX This could be a lot more efficient if we already have an image-compatible
|
mLayerProgram =
|
||||||
// surface
|
gl->UploadSurfaceToTexture(aData.mSurface,
|
||||||
// XXX if we ever create an ImageFormatRGB24 surface, make sure that we use
|
nsIntRect(0,0, mSize.width, mSize.height),
|
||||||
// a BGRX program in that case (instead of BGRA)
|
tex);
|
||||||
nsRefPtr<gfxImageSurface> imageSurface =
|
|
||||||
new gfxImageSurface(aData.mSize, gfxASurface::ImageFormatARGB32);
|
|
||||||
nsRefPtr<gfxContext> context = new gfxContext(imageSurface);
|
|
||||||
|
|
||||||
context->SetSource(aData.mSurface);
|
|
||||||
context->Paint();
|
|
||||||
|
|
||||||
gl->fTexSubImage2D(LOCAL_GL_TEXTURE_2D, 0,
|
|
||||||
0, 0, mSize.width, mSize.height,
|
|
||||||
LOCAL_GL_RGBA,
|
|
||||||
LOCAL_GL_UNSIGNED_BYTE,
|
|
||||||
imageSurface->Data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,7 @@ public:
|
||||||
GLTexture mTexture;
|
GLTexture mTexture;
|
||||||
gfxIntSize mSize;
|
gfxIntSize mSize;
|
||||||
nsRefPtr<GLContext> mASurfaceAsGLContext;
|
nsRefPtr<GLContext> mASurfaceAsGLContext;
|
||||||
|
gl::ShaderProgramType mLayerProgram;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче