diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index c043af5e85bf..07711eef2a8a 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -316,14 +316,14 @@ DrawBlitProg::DrawBlitProg(const GLBlitHelper* const parent, const GLuint prog) : mParent(*parent) , mProg(prog) , mLoc_u1ForYFlip(mParent.mGL->fGetUniformLocation(mProg, "u1ForYFlip")) - , mLoc_uClipRect(mParent.mGL->fGetUniformLocation(mProg, "uClipRect")) + , mLoc_uSrcRect(mParent.mGL->fGetUniformLocation(mProg, "uSrcRect")) , mLoc_uTexSize0(mParent.mGL->fGetUniformLocation(mProg, "uTexSize0")) , mLoc_uTexSize1(mParent.mGL->fGetUniformLocation(mProg, "uTexSize1")) , mLoc_uDivisors(mParent.mGL->fGetUniformLocation(mProg, "uDivisors")) , mLoc_uColorMatrix(mParent.mGL->fGetUniformLocation(mProg, "uColorMatrix")) { MOZ_ASSERT(mLoc_u1ForYFlip != -1); - MOZ_ASSERT(mLoc_uClipRect != -1); + MOZ_ASSERT(mLoc_uSrcRect != -1); MOZ_ASSERT(mLoc_uTexSize0 != -1); if (mLoc_uColorMatrix != -1) { MOZ_ASSERT(mLoc_uTexSize1 != -1); @@ -351,9 +351,9 @@ DrawBlitProg::Draw(const BaseArgs& args, const YUVArgs* const argsYUV) const // -- gl->fUniform1f(mLoc_u1ForYFlip, args.yFlip ? 1 : 0); - gl->fUniform4f(mLoc_uClipRect, - args.clipRect.x, args.clipRect.y, - args.clipRect.width, args.clipRect.height); + gl->fUniform4f(mLoc_uSrcRect, + args.srcRect.x, args.srcRect.y, + args.srcRect.width, args.srcRect.height); gl->fUniform2f(mLoc_uTexSize0, args.texSize0.width, args.texSize0.height); MOZ_ASSERT(bool(argsYUV) == (mLoc_uColorMatrix != -1)); @@ -429,7 +429,7 @@ GLBlitHelper::GLBlitHelper(GLContext* const gl) ATTRIBUTE vec2 aVert; \n\ \n\ uniform float u1ForYFlip; \n\ - uniform vec4 uClipRect; \n\ + uniform vec4 uSrcRect; \n\ uniform vec2 uTexSize0; \n\ uniform vec2 uTexSize1; \n\ uniform vec2 uDivisors; \n\ @@ -444,7 +444,7 @@ GLBlitHelper::GLBlitHelper(GLContext* const gl) \n\ vec2 texCoord = aVert; \n\ texCoord.y = abs(u1ForYFlip - texCoord.y); \n\ - texCoord = texCoord * uClipRect.zw + uClipRect.xy; \n\ + texCoord = texCoord * uSrcRect.zw + uSrcRect.xy; \n\ \n\ vTexCoord0 = texCoord / uTexSize0; \n\ vTexCoord1 = texCoord / (uTexSize1 * uDivisors); \n\ @@ -588,7 +588,8 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage, #ifdef MOZ_WIDGET_ANDROID case ImageFormat::SURFACE_TEXTURE: - return BlitImage(static_cast(srcImage)); + return BlitImage(static_cast(srcImage), destSize, + destOrigin); case ImageFormat::EGLIMAGE: return BlitImage(static_cast(srcImage), destSize, @@ -619,7 +620,8 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage, #ifdef MOZ_WIDGET_ANDROID bool -GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage) +GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage, const gfx::IntSize&, + const OriginPos) const { // FIXME const auto& srcOrigin = srcImage->GetOriginPos(); @@ -630,7 +632,7 @@ GLBlitHelper::BlitImage(layers::SurfaceTextureImage* srcImage) bool GLBlitHelper::BlitImage(layers::EGLImageImage* const srcImage, - const gfx::IntSize& destSize, const OriginPos destOrigin) + const gfx::IntSize& destSize, const OriginPos destOrigin) const { const EGLImage eglImage = srcImage->GetImage(); const EGLSync eglSync = srcImage->GetSync(); @@ -651,9 +653,9 @@ GLBlitHelper::BlitImage(layers::EGLImageImage* const srcImage, const auto& srcOrigin = srcImage->GetOriginPos(); const bool yFlip = destOrigin != srcOrigin; - const gfx::IntRect clipRect(0, 0, 1, 1); - const gfx::IntSize texSizeDivisor(1, 1); - const DrawBlitProg::DrawArgs baseArgs = { destSize, yFlip, clipRect, texSizeDivisor }; + const gfx::IntRect srcRect(0, 0, 1, 1); + const gfx::IntSize srcSize(1, 1); + const DrawBlitProg::BaseArgs baseArgs = { destSize, yFlip, srcRect, srcSize }; const auto& prog = GetDrawBlitProg({kFragHeader_Tex2D, kFragBody_RGBA}); MOZ_RELEASE_ASSERT(prog); diff --git a/gfx/gl/GLBlitHelper.h b/gfx/gl/GLBlitHelper.h index 83d1002f8350..81a1a0462f17 100644 --- a/gfx/gl/GLBlitHelper.h +++ b/gfx/gl/GLBlitHelper.h @@ -47,7 +47,7 @@ class DrawBlitProg final const GLBlitHelper& mParent; const GLuint mProg; const GLint mLoc_u1ForYFlip; - const GLint mLoc_uClipRect; + const GLint mLoc_uSrcRect; const GLint mLoc_uTexSize0; const GLint mLoc_uTexSize1; const GLint mLoc_uDivisors; @@ -71,7 +71,7 @@ public: struct BaseArgs final { gfx::IntSize destSize; bool yFlip; - gfx::IntRect clipRect; + gfx::IntRect srcRect; gfx::IntSize texSize0; }; struct YUVArgs final { @@ -130,8 +130,10 @@ public: OriginPos destOrigin); #ifdef MOZ_WIDGET_ANDROID // Blit onto the current FB. - bool BlitImage(layers::SurfaceTextureImage* stImage); - bool BlitImage(layers::EGLImageImage* eglImage); + bool BlitImage(layers::SurfaceTextureImage* stImage, const gfx::IntSize& destSize, + OriginPos destOrigin) const; + bool BlitImage(layers::EGLImageImage* eglImage, const gfx::IntSize& destSize, + OriginPos destOrigin) const; #endif #ifdef XP_MACOSX bool BlitImage(layers::MacIOSurfaceImage* srcImage, const gfx::IntSize& destSize,