Bug 753 - Remove nsIImage, gfxIImageFrame, and their implementations, and expose an equivalent api on imgIContainer. r=roc,josh,bz,longsonr,vlad,karlt,jimm,bsmedberg,mfinkle,peterw,peterv sr=vlad,roc

This commit is contained in:
Joe Drew
2009-07-20 18:50:15 -07:00
parent 75db10c394
commit 2919d8a083
98 changed files with 2290 additions and 3404 deletions

View File

@@ -47,7 +47,6 @@
#include "nsIGConfService.h"
#include "nsIGnomeVFSService.h"
#include "nsIStringBundle.h"
#include "gfxIImageFrame.h"
#include "nsIOutputStream.h"
#include "nsIProcess.h"
#include "nsNetUtil.h"
@@ -55,7 +54,6 @@
#include "nsIImageLoadingContent.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "nsIImage.h"
#include "prprf.h"
#ifdef MOZ_WIDGET_GTK2
#include "nsIImageToPixbuf.h"
@@ -349,12 +347,8 @@ nsGNOMEShellService::SetShouldCheckDefaultBrowser(PRBool aShouldCheck)
}
static nsresult
WriteImage(const nsCString& aPath, gfxIImageFrame* aImage)
WriteImage(const nsCString& aPath, imgIContainer* aImage)
{
nsCOMPtr<nsIImage> img(do_GetInterface(aImage));
if (!img)
return NS_ERROR_NOT_AVAILABLE;
#ifndef MOZ_WIDGET_GTK2
return NS_ERROR_NOT_AVAILABLE;
#else
@@ -363,7 +357,7 @@ WriteImage(const nsCString& aPath, gfxIImageFrame* aImage)
if (!imgToPixbuf)
return NS_ERROR_NOT_AVAILABLE;
GdkPixbuf* pixbuf = imgToPixbuf->ConvertImageToPixbuf(img);
GdkPixbuf* pixbuf = imgToPixbuf->ConvertImageToPixbuf(aImage);
if (!pixbuf)
return NS_ERROR_NOT_AVAILABLE;
@@ -379,8 +373,6 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
PRInt32 aPosition)
{
nsresult rv;
nsCOMPtr<gfxIImageFrame> gfxFrame;
nsCOMPtr<nsIImageLoadingContent> imageContent = do_QueryInterface(aElement, &rv);
if (!imageContent) return rv;
@@ -393,12 +385,6 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
rv = request->GetImage(getter_AddRefs(container));
if (!container) return rv;
// get the current frame, which holds the image data
container->GetCurrentFrame(getter_AddRefs(gfxFrame));
if (!gfxFrame)
return NS_ERROR_FAILURE;
// Write the background file to the home directory.
nsCAutoString filePath(PR_GetEnv("HOME"));
@@ -423,7 +409,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
filePath.Append("_wallpaper.png");
// write the image to a file in the home dir
rv = WriteImage(filePath, gfxFrame);
rv = WriteImage(filePath, container);
// if the file was written successfully, set it as the system wallpaper
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);