Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Re #142: Tidy up debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
IBBoard committed Aug 23, 2020
1 parent a29d372 commit 7b44e08
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/CbMedia.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ static void
cb_media_finalize (GObject *object)
{
CbMedia *media = CB_MEDIA (object);
g_debug("MEM Finalising %s with %d references", media->url, cairo_surface_get_reference_count(media->surface));
cairo_surface_destroy (media->surface);
if (media->surface_hires != NULL) {
cairo_surface_destroy (media->surface_hires);
Expand Down
6 changes: 2 additions & 4 deletions src/CbMediaDownloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,21 @@ load_animation (GInputStream *input_stream,
{
return;
}
// XXX: How often does this function need to do what it says (and potentially use lots of memory temporarily, as it decodes a video until it can make a picture)?

frame = gdk_pixbuf_animation_get_static_image (animation);

if (g_cancellable_is_cancelled (cancellable))
{
g_object_unref (animation);
return;
}
g_debug("MEM Image is %s", gdk_pixbuf_animation_is_static_image (animation) ? "static" : "animated");

if (!gdk_pixbuf_animation_is_static_image (animation))
*target_animation = animation; /* Takes ref */
else
*target_animation = NULL;

has_alpha = gdk_pixbuf_get_has_alpha (frame);
g_debug("MEM Creating %d×%d %d bit surface", gdk_pixbuf_get_width (frame), gdk_pixbuf_get_height (frame), has_alpha ? 32 : 24);
surface = cairo_image_surface_create (has_alpha ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24,
gdk_pixbuf_get_width (frame),
gdk_pixbuf_get_height (frame));
Expand Down Expand Up @@ -168,7 +167,6 @@ load_media_url (const char *url, LoadingData *task_data,
input_stream = g_memory_input_stream_new_from_data (msg->response_body->data,
msg->response_body->length,
NULL);
g_debug("MEM Loading animation for %s", url);
load_animation (input_stream, surface, animation, cancellable, error);
g_input_stream_close (input_stream, NULL, NULL);
g_object_unref (input_stream);
Expand Down
4 changes: 2 additions & 2 deletions src/CbTypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ cb_mini_tweet_parse_entities (CbMiniTweet *t,
const char *url = json_object_has_member (media_obj, "media_url_https") ?
json_object_get_string_member (media_obj, "media_url_https") :
json_object_get_string_member (media_obj, "media_url");
g_warning("URL %s was marked as type photo but not a media candidate");
g_warning("URL %s was marked as type photo but not a media candidate", url);
}


Expand Down Expand Up @@ -490,7 +490,7 @@ cb_mini_tweet_parse_entities (CbMiniTweet *t,
t->medias[t->n_medias]->height = height;
t->medias[t->n_medias]->thumb_width = thumb_width;
t->medias[t->n_medias]->thumb_height = thumb_height;
g_debug("Video: %d×%d; Thumb: %d×%d", width, height, thumb_width, thumb_height);

if (json_object_has_member (media_obj, "ext_alt_text")) {
// Only "extended media" for GIFs has alt text. Videos never do.
t->medias[t->n_medias]->alt_text = g_strdup (json_object_get_string_member (media_obj, "ext_alt_text"));
Expand Down

0 comments on commit 7b44e08

Please sign in to comment.