fix software_16_ddraw engine compilation
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 6 Dec 2008 20:30:15 +0000 (20:30 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 6 Dec 2008 20:30:15 +0000 (20:30 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@37966 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp
src/modules/engines/software_16_ddraw/evas_engine.c
src/modules/engines/software_16_ddraw/evas_engine.h

index a78507a..7a0a8b7 100644 (file)
@@ -38,17 +38,19 @@ evas_software_ddraw_output_buffer_new(HWND                window,
         return NULL;
      }
 
-   ddob->im.pixels = (DATA16 *)surface_desc.lpSurface;
-   ddob->im.w = width;
-   ddob->im.h = height;
-   ddob->im.stride = width;
-   ddob->im.references = 1;
+   ddob->data = (DATA16 *)surface_desc.lpSurface;
 
    if (FAILED(ddob->dd.surface_source->Unlock(NULL)))
      {
         free(ddob);
         return NULL;
      }
+   if (ddob->im)
+     evas_cache_image_drop(&ddob->im->cache_entry);
+
+   ddob->im =  (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), width, height, (DATA32 *) ddob->data, 0, EVAS_COLORSPACE_RGB565_A5P);
+   if (ddob->im)
+     ddob->im->stride = ddob->pitch;
 
    return ddob;
 }
index d87e3c8..cc12f0b 100644 (file)
@@ -68,13 +68,6 @@ eng_info_free(Evas *e, void *info)
 }
 
 static void
-_tmp_out_free(Soft16_Image *tmp_out)
-{
-   free(tmp_out->pixels);
-   free(tmp_out);
-}
-
-static void
 _tmp_out_alloc(Render_Engine *re)
 {
    Tilebuf_Rect *r;
@@ -88,9 +81,9 @@ _tmp_out_alloc(Render_Engine *re)
 
    if (re->tmp_out)
      {
-       if ((re->tmp_out->w < w) || (re->tmp_out->h < h))
+       if ((re->tmp_out->cache_entry.w < w) || (re->tmp_out->cache_entry.h < h))
          {
-            _tmp_out_free(re->tmp_out);
+            evas_cache_image_drop(&re->tmp_out->cache_entry);
             re->tmp_out = NULL;
          }
      }
@@ -99,14 +92,9 @@ _tmp_out_alloc(Render_Engine *re)
      {
        Soft16_Image *im;
 
-       im = calloc(1, sizeof(Soft16_Image));
-       im->w = w;
-       im->h = h;
-       im->stride = w + ((w % 4) ? (4 - (w % 4)) : 0);
-       im->have_alpha = 0;
-       im->references = 1;
-       im->free_pixels = 1;
-       im->pixels = malloc(h * im->stride * sizeof(DATA16));
+       im = (Soft16_Image *) evas_cache_image_empty(evas_common_soft16_image_cache_get());
+        im->cache_entry.flags.alpha = 0;
+        evas_cache_image_surface_alloc(&im->cache_entry, w, h);
 
        re->tmp_out = im;
      }
@@ -184,7 +172,7 @@ eng_setup(Evas *e, void *in)
          evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
        if (re->tmp_out)
          {
-            _tmp_out_free(re->tmp_out);
+            evas_cache_image_drop(&re->tmp_out->cache_entry);
             re->tmp_out = NULL;
          }
      }
@@ -205,7 +193,7 @@ eng_output_free(void *data)
    if (re->clip_rects) DeleteObject(re->clip_rects);
    if (re->tb) evas_common_tilebuf_free(re->tb);
    if (re->rects) evas_common_tilebuf_free_render_rects(re->rects);
-   if (re->tmp_out) _tmp_out_free(re->tmp_out);
+   if (re->tmp_out) evas_cache_image_drop(&re->tmp_out->cache_entry);
    free(re);
 
    evas_common_font_shutdown();
@@ -243,7 +231,7 @@ eng_output_resize(void *data, int w, int h)
      }
    if (re->tmp_out)
      {
-       _tmp_out_free(re->tmp_out);
+       evas_cache_image_drop(&re->tmp_out->cache_entry);
        re->tmp_out = NULL;
      }
 }
@@ -461,7 +449,7 @@ _tmp_out_process(Render_Engine *re, int out_x, int out_y, int w, int h)
    d = &re->ddob->im;
    s = re->tmp_out;
 
-   if ((w < 1) || (h < 1) || (out_x >= d->w) || (out_y >= d->h))
+   if ((w < 1) || (h < 1) || (out_x >= d->cache_entry.w) || (out_y >= d->cache_entry.h))
      return;
 
    if (re->rotation == 90)
@@ -567,7 +555,7 @@ eng_output_idle_flush(void *data)
      }
    if (re->tmp_out)
      {
-       _tmp_out_free(re->tmp_out);
+       evas_cache_image_drop(&re->tmp_out->cache_entry);
        re->tmp_out = NULL;
      }
 }
index a8e3eba..8307ad8 100644 (file)
@@ -11,7 +11,7 @@ typedef struct _DDraw_Output_Buffer       DDraw_Output_Buffer;
 
 struct _DDraw_Output_Buffer
 {
-   Soft16_Image im;
+   Soft16_Image *im;
   struct {
      HWND                window;
      LPDIRECTDRAW        object;
@@ -19,6 +19,7 @@ struct _DDraw_Output_Buffer
      LPDIRECTDRAWSURFACE surface_back;
      LPDIRECTDRAWSURFACE surface_source;
   } dd;
+   void        *data;
    int          x;
    int          y;
    int          width;