this looks like post-unlock material to me.


On 2011/01/19 15:18, David Coppa wrote:
> Hi,
> 
> Now that we have cairo-1.10.2, that has fixed many annoying bugs
> present in version 1.10.0,
> we can safely re-enable system-cairo for mozilla-firefox and
> mozilla-thunderbird.
> The only remaining problem was with animated gifs, but this[1] patch,
> backported from
> the firefox-4 branch, fixes it:
> 
> [1] 
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-libs/xulrunner/files/fix-animated-gifs.patch
> 
> Unfortunately, the above trick cannot be applied to firefox35,
> seamonkey and sunbird, which will
> remain with their in-tree cairo.
> 
> What about the following diff?
> 
> CIAO
> David
> 
> Index: devel/xulrunner/1.9/Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/xulrunner/1.9/Makefile,v
> retrieving revision 1.36
> diff -u -p -r1.36 Makefile
> --- devel/xulrunner/1.9/Makefile      18 Jan 2011 12:37:44 -0000      1.36
> +++ devel/xulrunner/1.9/Makefile      19 Jan 2011 14:01:13 -0000
> @@ -5,7 +5,7 @@ FFX_VERSION =         3.6.13
>  MOZILLA_BRANCH =     1.9.2
>  MOZILLA_PROJECT =    xulrunner1.9
>  DISTNAME =           firefox-${FFX_VERSION}.source
> -REVISION-main =              2
> +REVISION-main =              3
>  REVISION-devel =     1
> 
>  MASTER_SITES =       
> http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${FFX_VERSION}/source/
> @@ -26,6 +26,8 @@ PKG_ARGS+=  -Djit=0 -Damd64=0
>  # use files and patches from www/mozilla-firefox
>  PATCHDIR =           ${PORTSDIR}/www/mozilla-firefox/patches
>  FILESDIR =           ${PORTSDIR}/www/mozilla-firefox/files
> +
> +CONFIGURE_ARGS +=    --enable-system-cairo
> 
>  MOZILLA_DATADIRS =   chrome components defaults dictionaries greprefs \
>                       icons modules plugins res
> Index: mail/mozilla-thunderbird/Makefile
> ===================================================================
> RCS file: /cvs/ports/mail/mozilla-thunderbird/Makefile,v
> retrieving revision 1.116
> diff -u -p -r1.116 Makefile
> --- mail/mozilla-thunderbird/Makefile 18 Jan 2011 12:37:44 -0000      1.116
> +++ mail/mozilla-thunderbird/Makefile 19 Jan 2011 13:57:47 -0000
> @@ -12,7 +12,7 @@ MOZILLA_CODENAME =  mail
> 
>  MULTI_PACKAGES =     -main -lightning
>  PKGNAME-main =               ${PKGNAME}
> -REVISION-main =              2
> +REVISION-main =              3
>  PKGNAME-lightning =  lightning-1.0beta2
>  EPOCH-lightning =    0
>  REVISION-lightning = 13
> @@ -69,6 +69,8 @@ BUILD_DEPENDS +=    archivers/unzip #to unz
>  # build lightning xpi
>  CONFIGURE_ARGS +=    --enable-calendar \
>                       --enable-official-branding
> +
> +CONFIGURE_ARGS +=    --enable-system-cairo
> 
>  ALL_TARGET = default
> 
> Index: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> ===================================================================
> RCS file: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> diff -N 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
>      19
> Jan 2011 13:57:47 -0000
> @@ -0,0 +1,20 @@
> +$OpenBSD$
> +--- mozilla/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp.orig      Tue
> Dec  7 17:35:50 2010
> ++++ mozilla/modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp   Wed Jan 19
> 11:28:20 2011
> +@@ -202,7 +202,7 @@ static NS_METHOD ReadDataOut(nsIInputStream* in,
> + nsresult
> + nsGIFDecoder2::FlushImageData(PRUint32 fromRow, PRUint32 rows)
> + {
> +-  nsIntRect r(0, fromRow, mGIFStruct.width, rows);
> ++  nsIntRect r(mGIFStruct.x_offset, mGIFStruct.y_offset + fromRow,
> mGIFStruct.width, rows);
> +
> +   // Update image
> +   nsresult rv = mImageContainer->FrameUpdated(mGIFStruct.images_decoded, r);
> +@@ -215,7 +215,6 @@ nsGIFDecoder2::FlushImageData(PRUint32 fromRow, PRUint
> +   if (!mGIFStruct.images_decoded && mObserver) {
> +     PRUint32 imgCurFrame;
> +     mImageContainer->GetCurrentFrameIndex(&imgCurFrame);
> +-    r.y += mGIFStruct.y_offset;
> +     mObserver->OnDataAvailable(nsnull, imgCurFrame ==
> PRUint32(mGIFStruct.images_decoded), &r);
> +   }
> +   return NS_OK;
> Index: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgContainer_cpp
> ===================================================================
> RCS file: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgContainer_cpp
> diff -N 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgContainer_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgContainer_cpp
>        19
> Jan 2011 13:57:47 -0000
> @@ -0,0 +1,24 @@
> +$OpenBSD$
> +--- mozilla/modules/libpr0n/src/imgContainer.cpp.orig        Tue Dec  7 
> 17:35:50 2010
> ++++ mozilla/modules/libpr0n/src/imgContainer.cpp     Wed Jan 19 11:28:20 2011
> +@@ -420,6 +420,8 @@ nsresult imgContainer::InternalAddFrameHelper(PRUint32
> +
> +   frame->GetImageData(imageData, imageLength);
> +
> ++  frame->LockImageData();
> ++
> +   mFrames.InsertElementAt(framenum, frame.forget());
> +   mNumFrames++;
> +
> +@@ -444,6 +446,11 @@ nsresult imgContainer::InternalAddFrame(PRUint32 frame
> +
> +   nsresult rv = frame->Init(aX, aY, aWidth, aHeight, aFormat, 
> aPaletteDepth);
> +   NS_ENSURE_SUCCESS(rv, rv);
> ++
> ++  if (mFrames.Length() > 0) {
> ++    imgFrame *prevframe = mFrames.ElementAt(mFrames.Length() - 1);
> ++    prevframe->UnlockImageData();
> ++  }
> +
> +   if (mFrames.Length() == 0) {
> +     return InternalAddFrameHelper(framenum, frame.forget(),
> imageData, imageLength,
> Index: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_cpp
> ===================================================================
> RCS file: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_cpp
> diff -N 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_cpp
>    19
> Jan 2011 13:57:47 -0000
> @@ -0,0 +1,83 @@
> +$OpenBSD$
> +--- mozilla/modules/libpr0n/src/imgFrame.cpp.orig    Tue Dec  7 17:35:50 2010
> ++++ mozilla/modules/libpr0n/src/imgFrame.cpp Wed Jan 19 11:28:20 2011
> +@@ -157,6 +157,7 @@ imgFrame::imgFrame() :
> + #ifdef USE_WIN_SURFACE
> +   , mIsDDBSurface(PR_FALSE)
> + #endif
> ++  , mLocked(PR_FALSE)
> + {
> +   static PRBool hasCheckedOptimize = PR_FALSE;
> +   if (!hasCheckedOptimize) {
> +@@ -418,8 +419,7 @@ void imgFrame::Draw(gfxContext *aContext, gfxPattern::
> +
> +   PRBool doTile = !imageRect.Contains(sourceRect);
> +   if (doPadding || doPartialDecode) {
> +-    gfxRect available = gfxRect(mDecoded.x, mDecoded.y,
> mDecoded.width, mDecoded.height) +
> +-      gfxPoint(aPadding.left, aPadding.top);
> ++    gfxRect available = gfxRect(mDecoded.x, mDecoded.y,
> mDecoded.width, mDecoded.height);
> +
> +     if (!doTile && !mSinglePixel) {
> +       // Not tiling, and we have a surface, so we can account for
> +@@ -713,7 +713,7 @@ nsresult imgFrame::ImageUpdated(const nsIntRect &aUpda
> +
> +   // clamp to bounds, in case someone sends a bogus updateRect (I'm looking 
> at
> +   // you, gif decoder)
> +-  nsIntRect boundsRect(0, 0, mSize.width, mSize.height);
> ++  nsIntRect boundsRect(mOffset, mSize);
> +   mDecoded.IntersectRect(mDecoded, boundsRect);
> +
> + #ifdef XP_MACOSX
> +@@ -811,8 +811,14 @@ void imgFrame::GetPaletteData(PRUint32 **aPalette, PRU
> + nsresult imgFrame::LockImageData()
> + {
> +   if (mPalettedImageData)
> +-    return NS_OK;
> ++    return NS_ERROR_NOT_AVAILABLE;
> +
> ++  NS_ABORT_IF_FALSE(!mLocked, "Trying to lock already locked image data.");
> ++  if (mLocked) {
> ++    return NS_ERROR_FAILURE;
> ++  }
> ++  mLocked = PR_TRUE;
> ++
> +   if ((mOptSurface || mSinglePixel) && !mImageSurface) {
> +     // Recover the pixels
> +     mImageSurface = new gfxImageSurface(gfxIntSize(mSize.width, 
> mSize.height),
> +@@ -837,14 +843,26 @@ nsresult imgFrame::LockImageData()
> + #endif
> +   }
> +
> ++  if (mImageSurface)
> ++    mImageSurface->Flush();
> ++
> +   return NS_OK;
> + }
> +
> + nsresult imgFrame::UnlockImageData()
> + {
> +   if (mPalettedImageData)
> +-    return NS_OK;
> ++    return NS_ERROR_NOT_AVAILABLE;
> +
> ++  NS_ABORT_IF_FALSE(mLocked, "Unlocking an unlocked image!");
> ++  if (!mLocked) {
> ++    return NS_ERROR_FAILURE;
> ++  }
> ++  mLocked = PR_FALSE;
> ++
> ++  if (mImageSurface)
> ++    mImageSurface->MarkDirty();
> ++
> + #ifdef XP_MACOSX
> +   if (mQuartzSurface)
> +     mQuartzSurface->Flush();
> +@@ -900,7 +918,7 @@ void imgFrame::SetBlendMethod(PRInt32 aBlendMethod)
> +
> + PRBool imgFrame::ImageComplete() const
> + {
> +-  return mDecoded == nsIntRect(0, 0, mSize.width, mSize.height);
> ++  return mDecoded == nsIntRect(mOffset, mSize);
> + }
> +
> + // A hint from the image decoders that this image has no alpha, even
> Index: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_h
> ===================================================================
> RCS file: 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_h
> diff -N 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ 
> mail/mozilla-thunderbird/patches/patch-mozilla_modules_libpr0n_src_imgFrame_h 
>     19
> Jan 2011 13:57:47 -0000
> @@ -0,0 +1,11 @@
> +$OpenBSD$
> +--- mozilla/modules/libpr0n/src/imgFrame.h.orig      Tue Dec  7 17:35:50 2010
> ++++ mozilla/modules/libpr0n/src/imgFrame.h   Wed Jan 19 11:28:20 2011
> +@@ -172,6 +172,7 @@ class imgFrame (private)
> +   PRPackedBool mNeverUseDeviceSurface;
> +   PRPackedBool mFormatChanged;
> +   PRPackedBool mCompositingFailed;
> ++  PRPackedBool mLocked;
> +
> + #ifdef XP_WIN
> +   PRPackedBool mIsDDBSurface;
> Index: www/mozilla-firefox/Makefile
> ===================================================================
> RCS file: /cvs/ports/www/mozilla-firefox/Makefile,v
> retrieving revision 1.165
> diff -u -p -r1.165 Makefile
> --- www/mozilla-firefox/Makefile      18 Jan 2011 12:33:38 -0000      1.165
> +++ www/mozilla-firefox/Makefile      19 Jan 2011 13:57:48 -0000
> @@ -7,7 +7,7 @@ MOZILLA_VERSION =     3.6.13
>  MOZILLA_BRANCH =     1.9.2
>  MOZILLA_PROJECT =    mozilla-firefox
>  MOZILLA_CODENAME =   browser
> -REVISION =           2
> +REVISION =           3
> 
>  SO_VERSION = 22.2
>  # NOTE: Must bump minor version if any shlib's are removed from the
> @@ -39,6 +39,8 @@ CONFIGURE_STYLE =   autoconf no-autoheader
>  CONFIGURE_ARGS +=    --enable-official-branding
>  # --with-system-png=${LOCALBASE}
>  # no system png : apng support not bundled in
> +
> +CONFIGURE_ARGS +=    --enable-system-cairo
> 
>  MOZILLA_DATADIRS =   chrome components defaults dictionaries extensions \
>                       greprefs icons modules plugins res searchplugins
> Index: 
> www/mozilla-firefox/patches/patch-modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> ===================================================================
> RCS file: 
> www/mozilla-firefox/patches/patch-modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> diff -N 
> www/mozilla-firefox/patches/patch-modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ 
> www/mozilla-firefox/patches/patch-modules_libpr0n_decoders_gif_nsGIFDecoder2_cpp
>   19
> Jan 2011 13:57:48 -0000
> @@ -0,0 +1,20 @@
> +$OpenBSD$
> +--- modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp.orig      Fri Dec  3
> 16:48:47 2010
> ++++ modules/libpr0n/decoders/gif/nsGIFDecoder2.cpp   Wed Jan 19 11:07:31 2011
> +@@ -202,7 +202,7 @@ static NS_METHOD ReadDataOut(nsIInputStream* in,
> + nsresult
> + nsGIFDecoder2::FlushImageData(PRUint32 fromRow, PRUint32 rows)
> + {
> +-  nsIntRect r(0, fromRow, mGIFStruct.width, rows);
> ++  nsIntRect r(mGIFStruct.x_offset, mGIFStruct.y_offset + fromRow,
> mGIFStruct.width, rows);
> +
> +   // Update image
> +   nsresult rv = mImageContainer->FrameUpdated(mGIFStruct.images_decoded, r);
> +@@ -215,7 +215,6 @@ nsGIFDecoder2::FlushImageData(PRUint32 fromRow, PRUint
> +   if (!mGIFStruct.images_decoded && mObserver) {
> +     PRUint32 imgCurFrame;
> +     mImageContainer->GetCurrentFrameIndex(&imgCurFrame);
> +-    r.y += mGIFStruct.y_offset;
> +     mObserver->OnDataAvailable(nsnull, imgCurFrame ==
> PRUint32(mGIFStruct.images_decoded), &r);
> +   }
> +   return NS_OK;
> Index: www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgContainer_cpp
> ===================================================================
> RCS file: 
> www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgContainer_cpp
> diff -N www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgContainer_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgContainer_cpp    
> 19
> Jan 2011 13:57:48 -0000
> @@ -0,0 +1,24 @@
> +$OpenBSD$
> +--- modules/libpr0n/src/imgContainer.cpp.orig        Fri Dec  3 16:48:47 2010
> ++++ modules/libpr0n/src/imgContainer.cpp     Wed Jan 19 11:07:31 2011
> +@@ -420,6 +420,8 @@ nsresult imgContainer::InternalAddFrameHelper(PRUint32
> +
> +   frame->GetImageData(imageData, imageLength);
> +
> ++  frame->LockImageData();
> ++
> +   mFrames.InsertElementAt(framenum, frame.forget());
> +   mNumFrames++;
> +
> +@@ -444,6 +446,11 @@ nsresult imgContainer::InternalAddFrame(PRUint32 frame
> +
> +   nsresult rv = frame->Init(aX, aY, aWidth, aHeight, aFormat, 
> aPaletteDepth);
> +   NS_ENSURE_SUCCESS(rv, rv);
> ++
> ++  if (mFrames.Length() > 0) {
> ++    imgFrame *prevframe = mFrames.ElementAt(mFrames.Length() - 1);
> ++    prevframe->UnlockImageData();
> ++  }
> +
> +   if (mFrames.Length() == 0) {
> +     return InternalAddFrameHelper(framenum, frame.forget(),
> imageData, imageLength,
> Index: www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_cpp
> ===================================================================
> RCS file: www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_cpp
> diff -N www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_cpp        
> 19
> Jan 2011 13:57:48 -0000
> @@ -0,0 +1,83 @@
> +$OpenBSD$
> +--- modules/libpr0n/src/imgFrame.cpp.orig    Fri Dec  3 16:48:47 2010
> ++++ modules/libpr0n/src/imgFrame.cpp Wed Jan 19 11:07:31 2011
> +@@ -157,6 +157,7 @@ imgFrame::imgFrame() :
> + #ifdef USE_WIN_SURFACE
> +   , mIsDDBSurface(PR_FALSE)
> + #endif
> ++  , mLocked(PR_FALSE)
> + {
> +   static PRBool hasCheckedOptimize = PR_FALSE;
> +   if (!hasCheckedOptimize) {
> +@@ -418,8 +419,7 @@ void imgFrame::Draw(gfxContext *aContext, gfxPattern::
> +
> +   PRBool doTile = !imageRect.Contains(sourceRect);
> +   if (doPadding || doPartialDecode) {
> +-    gfxRect available = gfxRect(mDecoded.x, mDecoded.y,
> mDecoded.width, mDecoded.height) +
> +-      gfxPoint(aPadding.left, aPadding.top);
> ++    gfxRect available = gfxRect(mDecoded.x, mDecoded.y,
> mDecoded.width, mDecoded.height);
> +
> +     if (!doTile && !mSinglePixel) {
> +       // Not tiling, and we have a surface, so we can account for
> +@@ -713,7 +713,7 @@ nsresult imgFrame::ImageUpdated(const nsIntRect &aUpda
> +
> +   // clamp to bounds, in case someone sends a bogus updateRect (I'm looking 
> at
> +   // you, gif decoder)
> +-  nsIntRect boundsRect(0, 0, mSize.width, mSize.height);
> ++  nsIntRect boundsRect(mOffset, mSize);
> +   mDecoded.IntersectRect(mDecoded, boundsRect);
> +
> + #ifdef XP_MACOSX
> +@@ -811,8 +811,14 @@ void imgFrame::GetPaletteData(PRUint32 **aPalette, PRU
> + nsresult imgFrame::LockImageData()
> + {
> +   if (mPalettedImageData)
> +-    return NS_OK;
> ++    return NS_ERROR_NOT_AVAILABLE;
> +
> ++  NS_ABORT_IF_FALSE(!mLocked, "Trying to lock already locked image data.");
> ++  if (mLocked) {
> ++    return NS_ERROR_FAILURE;
> ++  }
> ++  mLocked = PR_TRUE;
> ++
> +   if ((mOptSurface || mSinglePixel) && !mImageSurface) {
> +     // Recover the pixels
> +     mImageSurface = new gfxImageSurface(gfxIntSize(mSize.width, 
> mSize.height),
> +@@ -837,14 +843,26 @@ nsresult imgFrame::LockImageData()
> + #endif
> +   }
> +
> ++  if (mImageSurface)
> ++    mImageSurface->Flush();
> ++
> +   return NS_OK;
> + }
> +
> + nsresult imgFrame::UnlockImageData()
> + {
> +   if (mPalettedImageData)
> +-    return NS_OK;
> ++    return NS_ERROR_NOT_AVAILABLE;
> +
> ++  NS_ABORT_IF_FALSE(mLocked, "Unlocking an unlocked image!");
> ++  if (!mLocked) {
> ++    return NS_ERROR_FAILURE;
> ++  }
> ++  mLocked = PR_FALSE;
> ++
> ++  if (mImageSurface)
> ++    mImageSurface->MarkDirty();
> ++
> + #ifdef XP_MACOSX
> +   if (mQuartzSurface)
> +     mQuartzSurface->Flush();
> +@@ -900,7 +918,7 @@ void imgFrame::SetBlendMethod(PRInt32 aBlendMethod)
> +
> + PRBool imgFrame::ImageComplete() const
> + {
> +-  return mDecoded == nsIntRect(0, 0, mSize.width, mSize.height);
> ++  return mDecoded == nsIntRect(mOffset, mSize);
> + }
> +
> + // A hint from the image decoders that this image has no alpha, even
> Index: www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_h
> ===================================================================
> RCS file: www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_h
> diff -N www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_h
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ www/mozilla-firefox/patches/patch-modules_libpr0n_src_imgFrame_h  19
> Jan 2011 13:57:48 -0000
> @@ -0,0 +1,11 @@
> +$OpenBSD$
> +--- modules/libpr0n/src/imgFrame.h.orig      Fri Dec  3 16:48:47 2010
> ++++ modules/libpr0n/src/imgFrame.h   Wed Jan 19 11:07:31 2011
> +@@ -172,6 +172,7 @@ class imgFrame (private)
> +   PRPackedBool mNeverUseDeviceSurface;
> +   PRPackedBool mFormatChanged;
> +   PRPackedBool mCompositingFailed;
> ++  PRPackedBool mLocked;
> +
> + #ifdef XP_WIN
> +   PRPackedBool mIsDDBSurface;


Reply via email to