From af70f75aa993d90aad568eb5571951dfa738f7bb Mon Sep 17 00:00:00 2001
From: Bryce Poole <Bryce.Poole@intel.com>
Date: Fri, 18 May 2012 13:41:55 -0700
Subject: [PATCH] Added GetColorSpace to the IDirectFBSurface interface.

---
 include/directfb.h             |    8 ++++++++
 src/display/idirectfbsurface.c |   20 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/directfb.h b/include/directfb.h
index 39a6363..b94d86e 100644
--- a/include/directfb.h
+++ b/include/directfb.h
@@ -3756,6 +3756,14 @@ D_DEFINE_INTERFACE(   IDirectFBSurface,
      );
 
      /*
+      * Get the current color space.
+      */
+     DFBResult (*GetColorSpace) (
+          IDirectFBSurface         *thiz,
+          DFBSurfaceColorSpace     *ret_colorspace
+     );
+
+     /*
       * Get a mask of drawing functions that are hardware
       * accelerated with the current settings.
       *
diff --git a/src/display/idirectfbsurface.c b/src/display/idirectfbsurface.c
index 1e89cf0..914afb9 100644
--- a/src/display/idirectfbsurface.c
+++ b/src/display/idirectfbsurface.c
@@ -255,6 +255,25 @@ IDirectFBSurface_GetPixelFormat( IDirectFBSurface      *thiz,
 }
 
 static DFBResult
+IDirectFBSurface_GetColorSpace( IDirectFBSurface      *thiz,
+                                DFBSurfaceColorSpace  *colorspace )
+{
+     DIRECT_INTERFACE_GET_DATA(IDirectFBSurface)
+
+     D_DEBUG_AT( Surface, "%s( %p )\n", __FUNCTION__, thiz );
+
+     if (!data->surface)
+          return DFB_DESTROYED;
+
+     if (!colorspace)
+          return DFB_INVARG;
+
+     *colorspace = data->surface->config.colorspace;
+
+     return DFB_OK;
+}
+
+static DFBResult
 IDirectFBSurface_GetAccelerationMask( IDirectFBSurface    *thiz,
                                       IDirectFBSurface    *source,
                                       DFBAccelerationMask *ret_mask )
@@ -3447,6 +3466,7 @@ DFBResult IDirectFBSurface_Construct( IDirectFBSurface       *thiz,
      thiz->GetSize = IDirectFBSurface_GetSize;
      thiz->GetVisibleRectangle = IDirectFBSurface_GetVisibleRectangle;
      thiz->GetPixelFormat = IDirectFBSurface_GetPixelFormat;
+     thiz->GetColorSpace = IDirectFBSurface_GetColorSpace;
      thiz->GetAccelerationMask = IDirectFBSurface_GetAccelerationMask;
 
      thiz->GetPalette = IDirectFBSurface_GetPalette;
-- 
1.7.4.1

