X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fgraphics.c;h=c87a148390aa0dc05fdd17a7114ac1ca6aa883e4;hb=7e3ce2d0110b47a67b04a457d1ea215ce1bf1078;hp=21fcd09067937b6820d33069877f6d798758033b;hpb=bdca86598f7604d7c20f91ac810d825513c72090;p=rodin%2Fchimara.git diff --git a/libchimara/graphics.c b/libchimara/graphics.c index 21fcd09..c87a148 100644 --- a/libchimara/graphics.c +++ b/libchimara/graphics.c @@ -139,7 +139,6 @@ image_cache_find(struct image_info* to_find) /* Empty cache */ if(link == NULL) { gdk_threads_leave(); - printf("Cache miss for image %d\n", to_find->resource_number); return NULL; } @@ -154,7 +153,6 @@ image_cache_find(struct image_info* to_find) if(info->width == to_find->width && info->height == to_find->height) { /* Prescaled image found */ gdk_threads_leave(); - printf("Exact cache hit for image %d\n", to_find->resource_number); return info; } else if(info->width >= to_find->width && info->height >= to_find->height) { @@ -165,7 +163,6 @@ image_cache_find(struct image_info* to_find) } else { if(!info->scaled) { gdk_threads_leave(); - printf("Exact cache hit for image %d\n", to_find->resource_number); return info; /* Found a match */ } } @@ -174,11 +171,6 @@ image_cache_find(struct image_info* to_find) gdk_threads_leave(); - if(match == NULL) - printf("Cache miss for image %d\n", to_find->resource_number); - else - printf("Approx cache hit for image %d\n", to_find->resource_number); - return match; } @@ -423,7 +415,7 @@ draw_image_common(winid_t win, GdkPixbuf *pixbuf, glsi32 val1, glsi32 val2) * * This function may only be used with graphics windows. To set background * colors in a text window, use text styles with color hints; see Styles. + * linkend="chimara-Styles">Styles. * */ void @@ -454,14 +446,15 @@ glk_window_fill_rect(winid_t win, glui32 color, glsi32 left, glsi32 top, glui32 VALID_WINDOW(win, return); g_return_if_fail(win->type == wintype_Graphics); - gdk_threads_enter(); GdkPixmap *map; gtk_image_get_pixmap( GTK_IMAGE(win->widget), &map, NULL ); GdkGC *gc = gdk_gc_new(map); - gdk_gc_set_foreground( gc, glkcolor_to_gdkcolor(color) ); + GdkColor gdkcolor; + glkcolor_to_gdkcolor(color, &gdkcolor); + gdk_gc_set_rgb_fg_color(gc, &gdkcolor); gdk_draw_rectangle( GDK_DRAWABLE(map), gc, TRUE, left, top, width, height); gtk_widget_queue_draw(win->widget); g_object_unref(gc); @@ -488,8 +481,46 @@ glk_window_erase_rect(winid_t win, glsi32 left, glsi32 top, glui32 width, glui32 glk_window_fill_rect(win, win->background_color, left, top, width, height); } +/** + * glk_window_flow_break: + * @win: A window. + * + * You may wish to break the stream of text down below the + * current margin image. Since lines of text can be in any font and size, you + * cannot do this by counting newlines. Instead, use this function. + * + * If the current point in the text is indented around a margin-aligned image, + * this acts like the correct number of newlines to start a new line below the + * image. (If there are several margin-aligned images, it goes below all of + * them.) If the current point is not beside a margin-aligned image, this call + * has no effect. + * + * When a text buffer window is resized, a flow-break behaves cleverly; it may + * become active or inactive as necessary. You can consider this function to + * insert an invisible mark in the text stream. The mark works out how many + * newlines it needs to be whenever the text is formatted for display. + * + * An example of the use of glk_window_flow_break(): If you display a + * left-margin image at the start of every line, they can stack up in a strange + * diagonal way that eventually squeezes all the text off the screen. + * + * If you can't picture this, draw some diagrams. Make the margin images more + * than one line tall, so that each line starts already indented around the + * last image. + * + * To avoid this problem, call glk_window_flow_break() immediately before + * glk_image_draw() for every margin-aligned image. + * + * In all windows other than text buffers, glk_window_flow_break() has no + * effect. + * + * + * This function is not implemented yet. + * + */ void glk_window_flow_break(winid_t win) { + VALID_WINDOW(win, return); } /*** Called when the graphics window is resized. Resize the backing pixmap if necessary ***/