compositor-drm: Fix compilation error caused by typo.
[profile/ivi/weston.git] / compositor / compositor-drm.c
index b6560bd..536760b 100644 (file)
@@ -516,13 +516,15 @@ create_outputs(struct drm_compositor *ec, int option_connector)
 
                if (connector->connection == DRM_MODE_CONNECTED &&
                    (option_connector == 0 ||
-                    connector->connector_id == option_connector))
+                    connector->connector_id == option_connector)) {
                        if (create_output_for_connector(ec, resources,
                                                        connector, x, y) < 0)
                                return -1;
 
-               x += container_of(ec->base.output_list.prev, struct wlsc_output,
-                                 link)->current->width;
+                       x += container_of(ec->base.output_list.prev,
+                                         struct wlsc_output,
+                                         link)->current->width;
+               }
 
                drmModeFreeConnector(connector);
        }
@@ -679,6 +681,8 @@ drm_compositor_create_cursor_image(struct wlsc_compositor *ec,
        struct drm_compositor *c = (struct drm_compositor *) ec;
        struct gbm_bo *bo;
        EGLImageKHR image;
+       uint32_t *pixels;
+       GLuint tex;
 
        if (width > 64 || height > 64)
                return EGL_NO_IMAGE_KHR;
@@ -692,6 +696,26 @@ drm_compositor_create_cursor_image(struct wlsc_compositor *ec,
                                 EGL_NATIVE_PIXMAP_KHR, bo, NULL);
        gbm_bo_destroy(bo);
 
+       /* If the requested size is smaller than the allocated one, make the
+        * whole image transparent. */
+       if (width != 64 || height != 64) {
+               pixels = calloc(64 * 64, sizeof *pixels);
+
+               glGenTextures(1, &tex);
+               glBindTexture(GL_TEXTURE_2D, tex);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+               glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+               c->base.image_target_texture_2d(GL_TEXTURE_2D, image);
+               glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 64, 64,
+                               GL_BGRA_EXT, GL_UNSIGNED_BYTE, pixels);
+
+               glDeleteTextures(1, &tex);
+               free(pixels);
+       }
+
        return image;
 }