Since we can't calculate the Cb/Cr pixel addresses for most
planar (YCbCr) formats, we have to get them passed in by the callers.

Signed-off-by: André Draszik <andre.dras...@st.com>
---
 gfxdrivers/davinci/davinci_osd.c |  1 +
 src/core/surface.c               |  5 ++++-
 src/core/surface_buffer.c        |  8 ++++++--
 src/gfx/convert.c                | 28 ++++++++++++++++++++++++++++
 src/gfx/convert.h                | 28 ++++++++++++++++++++++++++++
 systems/sdl/primary.c            |  4 +++-
 systems/x11/primary.c            |  4 ++++
 tools/mkdgifft.cpp               |  1 +
 8 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/gfxdrivers/davinci/davinci_osd.c b/gfxdrivers/davinci/davinci_osd.c
index 2effb2e..4c4d4f1 100644
--- a/gfxdrivers/davinci/davinci_osd.c
+++ b/gfxdrivers/davinci/davinci_osd.c
@@ -565,6 +565,7 @@ update_rgb( DavinciDriverData     *ddrv,
      dfb_convert_to_rgb16( buffer->format,
                            lock->addr + rect.y * lock->pitch + 
DFB_BYTES_PER_LINE( buffer->format, rect.x ),
                            lock->pitch,
+                           NULL, 0, NULL, 0,
                            surface->config.size.h,
                            ddrv->fb[OSD0].mem + rect.y * 
ddev->fix[OSD0].line_length + rect.x * 2,
                            ddev->fix[OSD0].line_length,
diff --git a/src/core/surface.c b/src/core/surface.c
index 5934164..5048104 100644
--- a/src/core/surface.c
+++ b/src/core/surface.c
@@ -1603,7 +1603,10 @@ dfb_surface_dump_buffer2( CoreSurface           *surface,
                     }
                }
                else
-                    dfb_convert_to_rgb24( lock.buffer->format, src8, 
lock.pitch, surface->config.size.h,
+                    dfb_convert_to_rgb24( lock.buffer->format,
+                                          src8, lock.pitch,
+                                          src_cb, pitch_cb, src_cr, pitch_cr,
+                                          surface->config.size.h,
                                           buf_p, surface->config.size.w * 3, 
surface->config.size.w, 1 );
 #ifdef USE_ZLIB
                gzwrite( gz_p, buf_p, surface->config.size.w * 3 );
diff --git a/src/core/surface_buffer.c b/src/core/surface_buffer.c
index 1195cfd..2528e6e 100644
--- a/src/core/surface_buffer.c
+++ b/src/core/surface_buffer.c
@@ -901,7 +901,9 @@ dfb_surface_buffer_dump_type_locked( CoreSurfaceBuffer     
*buffer,
                         }
                    }
                    else
-                        dfb_convert_to_argb( buffer->format, src8, 
lock->pitch, surface->config.size.h,
+                        dfb_convert_to_argb( buffer->format, src8, lock->pitch,
+                                             src_cb, pitch_cb, src_cr, 
pitch_cr,
+                                             surface->config.size.h,
                                              (u32 *)(&buf_p[0]), 
surface->config.size.w * 4, surface->config.size.w, 1 );
 #ifdef USE_ZLIB
                    gzwrite( gz_p, buf_p, surface->config.size.w * 4 );
@@ -921,7 +923,9 @@ dfb_surface_buffer_dump_type_locked( CoreSurfaceBuffer     
*buffer,
                     }
                }
                else
-                    dfb_convert_to_rgb24( buffer->format, src8, lock->pitch, 
surface->config.size.h,
+                    dfb_convert_to_rgb24( buffer->format, src8, lock->pitch,
+                                          src_cb, pitch_cb, src_cr, pitch_cr,
+                                          surface->config.size.h,
                                           buf_p, surface->config.size.w * 3, 
surface->config.size.w, 1 );
 #ifdef USE_ZLIB
                gzwrite( gz_p, buf_p, surface->config.size.w * 3 );
diff --git a/src/gfx/convert.c b/src/gfx/convert.c
index f075e86..2722ce3 100644
--- a/src/gfx/convert.c
+++ b/src/gfx/convert.c
@@ -392,6 +392,10 @@ void
 dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
                       const void            *src,
                       int                    spitch,
+                      const void            *src_cb,
+                      int                    scbpitch,
+                      const void            *src_cr,
+                      int                    scrpitch,
                       int                    surface_height,
                       u16                   *dst,
                       int                    dpitch,
@@ -701,6 +705,10 @@ void
 dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
                        const void            *src,
                        int                    spitch,
+                       const void            *src_cb,
+                       int                    scbpitch,
+                       const void            *src_cr,
+                       int                    scrpitch,
                        int                    surface_height,
                        u16                   *dst,
                        int                    dpitch,
@@ -980,6 +988,10 @@ void
 dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
                       const void            *src,
                       int                    spitch,
+                      const void            *src_cb,
+                      int                    scbpitch,
+                      const void            *src_cr,
+                      int                    scrpitch,
                       int                    surface_height,
                       u32                   *dst,
                       int                    dpitch,
@@ -1284,6 +1296,10 @@ void
 dfb_convert_to_argb( DFBSurfacePixelFormat  format,
                      const void            *src,
                      int                    spitch,
+                     const void            *src_cb,
+                     int                    scbpitch,
+                     const void            *src_cr,
+                     int                    scrpitch,
                      int                    surface_height,
                      u32                   *dst,
                      int                    dpitch,
@@ -1635,6 +1651,10 @@ void
 dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
                       const void            *src,
                       int                    spitch,
+                      const void            *src_cb,
+                      int                    scbpitch,
+                      const void            *src_cr,
+                      int                    scrpitch,
                       int                    surface_height,
                       u8                    *dst,
                       int                    dpitch,
@@ -2394,6 +2414,10 @@ void
 dfb_convert_to_yuy2( DFBSurfacePixelFormat  format,
                      const void            *src,
                      int                    spitch,
+                     const void            *src_cb,
+                     int                    scbpitch,
+                     const void            *src_cr,
+                     int                    scrpitch,
                      int                    surface_height,
                      u32                   *dst,
                      int                    dpitch,
@@ -2421,6 +2445,10 @@ void
 dfb_convert_to_uyvy( DFBSurfacePixelFormat  format,
                      const void            *src,
                      int                    spitch,
+                     const void            *src_cb,
+                     int                    scbpitch,
+                     const void            *src_cr,
+                     int                    scrpitch,
                      int                    surface_height,
                      u32                   *dst,
                      int                    dpitch,
diff --git a/src/gfx/convert.h b/src/gfx/convert.h
index acdc9ef..d958ae0 100644
--- a/src/gfx/convert.h
+++ b/src/gfx/convert.h
@@ -611,6 +611,10 @@ dfb_argb_to_a8( const u32 *src, u8 *dst, int len )
 void dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
                            const void            *src,
                            int                    spitch,
+                           const void            *src_cb,
+                           int                    scbpitch,
+                           const void            *src_cr,
+                           int                    scrpitch,
                            int                    surface_height,
                            u16                   *dst,
                            int                    dpitch,
@@ -620,6 +624,10 @@ void dfb_convert_to_rgb16( DFBSurfacePixelFormat  format,
 void dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
                             const void            *src,
                             int                    spitch,
+                            const void            *src_cb,
+                            int                    scbpitch,
+                            const void            *src_cr,
+                            int                    scrpitch,
                             int                    surface_height,
                             u16                   *dst,
                             int                    dpitch,
@@ -629,6 +637,10 @@ void dfb_convert_to_rgb555( DFBSurfacePixelFormat  format,
 void dfb_convert_to_argb( DFBSurfacePixelFormat  format,
                           const void            *src,
                           int                    spitch,
+                          const void            *src_cb,
+                          int                    scbpitch,
+                          const void            *src_cr,
+                          int                    scrpitch,
                           int                    surface_height,
                           u32                   *dst,
                           int                    dpitch,
@@ -638,6 +650,10 @@ void dfb_convert_to_argb( DFBSurfacePixelFormat  format,
 void dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
                            const void            *src,
                            int                    spitch,
+                           const void            *src_cb,
+                           int                    scbpitch,
+                           const void            *src_cr,
+                           int                    scrpitch,
                            int                    surface_height,
                            u32                   *dst,
                            int                    dpitch,
@@ -647,6 +663,10 @@ void dfb_convert_to_rgb32( DFBSurfacePixelFormat  format,
 void dfb_convert_to_rgb24( DFBSurfacePixelFormat  format,
                            const void            *src,
                            int                    spitch,
+                           const void            *src_cb,
+                           int                    scbpitch,
+                           const void            *src_cr,
+                           int                    scrpitch,
                            int                    surface_height,
                            u8                    *dst,
                            int                    dpitch,
@@ -674,6 +694,10 @@ void dfb_convert_to_a4( DFBSurfacePixelFormat  format,
 void dfb_convert_to_yuy2( DFBSurfacePixelFormat  format,
                           const void            *src,
                           int                    spitch,
+                          const void            *src_cb,
+                          int                    scbpitch,
+                          const void            *src_cr,
+                          int                    scrpitch,
                           int                    surface_height,
                           u32                   *dst,
                           int                    dpitch,
@@ -683,6 +707,10 @@ void dfb_convert_to_yuy2( DFBSurfacePixelFormat  format,
 void dfb_convert_to_uyvy( DFBSurfacePixelFormat  format,
                           const void            *src,
                           int                    spitch,
+                          const void            *src_cb,
+                          int                    scbpitch,
+                          const void            *src_cr,
+                          int                    scrpitch,
                           int                    surface_height,
                           u32                   *dst,
                           int                    dpitch,
diff --git a/systems/sdl/primary.c b/systems/sdl/primary.c
index 90a50f5..bf5de98 100644
--- a/systems/sdl/primary.c
+++ b/systems/sdl/primary.c
@@ -402,7 +402,9 @@ update_screen( int x, int y, int w, int h )
      switch (screen->format->BitsPerPixel) {
           case 16:
                dfb_convert_to_rgb16( surface->config.format,
-                                     src, lock.pitch, surface->config.size.h,
+                                     src, lock.pitch,
+                                     src_cb, pitch_cb, src_cr, pitch_cr,
+                                     surface->config.size.h,
                                      dst, screen->pitch, w, h );
                break;
 
diff --git a/systems/x11/primary.c b/systems/x11/primary.c
index b188597..9ece27b 100644
--- a/systems/x11/primary.c
+++ b/systems/x11/primary.c
@@ -877,11 +877,13 @@ update_screen( DFBX11 *x11, const DFBRectangle *clip, 
CoreSurfaceBufferLock *loc
           switch (xw->depth) {
                case 32:
                     dfb_convert_to_argb( allocation->config.format, src, 
lock->pitch,
+                                         src_cb, pitch_cb, src_cr, pitch_cr,
                                          allocation->config.size.h, dst, 
ximage->bytes_per_line, rect.w, rect.h );
                     break;
 
                case 24:
                     dfb_convert_to_rgb32( allocation->config.format, src, 
lock->pitch,
+                                          src_cb, pitch_cb, src_cr, pitch_cr,
                                           allocation->config.size.h, dst, 
ximage->bytes_per_line, rect.w, rect.h );
                     break;
 
@@ -905,12 +907,14 @@ update_screen( DFBX11 *x11, const DFBRectangle *clip, 
CoreSurfaceBufferLock *loc
                     }
                     else {
                     dfb_convert_to_rgb16( allocation->config.format, src, 
lock->pitch,
+                                          src_cb, pitch_cb, src_cr, pitch_cr,
                                           allocation->config.size.h, dst, 
ximage->bytes_per_line, rect.w, rect.h );
                     }
                     break;
 
                case 15:
                     dfb_convert_to_rgb555( allocation->config.format, src, 
lock->pitch,
+                                           src_cb, pitch_cb, src_cr, pitch_cr,
                                            allocation->config.size.h, dst, 
ximage->bytes_per_line, rect.w, rect.h );
                     break;
 
diff --git a/tools/mkdgifft.cpp b/tools/mkdgifft.cpp
index f417215..0c6258d 100644
--- a/tools/mkdgifft.cpp
+++ b/tools/mkdgifft.cpp
@@ -791,6 +791,7 @@ write_glyph( DGIFFGlyphInfo *glyph, const 
DFBSurfaceDescription &desc, void *dst
      switch (m_format) {
           case DSPF_ARGB:
                dfb_convert_to_argb( desc.pixelformat, 
desc.preallocated[0].data, desc.preallocated[0].pitch,
+                                    NULL, 0, NULL, 0,
                                     desc.height, (u32*) dst, pitch, 
desc.width, desc.height );
                break;
 
-- 
1.8.2

_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to