From e0f0056719959efe110a84bbef12129cae3e2aa5 Mon Sep 17 00:00:00 2001 From: "pavlov%pavlov.net" Date: Mon, 1 May 2006 22:39:11 +0000 Subject: [PATCH] adding support for MOZ_DISABLE_IMAGE_OPTIMIZE env var to thebes so you can force image data allocated to stay in the firefox process. bug 336191. r=mrbkap --- gfx/src/thebes/nsThebesImage.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/gfx/src/thebes/nsThebesImage.cpp b/gfx/src/thebes/nsThebesImage.cpp index 290a8f0eb350..37699b5e82ea 100644 --- a/gfx/src/thebes/nsThebesImage.cpp +++ b/gfx/src/thebes/nsThebesImage.cpp @@ -36,28 +36,17 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsMemory.h" -#include "nsColor.h" - -#include "nsThebesDeviceContext.h" -#include "nsThebesRenderingContext.h" -#include "nsThebesDrawingSurface.h" #include "nsThebesImage.h" +#include "nsThebesRenderingContext.h" #include "gfxContext.h" #include "gfxPattern.h" #include "gfxPlatform.h" -#ifdef MOZ_ENABLE_GTK2 -#include -#include "gfxXlibSurface.h" +#include "prenv.h" -#ifdef MOZ_ENABLE_GLITZ -#include "glitz-glx.h" -#include "gfxGlitzSurface.h" -#endif -#endif +static PRBool gDisableOptimize = PR_FALSE; NS_IMPL_ISUPPORTS1(nsThebesImage, nsIImage) @@ -67,6 +56,13 @@ nsThebesImage::nsThebesImage() mDecoded(0,0,0,0), mAlphaDepth(0) { + static PRBool hasCheckedOptimize = PR_FALSE; + if (!hasCheckedOptimize) { + if (PR_GetEnv("MOZ_DISABLE_IMAGE_OPTIMIZE")) { + gDisableOptimize = PR_TRUE; + } + hasCheckedOptimize = PR_TRUE; + } } nsresult @@ -175,6 +171,9 @@ nsThebesImage::GetIsImageComplete() nsresult nsThebesImage::Optimize(nsIDeviceContext* aContext) { + if (gDisableOptimize) + return NS_OK; + if (mOptSurface) return NS_OK;