Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
nsIconChannel.cpp File Reference
#include <stdlib.h>
#include <unistd.h>
#include <libgnome/libgnome.h>
#include <libgnomeui/gnome-icon-theme.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <libgnomeui/gnome-ui-init.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <gtk/gtkwidget.h>
#include <gtk/gtkiconfactory.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkfixed.h>
#include <gtk/gtkversion.h>
#include "nsIMIMEService.h"
#include "nsIStringBundle.h"
#include "nsEscape.h"
#include "nsNetUtil.h"
#include "nsIURL.h"
#include "nsIStringStream.h"
#include "nsIconChannel.h"

Go to the source code of this file.

Functions

 NS_IMPL_ISUPPORTS2 (nsIconChannel, nsIRequest, nsIChannel) static nsresult moz_gdk_pixbuf_to_channel(GdkPixbuf *aPixbuf
 NS_ENSURE_TRUE (height< 256 &&width< 256 &&height > 0 &&width > 0 &&gdk_pixbuf_get_colorspace(aPixbuf)==GDK_COLORSPACE_RGB &&gdk_pixbuf_get_bits_per_sample(aPixbuf)==8 &&gdk_pixbuf_get_has_alpha(aPixbuf)&&gdk_pixbuf_get_n_channels(aPixbuf)==4, NS_ERROR_UNEXPECTED)
 NS_ENSURE_TRUE (buf, NS_ERROR_OUT_OF_MEMORY)
 for (int y=0;y< height;++y, in+=rowextra)
 NS_ASSERTION (out==alpha_start &&alpha_out==buf+buf_size,"size miscalculation")
 NS_ENSURE_SUCCESS (rv, rv)
sstream AdoptData ((char *) buf, buf_size)
static void ensure_stock_image_widget ()
static GtkIconSize moz_gtk_icon_size (const char *name)

Variables

nsIURIaURI
nsIURI nsIChannel **aChannel int width = gdk_pixbuf_get_width(aPixbuf)
int height = gdk_pixbuf_get_height(aPixbuf)
const int n_channels = 4
gsize buf_size = 3 + n_channels * height * width
PRUint8 *const buf = (PRUint8*)NS_Alloc(buf_size)
PRUint8out = buf
const guchar *const pixels = gdk_pixbuf_get_pixels(aPixbuf)
int rowextra = gdk_pixbuf_get_rowstride(aPixbuf) - width * n_channels
const guchar * in = pixels
PRUint8alpha_out = out + height * width * 3
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), (char*)buf, buf_size)
nsCOMPtr< nsIInputStreamstream
nsCOMPtr< nsIStringInputStreamsstream = do_QueryInterface(stream)
static GtkWidget * gProtoWindow = nsnull
static GtkWidget * gStockImageWidget = nsnull
static GnomeIconTheme * gIconTheme = nsnull

Function Documentation

sstream AdoptData ( (char *)  buf,
buf_size   
)

Here is the caller graph for this function:

static void ensure_stock_image_widget ( ) [static]

Definition at line 140 of file nsIconChannel.cpp.

{
  if (!gProtoWindow) {
    gProtoWindow = gtk_window_new(GTK_WINDOW_POPUP);
    gtk_widget_realize(gProtoWindow);
    GtkWidget* protoLayout = gtk_fixed_new();
    gtk_container_add(GTK_CONTAINER(gProtoWindow), protoLayout);

    gStockImageWidget = gtk_image_new();
    gtk_container_add(GTK_CONTAINER(protoLayout), gStockImageWidget);
    gtk_widget_realize(gStockImageWidget);
  }
}

Here is the caller graph for this function:

for ( )

Definition at line 106 of file nsIconChannel.cpp.

                                                   {
    for (int x = 0; x < width; ++x) {
      *(out++) = *(in++); // R
      *(out++) = *(in++); // G
      *(out++) = *(in++); // B
      *(alpha_out++) = *(in++); // A
    }
  }
static GtkIconSize moz_gtk_icon_size ( const char *  name) [static]

Definition at line 167 of file nsIconChannel.cpp.

{
  if (strcmp(name, "button") == 0)
    return GTK_ICON_SIZE_BUTTON;

  if (strcmp(name, "menu") == 0)
    return GTK_ICON_SIZE_MENU;

  if (strcmp(name, "toolbar") == 0)
    return GTK_ICON_SIZE_LARGE_TOOLBAR;

  if (strcmp(name, "toolbarsmall") == 0)
    return GTK_ICON_SIZE_SMALL_TOOLBAR;

  if (strcmp(name, "dialog") == 0)
    return GTK_ICON_SIZE_DIALOG;

  return GTK_ICON_SIZE_MENU;
}

Here is the caller graph for this function:

NS_ASSERTION ( out  = =alpha_start &&alpha_out==buf+buf_size,
"size miscalculation"   
)
NS_ENSURE_SUCCESS ( rv  ,
rv   
)
NS_ENSURE_TRUE ( height< 256 &&width< 256 &&height > 0 &&width > 0 &&  gdk_pixbuf_get_colorspaceaPixbuf = =GDK_COLORSPACE_RGB &&gdk_pixbuf_get_bits_per_sample(aPixbuf)==8 &&gdk_pixbuf_get_has_alpha(aPixbuf)&&gdk_pixbuf_get_n_channels(aPixbuf)==4,
NS_ERROR_UNEXPECTED   
)

Variable Documentation

Definition at line 102 of file nsIconChannel.cpp.

Definition at line 75 of file nsIconChannel.cpp.

Definition at line 89 of file nsIconChannel.cpp.

gsize buf_size = 3 + n_channels * height * width

Definition at line 88 of file nsIconChannel.cpp.

GnomeIconTheme* gIconTheme = nsnull [static]

Definition at line 133 of file nsIconChannel.cpp.

GtkWidget* gProtoWindow = nsnull [static]

Definition at line 131 of file nsIconChannel.cpp.

GtkWidget* gStockImageWidget = nsnull [static]

Definition at line 132 of file nsIconChannel.cpp.

int height = gdk_pixbuf_get_height(aPixbuf)

Definition at line 79 of file nsIconChannel.cpp.

const guchar* in = pixels

Definition at line 101 of file nsIconChannel.cpp.

Definition at line 87 of file nsIconChannel.cpp.

* out = buf

Definition at line 91 of file nsIconChannel.cpp.

const guchar* const pixels = gdk_pixbuf_get_pixels(aPixbuf)

Definition at line 97 of file nsIconChannel.cpp.

int rowextra = gdk_pixbuf_get_rowstride(aPixbuf) - width * n_channels

Definition at line 98 of file nsIconChannel.cpp.

Definition at line 118 of file nsIconChannel.cpp.

Definition at line 123 of file nsIconChannel.cpp.

Definition at line 119 of file nsIconChannel.cpp.

nsIURI nsIChannel** aChannel int width = gdk_pixbuf_get_width(aPixbuf)

Definition at line 78 of file nsIconChannel.cpp.