gnome-games r8158 - trunk/aisleriot
- From: jclinton svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8158 - trunk/aisleriot
- Date: Tue, 21 Oct 2008 19:46:40 +0000 (UTC)
Author: jclinton
Date: Tue Oct 21 19:46:40 2008
New Revision: 8158
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8158&view=rev
Log:
Removed the unused expose-event handler in board.c
Modified:
trunk/aisleriot/board.c
Modified: trunk/aisleriot/board.c
==============================================================================
--- trunk/aisleriot/board.c (original)
+++ trunk/aisleriot/board.c Tue Oct 21 19:46:40 2008
@@ -3198,272 +3198,6 @@
#endif /* HAVE_MAEMO */
-static gboolean
-aisleriot_board_expose_event (GtkWidget *widget,
- GdkEventExpose *event)
-{
- AisleriotBoard *board = AISLERIOT_BOARD (widget);
- AisleriotBoardPrivate *priv = board->priv;
- GdkRegion *region = event->region;
- GdkRectangle *rects;
- int i, n_rects;
- GPtrArray *slots;
- guint n_slots;
- Slot **exposed_slots;
- Slot *highlight_slot;
- guint n_exposed_slots;
- gboolean use_pixbuf_drawing = priv->use_pixbuf_drawing;
-
- /* NOTE: It's ok to just return instead of chaining up, since the
- * parent class has no class closure for this event.
- */
-
- if (event->window != widget->window)
- return FALSE;
-
- if (gdk_region_empty (region))
- return FALSE;
-
- /* First paint the background */
-
- gdk_region_get_rectangles (region, &rects, &n_rects);
- if (n_rects == 0)
- return FALSE;
-
-#if 0
- {
- g_print ("Exposing area %d:%d@(%d,%d) ", event->area.width, event->area.height,
- event->area.x, event->area.y);
- for (i = 0; i < n_rects; ++i) {
- g_print ("[Rect %d:%d@(%d,%d)] ", rects[i].width, rects[i].height, rects[i].x, rects[i].y);
- }
- g_print ("\n");
- }
-#endif
-
- for (i = 0; i < n_rects; ++i) {
- gdk_draw_rectangle (widget->window, priv->bg_gc,
- TRUE,
- rects[i].x, rects[i].y,
- rects[i].width, rects[i].height);
- }
- g_free (rects);
-
- /* Only draw the the cards when the geometry is set, and we're in a resize */
- if (!priv->geometry_set)
- return TRUE;
-
- /* Now draw the slots and cards */
- slots = aisleriot_game_get_slots (priv->game);
-
- n_slots = slots->len;
-
- /* First check which slots are exposed */
- /* It's fine to allocate on the stack, since there'll never be very many slots */
- exposed_slots = g_newa (Slot*, n_slots);
- n_exposed_slots = 0;
-
- for (i = 0; i < n_slots; ++i) {
- Slot *slot = slots->pdata[i];
-
- /* Check whether this slot needs to be drawn */
- if (gdk_region_rect_in (region, &slot->rect) == GDK_OVERLAP_RECTANGLE_OUT)
- continue;
-
- exposed_slots[n_exposed_slots++] = slot;
- }
-
- highlight_slot = priv->highlight_slot;
-
- /* First draw the slots. Otherwise they'll overlap on cards
- * (e.g. in Elevator, after a card was removed).
- */
- for (i = 0; i < n_exposed_slots; ++i) {
- Slot *hslot = exposed_slots[i];
- int x, y;
-
- /* FIXMEchpe: if ((hslot->length - hslot->exposed) >= 0) ?? */
- if (hslot->cards->len > 0)
- continue;
-
- /* If the slot it empty, draw the slot image */
- x = hslot->rect.x;
- y = hslot->rect.y;
-
- gdk_gc_set_clip_origin (priv->slot_gc, x, y);
-
- if (PIXBUF_DRAWING_LIKELIHOOD (use_pixbuf_drawing)) {
- GdkPixbuf *pixbuf;
-
- if (G_LIKELY (hslot != highlight_slot)) {
-/* pixbuf = priv->slot_image; */
- } else {
- pixbuf = games_card_images_get_slot_pixbuf (priv->images,
- priv->show_highlight);
- }
-
- if (!pixbuf)
- continue;
-
- gdk_draw_pixbuf (widget->window, priv->slot_gc, pixbuf,
- 0, 0, x, y,
- priv->card_size.width, priv->card_size.height,
- GDK_RGB_DITHER_NONE, 0, 0);
- } else {
- GdkPixmap *pixmap;
-
- if (G_LIKELY (hslot != highlight_slot)) {
-/* pixmap = priv->slot_image; */
- } else {
- pixmap = games_card_images_get_slot_pixmap (priv->images,
- priv->show_highlight);
- }
-
- if (!pixmap)
- continue;
-
- gdk_draw_drawable (widget->window, priv->slot_gc, pixmap,
- 0, 0, x, y,
- priv->card_size.width, priv->card_size.height);
- }
- }
-
- /* Now draw the cards */
- for (i = 0; i < n_exposed_slots; ++i) {
- Slot *hslot = exposed_slots[i];
- GByteArray *cards = hslot->cards;
- gpointer *card_images = hslot->card_images->pdata;
- GdkRectangle card_rect;
- guint i, n_cards;
-
- n_cards = cards->len;
- if (n_cards == 0)
- continue;
-
- card_rect.x = hslot->rect.x;
- card_rect.y = hslot->rect.y;
- card_rect.width = priv->card_size.width;
- card_rect.height = priv->card_size.height;
-
- if (priv->is_rtl &&
- hslot->expanded_right) {
- card_rect.x += hslot->rect.width - priv->card_size.width;
- }
-
- for (i = n_cards - hslot->exposed; i < n_cards; ++i) {
- /* Check whether this card needs to be drawn */
- /* FIXMEchpe: we can be even smarter here, by checking
- * with the rect of the part of the card that's not going
- * to be obscured by later drawn cards anyway.
- */
- if (gdk_region_rect_in (region, &card_rect) == GDK_OVERLAP_RECTANGLE_OUT)
- goto next;
-
- if (PIXBUF_DRAWING_LIKELIHOOD (use_pixbuf_drawing)) {
- GdkPixbuf *pixbuf;
-
- pixbuf = card_images[i];
- if (!pixbuf)
- goto next;
-
- gdk_gc_set_clip_origin (priv->draw_gc, card_rect.x, card_rect.y);
- gdk_draw_pixbuf (widget->window, priv->draw_gc, pixbuf,
- 0, 0, card_rect.x, card_rect.y, -1, -1,
- GDK_RGB_DITHER_NONE, 0, 0);
- } else {
- GdkPixmap *pixmap;
-
- pixmap = card_images[i];
- if (!pixmap)
- goto next;
-
- gdk_gc_set_clip_origin (priv->draw_gc, card_rect.x, card_rect.y);
- gdk_draw_drawable (widget->window, priv->draw_gc, pixmap,
- 0, 0, card_rect.x, card_rect.y, -1, -1);
- }
-
- next:
-
- card_rect.x += hslot->pixeldx;
- card_rect.y += hslot->pixeldy;
- }
- }
-
- /* Draw the revealed card */
- if (priv->show_card_slot != NULL &&
- gdk_region_rect_in (region, &priv->show_card_slot->rect) != GDK_OVERLAP_RECTANGLE_OUT) {
- GdkRectangle card_rect;
-
- get_rect_by_slot_and_card (board,
- priv->show_card_slot,
- priv->show_card_id,
- 1, &card_rect);
-
- if (PIXBUF_DRAWING_LIKELIHOOD (use_pixbuf_drawing)) {
- GdkPixbuf *pixbuf;
-
- pixbuf = priv->show_card_slot->card_images->pdata[priv->show_card_id];
- if (!pixbuf)
- goto draw_focus;
-
- gdk_gc_set_clip_origin (priv->draw_gc, card_rect.x, card_rect.y);
- gdk_draw_pixbuf (widget->window, priv->draw_gc, pixbuf,
- 0, 0, card_rect.x, card_rect.y, -1, -1,
- GDK_RGB_DITHER_NONE, 0, 0);
- } else {
- GdkPixmap *pixmap;
-
- pixmap = priv->show_card_slot->card_images->pdata[priv->show_card_id];
- if (!pixmap)
- goto draw_focus;
-
- gdk_gc_set_clip_origin (priv->draw_gc, card_rect.x, card_rect.y);
- gdk_draw_drawable (widget->window, priv->draw_gc, pixmap,
- 0, 0, card_rect.x, card_rect.y, -1, -1);
- }
- }
-
-draw_focus:
-
-#ifdef ENABLE_KEYNAV
- if (G_UNLIKELY (priv->show_focus &&
- priv->focus_slot != NULL &&
- GTK_WIDGET_HAS_FOCUS (widget))) {
- GdkRectangle focus_rect;
-
- /* Check whether this needs to be drawn */
- if (gdk_region_rect_in (region, &priv->focus_rect) == GDK_OVERLAP_RECTANGLE_OUT)
- goto expose_done;
-
- if (priv->interior_focus) {
- focus_rect = priv->focus_rect;
- } else {
- get_rect_by_slot_and_card (board,
- priv->focus_slot,
- priv->focus_card_id,
- 1,
- &focus_rect);
- }
-
- gtk_paint_focus (widget->style,
- widget->window,
- GTK_WIDGET_STATE (widget),
- &priv->focus_rect,
- widget,
- NULL /* FIXME ? */,
- focus_rect.x,
- focus_rect.y,
- focus_rect.width,
- focus_rect.height);
- }
-
-expose_done:
-#endif /* ENABLE_KEYNAV */
-
- /* Parent class has no expose handler, no need to chain up */
- return TRUE;
-}
-
/* GObjectClass methods */
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]