TRACE_WRAPPER
PP_Bool
trace_ppb_flash_draw_glyphs(PP_Instance instance, PP_Resource pp_image_data,
                            const struct PP_BrowserFont_Trusted_Description *font_desc,
                            uint32_t color, const struct PP_Point *position,
                            const struct PP_Rect *clip, const float transformation[3][3],
                            PP_Bool allow_subpixel_aa, uint32_t glyph_count,
                            const uint16_t glyph_indices[], const struct PP_Point glyph_advances[])
{
    char *s_position = trace_point_as_string(position);
    char *s_clip = trace_rect_as_string(clip);
    char *s_face = trace_var_as_string(font_desc->face);
    trace_info("[PPB] {full} %s instance=%d, pp_image_data=%d, font_desc={.face=%s, .family=%d, "
               ".size=%u, .weight=%d, .italic=%u, .small_caps=%u, .letter_spacing=%d, "
               ".word_spacing=%d}, color=0x%x, position=%s, clip=%s, transformation={{%f,%f,%f},"
               "{%f,%f,%f},{%f,%f,%f}}, allow_subpixel_aa=%d, glyph_count=%u, glyph_indices=%p, "
               "glyph_advances=%p\n", __func__+6, instance, pp_image_data, s_face,
               font_desc->family, font_desc->size, font_desc->weight, font_desc->italic,
               font_desc->small_caps, font_desc->letter_spacing, font_desc->word_spacing,
               color, s_position, s_clip,
               transformation[0][0], transformation[0][1], transformation[0][2],
               transformation[1][0], transformation[1][1], transformation[1][2],
               transformation[2][0], transformation[2][1], transformation[2][2],
               allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances);
    g_free(s_position);
    g_free(s_clip);
    g_free(s_face);
    return ppb_flash_draw_glyphs(instance, pp_image_data, font_desc, color, position, clip,
                                 transformation, allow_subpixel_aa, glyph_count, glyph_indices,
                                 glyph_advances);
}
TRACE_WRAPPER
PP_Resource
trace_ppb_mouse_input_event_create(PP_Instance instance, PP_InputEvent_Type type,
                                   PP_TimeTicks time_stamp, uint32_t modifiers,
                                   PP_InputEvent_MouseButton mouse_button,
                                   const struct PP_Point *mouse_position, int32_t click_count,
                                   const struct PP_Point *mouse_movement)
{
    char *s_mouse_position = trace_point_as_string(mouse_position);
    char *s_mouse_movement = trace_point_as_string(mouse_movement);
    trace_info("[PPB] {full} %s instance=%d, type=%d, time_stamp=%f, modifiers=0x%x, "
               "mouse_button=%d, mouse_position=%s, click_count=%d, mouse_movement=%s\n",
               __func__+6, instance, type, time_stamp, modifiers, mouse_button, s_mouse_position,
               click_count, s_mouse_movement);
    g_free(s_mouse_position);
    g_free(s_mouse_movement);
    return ppb_mouse_input_event_create(instance, type, time_stamp, modifiers, mouse_button,
                                        mouse_position, click_count, mouse_movement);
}
// trace wrappers
TRACE_WRAPPER
PP_Bool
trace_ppb_cursor_control_set_cursor(PP_Instance instance, enum PP_CursorType_Dev type,
                                    PP_Resource custom_image, const struct PP_Point *hot_spot)
{
    char *s_hot_spot = trace_point_as_string(hot_spot);
    trace_info("[PPB] {full} %s instance=%d, type=%d, custom_image=%d, hot_spot=%s\n", __func__+6,
               instance, type, custom_image, s_hot_spot);
    g_free(s_hot_spot);
    return ppb_cursor_control_set_cursor(instance, type, custom_image, hot_spot);
}
TRACE_WRAPPER
int32_t
trace_ppb_flash_menu_show(PP_Resource menu_id, const struct PP_Point *location,
                          int32_t *selected_id, struct PP_CompletionCallback callback)
{
    gchar *s_location = trace_point_as_string(location);
    trace_info("[PPB] {full} %s menu_id=%d, location=%s, callback={.func=%p, .user_data=%p, "
               ".flags=%d}\n", __func__+6, menu_id, s_location, callback.func, callback.user_data,
               callback.flags);
    g_free(s_location);
    return ppb_flash_menu_show(menu_id, location, selected_id, callback);
}
TRACE_WRAPPER
void
trace_ppb_graphics2d_scroll(PP_Resource graphics_2d, const struct PP_Rect *clip_rect,
                            const struct PP_Point *amount)
{
    char *s_clip_rect = trace_rect_as_string(clip_rect);
    char *s_amount = trace_point_as_string(amount);
    trace_info("[PPB] {zilch} %s graphics_2d=%d, clip_rect=%s, amount=%s\n", __func__+6,
               graphics_2d, s_clip_rect, s_amount);
    g_free(s_clip_rect);
    g_free(s_amount);
    ppb_graphics2d_scroll(graphics_2d, clip_rect, amount);
}
TRACE_WRAPPER
void
trace_ppb_graphics2d_paint_image_data(PP_Resource graphics_2d, PP_Resource image_data,
                                      const struct PP_Point *top_left,
                                      const struct PP_Rect *src_rect)
{
    char *s_top_left = trace_point_as_string(top_left);
    char *s_src_rect = trace_rect_as_string(src_rect);
    trace_info("[PPB] {full} %s graphics_2d=%d, image_data=%d, top_left=%s, src_rect=%s\n",
               __func__+6, graphics_2d, image_data, s_top_left, s_src_rect);
    g_free(s_top_left);
    g_free(s_src_rect);
    ppb_graphics2d_paint_image_data(graphics_2d, image_data, top_left, src_rect);
}
static
PP_Bool
trace_ppb_browser_font_trusted_draw_text_at(PP_Resource font, PP_Resource image_data,
                                      const struct PP_BrowserFont_Trusted_TextRun *text,
                                      const struct PP_Point *position, uint32_t color,
                                      const struct PP_Rect *clip, PP_Bool image_data_is_opaque)
{
    char *s_text_text = trace_var_as_string(text->text);
    char *s_position = trace_point_as_string(position);
    char *s_clip = trace_rect_as_string(clip);
    trace_info("[PPB] {full} %s font=%d, image_data=%d, text={.text=%s, .rtl=%u, "
               ".override_direction=%u}, position=%s, color=0x%06x, clip=%s, "
               "image_data_is_opaque=%u\n", __func__+6, font, image_data, s_text_text, text->rtl,
               text->override_direction, s_position, color, s_clip, image_data_is_opaque);
    free(s_text_text);
    free(s_position);
    free(s_clip);
    return ppb_browser_font_trusted_draw_text_at(font, image_data, text, position, color, clip,
                                                 image_data_is_opaque);
}