Bug 1708044 - Replace nsIImageToPixbuf with nsImageToPixbuf in the gnome shell service. r=frg

Port Bug 1706299 - Remove nsIImageToPixBuf. r=stransky

It's just useless indirection.
This commit is contained in:
Bill Gianopoulos 2021-04-22 07:08:14 -04:00
Родитель 7639060d45
Коммит 05221fe65c
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -27,7 +27,7 @@
#include "mozilla/Sprintf.h"
#include "mozilla/dom/Element.h"
#if defined(MOZ_WIDGET_GTK)
#include "nsIImageToPixbuf.h"
#include "nsImageToPixbuf.h"
#endif
#include "nsXULAppAPI.h"
#include "gfxPlatform.h"
@ -287,12 +287,10 @@ static nsresult WriteImage(const nsCString &aPath, imgIContainer *aImage) {
#if !defined(MOZ_WIDGET_GTK)
return NS_ERROR_NOT_AVAILABLE;
#else
nsCOMPtr<nsIImageToPixbuf> imgToPixbuf =
do_GetService("@mozilla.org/widget/image-to-gdk-pixbuf;1");
if (!imgToPixbuf) return NS_ERROR_NOT_AVAILABLE;
GdkPixbuf *pixbuf = imgToPixbuf->ConvertImageToPixbuf(aImage);
if (!pixbuf) return NS_ERROR_NOT_AVAILABLE;
GdkPixbuf* pixbuf = nsImageToPixbuf::ImageToPixbuf(aImage);
if (!pixbuf) {
return NS_ERROR_NOT_AVAILABLE;
}
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);