Author: tom
Date: Wed Dec 10 09:06:11 2008
New Revision: 3483

URL: http://svn.slimdevices.com?rev=3483&root=Jive&view=rev
Log:
Applied cumulative patches from: 
http://patch-tracking.debian.net/package/sdlpango/0.1.2-4
1) api_additions.patch
2) matrix_declarations.patch
3) fillrect_crash.patch
4) blit_overflow.patch

Modified:
    7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.c
    7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.h

Modified: 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.c
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.c?rev=3483&root=Jive&r1=3482&r2=3483&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.c 
(original)
+++ 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.c Wed Dec 
10 09:06:11 2008
@@ -284,6 +284,59 @@
     int min_width;
     int min_height;
 } contextImpl;
+
+
+const SDLPango_Matrix _MATRIX_WHITE_BACK
+    = {255, 0, 0, 0,
+       255, 0, 0, 0,
+       255, 0, 0, 0,
+       255, 255, 0, 0,};
+
+/*!
+    Specifies white back and black letter.
+*/
+const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
+
+const SDLPango_Matrix _MATRIX_BLACK_BACK
+    = {0, 255, 0, 0,
+       0, 255, 0, 0,
+       0, 255, 0, 0,
+       255, 255, 0, 0,};
+/*!
+    Specifies black back and white letter.
+*/
+const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
+    = {0, 0, 0, 0,
+       0, 0, 0, 0,
+       0, 0, 0, 0,
+       0, 255, 0, 0,};
+/*!
+    Specifies transparent back and black letter.
+*/
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = 
&_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
+    = {255, 255, 0, 0,
+       255, 255, 0, 0,
+       255, 255, 0, 0,
+       0, 255, 0, 0,};
+/*!
+    Specifies transparent back and white letter.
+*/
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = 
&_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
+
+const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
+    = {255, 255, 0, 0,
+       255, 255, 0, 0,
+       255, 255, 0, 0,
+       0, 0, 0, 0,};
+/*!
+    Specifies transparent back and transparent letter.
+    This is useful for KARAOKE like rendering.
+*/
+const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = 
&_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
 
 
 /*!
@@ -672,16 +725,23 @@
     int x = rect->x;
     int y = rect->y;
 
+    if(x < 0) {
+       width += x; x = 0;
+    }
     if(x + width > surface->w) {
        width = surface->w - x;
-       if(width <= 0)
-           return;
+    }
+    if(width <= 0)
+       return;
+
+    if(y < 0) {
+       height += y; y = 0;
     }
     if(y + height > surface->h) {
        height = surface->h - y;
-       if(height <= 0)
-           return;
-    }
+    }
+    if(height <= 0)
+       return;
 
     if(SDL_LockSurface(surface)) {
        SDL_SetError("surface lock failed");
@@ -723,13 +783,9 @@
     SDL_UnlockSurface(surface);
 }
 
-/*!
-    Create a context which contains Pango objects.
-
-    @return A pointer to the context as a SDLPango_Context*.
-*/
+
 SDLPango_Context*
-SDLPango_CreateContext()
+SDLPango_CreateContext_GivenFontDesc(const char* font_desc)
 {
     SDLPango_Context *context = g_malloc(sizeof(SDLPango_Context));
     G_CONST_RETURN char *charset;
@@ -743,8 +799,7 @@
     pango_context_set_language (context->context, pango_language_from_string 
(charset));
     pango_context_set_base_dir (context->context, PANGO_DIRECTION_LTR);
 
-    context->font_desc = pango_font_description_from_string(
-       MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE));
+    context->font_desc = pango_font_description_from_string(font_desc);
 
     context->layout = pango_layout_new (context->context);
 
@@ -759,6 +814,17 @@
     context->min_width = 0;
 
     return context;
