diff mbox

[i-g-t,03/12] lib: Split create_image_surface() out of create_cairo_ctx()

Message ID 1378494530-3600-4-git-send-email-damien.lespiau@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lespiau, Damien Sept. 6, 2013, 7:08 p.m. UTC
So we can use it in the next commit.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
---
 lib/drmtest.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/drmtest.c b/lib/drmtest.c
index f760028..12bd0ff 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -1483,9 +1483,8 @@  static cairo_format_t drm_format_to_cairo(uint32_t drm_format)
 	abort();
 }
 
-static cairo_t *create_cairo_ctx(int fd, struct kmstest_fb *fb)
+static cairo_surface_t *create_image_surface(int fd, struct kmstest_fb *fb)
 {
-	cairo_t *cr;
 	cairo_surface_t *surface;
 	cairo_format_t cformat;
 	void *fb_ptr;
@@ -1496,6 +1495,16 @@  static cairo_t *create_cairo_ctx(int fd, struct kmstest_fb *fb)
 						   cformat, fb->width,
 						   fb->height, fb->stride);
 	assert(surface);
+
+	return surface;
+}
+
+static cairo_t *create_cairo_ctx(int fd, struct kmstest_fb *fb)
+{
+	cairo_t *cr;
+	cairo_surface_t *surface;
+
+	surface = create_image_surface(fd, fb);
 	cr = cairo_create(surface);
 	cairo_surface_destroy(surface);