st/egl: overload NATIVE_PARAM_PREMULTIPLIED_ALPHA
[mesa.git] / src / gallium / state_trackers / egl / gdi / native_gdi.c
index 3c2475f84d810fbf41441e9ec501e0b4cfaaf694..d3fec719a21fadf91a815a32f1d18a041911c2e4 100644 (file)
@@ -41,7 +41,7 @@ struct gdi_display {
    struct native_display base;
 
    HDC hDC;
-   struct native_event_handler *event_handler;
+   const struct native_event_handler *event_handler;
 
    struct native_config *configs;
    int num_configs;
@@ -161,16 +161,14 @@ gdi_surface_swap_buffers(struct native_surface *nsurf)
 
 static boolean
 gdi_surface_present(struct native_surface *nsurf,
-                    enum native_attachment natt,
-                    boolean preserve,
-                    uint swap_interval)
+                    const native_present_control *ctrl)
 {
    boolean ret;
 
-   if (preserve || swap_interval)
+   if (ctrl->preserve || ctrl->swap_interval)
       return FALSE;
 
-   switch (natt) {
+   switch (ctrl->natt) {
    case NATIVE_ATTACHMENT_FRONT_LEFT:
       ret = gdi_surface_flush_frontbuffer(nsurf);
       break;
@@ -285,7 +283,7 @@ fill_color_formats(struct native_display *ndpy, enum pipe_format formats[8])
 
    for (i = 0; i < Elements(candidates); i++) {
       if (screen->is_format_supported(screen, candidates[i],
-               PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET, 0))
+               PIPE_TEXTURE_2D, 0, PIPE_BIND_RENDER_TARGET))
          formats[count++] = candidates[i];
    }
 
@@ -368,35 +366,39 @@ gdi_display_destroy(struct native_display *ndpy)
    FREE(gdpy);
 }
 
-static struct native_display *
-gdi_create_display(HDC hDC, struct native_event_handler *event_handler,
-                   void *user_data)
+static boolean
+gdi_display_init_screen(struct native_display *ndpy)
 {
-   struct gdi_display *gdpy;
+   struct gdi_display *gdpy = gdi_display(ndpy);
    struct sw_winsys *winsys;
 
-   gdpy = CALLOC_STRUCT(gdi_display);
-   if (!gdpy)
-      return NULL;
-
-   gdpy->hDC = hDC;
-   gdpy->event_handler = event_handler;
-   gdpy->base.user_data = user_data;
-
    winsys = gdi_create_sw_winsys();
-   if (!winsys) {
-      FREE(gdpy);
-      return NULL;
-   }
+   if (!winsys)
+      return FALSE;
 
    gdpy->base.screen = gdpy->event_handler->new_sw_screen(&gdpy->base, winsys);
    if (!gdpy->base.screen) {
       if (winsys->destroy)
          winsys->destroy(winsys);
-      FREE(gdpy);
-      return NULL;
+      return FALSE;
    }
 
+   return TRUE;
+}
+
+static struct native_display *
+gdi_create_display(HDC hDC, const struct native_event_handler *event_handler)
+{
+   struct gdi_display *gdpy;
+
+   gdpy = CALLOC_STRUCT(gdi_display);
+   if (!gdpy)
+      return NULL;
+
+   gdpy->hDC = hDC;
+   gdpy->event_handler = event_handler;
+
+   gdpy->base.init_screen = gdi_display_init_screen;
    gdpy->base.destroy = gdi_display_destroy;
    gdpy->base.get_param = gdi_display_get_param;
 
@@ -406,28 +408,22 @@ gdi_create_display(HDC hDC, struct native_event_handler *event_handler,
    return &gdpy->base;
 }
 
-static struct native_event_handler *gdi_event_handler;
-
-static void
-native_set_event_handler(struct native_event_handler *event_handler)
-{
-   gdi_event_handler = event_handler;
-}
+static const struct native_event_handler *gdi_event_handler;
 
 static struct native_display *
-native_create_display(void *dpy, boolean use_sw, void *user_data)
+native_create_display(void *dpy, boolean use_sw)
 {
-   return gdi_create_display((HDC) dpy, gdi_event_handler, user_data);
+   return gdi_create_display((HDC) dpy, gdi_event_handler);
 }
 
 static const struct native_platform gdi_platform = {
    "GDI", /* name */
-   native_set_event_handler,
    native_create_display
 };
 
 const struct native_platform *
-native_get_gdi_platform(void)
+native_get_gdi_platform(const struct native_event_handler *event_handler)
 {
+   gdi_event_handler = event_handler;
    return &gdi_platform;
 }