+}
+
+/*!
+    Create a context which contains Pango objects.
+
+    @return A pointer to the context as a SDLPango_Context*.
+*/
+SDLPango_Context*
+SDLPango_CreateContext()
+{
+    SDLPango_CreateContext_GivenFontDesc(MAKE_FONT_NAME(DEFAULT_FONT_FAMILY, 
DEFAULT_FONT_SIZE));
 }
 
 /*!
@@ -873,7 +939,9 @@
     width = PANGO_PIXELS (logical_rect.width);
     height = PANGO_PIXELS (logical_rect.height);
 
-    SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
+    if (width && height) {
+        SDL_FillRect(surface, NULL, SDL_MapRGBA(surface->format, 0, 0, 0, 0));
+    }
 
     if((! context->tmp_ftbitmap) || context->tmp_ftbitmap->width < width
        || context->tmp_ftbitmap->rows < height)
@@ -1053,6 +1121,20 @@
     pango_layout_set_font_description (context->layout, context->font_desc);
 }
 
+void
+SDLPango_SetText_GivenAlignment(
+    SDLPango_Context *context,
+    const char *text,
+    int length,
+    SDLPango_Alignment alignment)
+{
+    pango_layout_set_attributes(context->layout, NULL);
+    pango_layout_set_text (context->layout, text, length);
+    pango_layout_set_auto_dir (context->layout, TRUE);
+    pango_layout_set_alignment (context->layout, alignment);
+    pango_layout_set_font_description (context->layout, context->font_desc);
+}
+
 /*!
     Set plain text to context.
     Text must be utf-8.
@@ -1067,11 +1149,7 @@
     const char *text,
     int length)
 {
-    pango_layout_set_attributes(context->layout, NULL);
-    pango_layout_set_text (context->layout, text, length);
-    pango_layout_set_auto_dir (context->layout, TRUE);
-    pango_layout_set_alignment (context->layout, PANGO_ALIGN_LEFT);
-    pango_layout_set_font_description (context->layout, context->font_desc);
+    SDLPango_SetText_GivenAlignment(context, text, length, 
SDLPANGO_ALIGN_LEFT);
 }
 
 /*!

Modified: 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.h
URL: 
http://svn.slimdevices.com/7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.h?rev=3483&root=Jive&r1=3482&r2=3483&view=diff
==============================================================================
--- 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.h 
(original)
+++ 7.4/branches/pango/squeezeplay/src/SDL_Pango-0.1.2/src/SDL_Pango.h Wed Dec 
10 09:06:11 2008
@@ -26,6 +26,7 @@
 
 #ifndef SDL_PANGO_H
 #define SDL_PANGO_H
+#define SDL_PANGO_HAS_GC_EXTENSIONS
 
 #include "SDL.h"
 
@@ -46,57 +47,27 @@
     Uint8 m[4][4];  /*! Matrix variables */
 } SDLPango_Matrix;
 
-const SDLPango_Matrix _MATRIX_WHITE_BACK
-    = {255, 0, 0, 0,
-       255, 0, 0, 0,
-       255, 0, 0, 0,
-       255, 255, 0, 0,};
-
 /*!
     Specifies white back and black letter.
 */
-const SDLPango_Matrix *MATRIX_WHITE_BACK = &_MATRIX_WHITE_BACK;
-
-const SDLPango_Matrix _MATRIX_BLACK_BACK
-    = {0, 255, 0, 0,
-       0, 255, 0, 0,
-       0, 255, 0, 0,
-       255, 255, 0, 0,};
+extern const SDLPango_Matrix *MATRIX_WHITE_BACK;
 /*!
     Specifies black back and white letter.
 */
-const SDLPango_Matrix *MATRIX_BLACK_BACK = &_MATRIX_BLACK_BACK;
-
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_BLACK_LETTER
-    = {0, 0, 0, 0,
-       0, 0, 0, 0,
-       0, 0, 0, 0,
-       0, 255, 0, 0,};
+extern const SDLPango_Matrix *MATRIX_BLACK_BACK;
 /*!
     Specifies transparent back and black letter.
 */
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER = 
&_MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
-
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_WHITE_LETTER
-    = {255, 255, 0, 0,
-       255, 255, 0, 0,
-       255, 255, 0, 0,
-       0, 255, 0, 0,};
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_BLACK_LETTER;
 /*!
     Specifies transparent back and white letter.
 */
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER = 
&_MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
-
-const SDLPango_Matrix _MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER
-    = {255, 255, 0, 0,
-       255, 255, 0, 0,
-       255, 255, 0, 0,
-       0, 0, 0, 0,};
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_WHITE_LETTER;
 /*!
     Specifies transparent back and transparent letter.
     This is useful for KARAOKE like rendering.
 */
-const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER = 
&_MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
+extern const SDLPango_Matrix *MATRIX_TRANSPARENT_BACK_TRANSPARENT_LETTER;
 
 /*!
     Specifies direction of text. See Pango reference for detail
@@ -109,12 +80,20 @@
     SDLPANGO_DIRECTION_NEUTRAL /*! Neutral */
 } SDLPango_Direction;
 
-
+/*!
+    Specifies alignment of text. See Pango reference for detail
+*/
+typedef enum {
+    SDLPANGO_ALIGN_LEFT,
+    SDLPANGO_ALIGN_CENTER,
+    SDLPANGO_ALIGN_RIGHT
+} SDLPango_Alignment;
 
 extern DECLSPEC int SDLCALL SDLPango_Init();
 
 extern DECLSPEC int SDLCALL SDLPango_WasInit();
 
+extern DECLSPEC SDLPango_Context* SDLCALL 
SDLPango_CreateContext_GivenFontDesc(const char* font_desc);
 extern DECLSPEC SDLPango_Context* SDLCALL SDLPango_CreateContext();
 
 extern DECLSPEC void SDLCALL SDLPango_FreeContext(
@@ -156,6 +135,12 @@
     SDLPango_Context *context,
     const char *markup,
     int length);
+
+extern DECLSPEC void SDLCALL SDLPango_SetText_GivenAlignment(
+    SDLPango_Context *context,
+    const char *text,
+    int length,
+    SDLPango_Alignment alignment);
 
 extern DECLSPEC void SDLCALL SDLPango_SetText(
     SDLPango_Context *context,

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to