}
static cairo_surface_t *
-allocate_surface(int fd, int width, int height, uint32_t depth,
- uint32_t *handle, int tiled)
+allocate_surface(int fd, uint32_t *handle, int tiled)
{
cairo_format_t format;
struct drm_i915_gem_set_tiling set_tiling;
};
static void
-paint_color_gradient(cairo_t *cr, int x, int y, int width, int height,
+paint_color_gradient(cairo_t *cr, int x, int y, int w, int h,
int r, int g, int b)
{
cairo_pattern_t *pat;
- pat = cairo_pattern_create_linear(x, y, x + width, y + height);
+ pat = cairo_pattern_create_linear(x, y, x + w, y + h);
cairo_pattern_add_color_stop_rgba(pat, 1, 0, 0, 0, 1);
cairo_pattern_add_color_stop_rgba(pat, 0, r, g, b, 1);
- cairo_rectangle(cr, x, y, width, height);
+ cairo_rectangle(cr, x, y, w, h);
cairo_set_source(cr, pat);
cairo_fill(cr);
cairo_pattern_destroy(pat);
}
static void
-paint_test_patterns(cairo_t *cr, int width, int height, int stride)
+paint_test_patterns(cairo_t *cr)
{
double gr_height, gr_width;
int x, y;
}
static void
-paint_output_info(cairo_t *cr, struct connector *c, int width, int height)
+paint_output_info(cairo_t *cr, struct connector *c)
{
cairo_text_extents_t name_extents, mode_extents;
char name_buf[128], mode_buf[128];
width = c->mode.hdisplay;
height = c->mode.vdisplay;
- surface = allocate_surface(drm_fd, width, height, depth,
- &handle, enable_tiling);
+ surface = allocate_surface(drm_fd, &handle, enable_tiling);
if (!surface) {
fprintf(stderr, "allocation failed %dx%d\n", width, height);
continue;
cr = cairo_create(surface);
- paint_test_patterns(cr, width, height,
- cairo_image_surface_get_stride(surface));
+ paint_test_patterns(cr);
cairo_set_line_cap(cr, CAIRO_LINE_CAP_SQUARE);
paint_marker(cr, width, height, buf, topleft);
/* Paint output info */
- paint_output_info(cr, c, width, height);
+ paint_output_info(cr, c);
paint_color_key();
fprintf(stderr, "failed to draw pretty picture %dx%d: %s\n",
width, height, cairo_status_to_string(status));
- ret = drmModeAddFB(drm_fd, width, height, depth, bpp,
- cairo_image_surface_get_stride(surface),
+ ret = drmModeAddFB(drm_fd, width, height, depth, bpp, stride,
handle, &fb_id);
cairo_surface_destroy(surface);
gem_close(drm_fd, handle);