From: hackbard Date: Sat, 22 Mar 2003 07:22:19 +0000 (+0000) Subject: exchanged render.c with patch aginst orig X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=d098eff99551e2223ba0c7dd51129eb6640e9992;p=lectures%2Fdfb-slides.git exchanged render.c with patch aginst orig --- diff --git a/dfb_render_c.patch b/dfb_render_c.patch new file mode 100644 index 0000000..e32e6d3 --- /dev/null +++ b/dfb_render_c.patch @@ -0,0 +1,11 @@ +--- ./src/render.c.orig 2003-03-22 09:26:56.000000000 +0100 ++++ ./src/render.c 2003-03-22 09:27:39.000000000 +0100 +@@ -176,6 +176,8 @@ + size = (size * 64) / 52; + else if (IS_LISTITEM (text)) + size = (size * 48) / 64; ++ else ++ offx+=40; + + font = resources_get_font (face, size); + diff --git a/render.c b/render.c deleted file mode 100644 index 883693a..0000000 --- a/render.c +++ /dev/null @@ -1,230 +0,0 @@ -/* DirectFB presentation app - * - * Copyright (C) 2001 convergence integrated media - * Authors: Sven Neumann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#include -#include - -#include - -#include - -#include "apptypes.h" - -#include "action.h" -#include "context.h" -#include "header.h" -#include "image.h" -#include "listitem.h" -#include "render.h" -#include "resources.h" -#include "slides.h" -#include "slide.h" -#include "text.h" -#include "video.h" - - -static void render_bullet (Context *context, - gint *offx, - gint offy); - -void -render_bg (Context *context) -{ - guchar *color; - - color = context_get_bgcolor (context); - context->surface->SetColor (context->surface, - color[0], color[1], color[2], color[3]); - context->surface->FillRectangle (context->surface, - 0, 0, context->w, context->h); -} - -void -render_bgimage (Context *context) -{ - gchar *image; - - image = context_get_bgimage (context); - if (image) - { - IDirectFBSurface *src; - gint w, h; - - src = resources_get_surface (image); - if (!src) - return; - - src->GetSize (src, &w, &h); - - if (w == context->w && h == context->h) - { - context->surface->Blit (context->surface, src, NULL, 0, 0); - } - else - { - DFBRectangle rect = { 0, 0, context->w, context->h }; - - context->surface->StretchBlit (context->surface, - src, NULL, &rect); - } - - resources_release_surface (image); - } -} - -void -render_image (Context *context, - Image *image) -{ - Item *item; - IDirectFBSurface *src; - DFBRectangle rect; - DFBSurfacePixelFormat format; - gint w, h, ratio; - - if (IS_VIDEO (image)) - { - Video *video; - - video = (Video *) image; - video->dest_surface = context->surface; - - return; - } - - src = resources_get_surface (ITEM (image)->value); - - if (!src) - return; - - src->GetSize (src, &w, &h); - src->GetPixelFormat (src, &format); - - if (format == DSPF_ARGB) - context->surface->SetBlittingFlags (context->surface, - DSBLIT_BLEND_ALPHACHANNEL); - - ratio = (w * 1024) / h; - item = (Item *) image; - - rect.w = item->flags & WIDTH ? - item->width : (item->flags & HEIGHT ? (item->height * ratio) / 1024 : w); - rect.h = item->flags & HEIGHT ? - item->height : (item->flags & WIDTH ? (item->width * 1024) / ratio : h); - - rect.x = item->flags & XOFFSET ? item->x : 0; - rect.y = item->flags & YOFFSET ? item->y : 0; - - if (format == DSPF_ARGB) - context->surface->SetBlittingFlags (context->surface, - DSBLIT_BLEND_ALPHACHANNEL); - - if (w == rect.w || h == rect.h) - context->surface->Blit (context->surface, src, NULL, rect.x, rect.y); - else - context->surface->StretchBlit (context->surface, src, NULL, &rect); - - context->surface->SetBlittingFlags (context->surface, DSBLIT_NOFX); - - resources_release_surface (ITEM (image)->value); -} - -void -render_text (Context *context, - Text *text, - gint *offy) -{ - guchar *color; - gchar *face; - gint size; - gint offx; - IDirectFBFont *font; - - context_push (context, (Item *) text); - - color = context_get_fgcolor (context); - context->surface->SetColor (context->surface, - color[0], color[1], color[2], color[3]); - - face = context_get_face (context); - size = context_get_size (context); - - g_return_if_fail (face != NULL); - g_return_if_fail (size > 0); - - offx = 10; - - if (IS_HEADER (text)) - size = (size * 64) / 52; - else if (IS_LISTITEM (text)) - size = (size * 48) / 64; - else - offx+=40; - - font = resources_get_font (face, size); - - if (IS_LISTITEM (text)) - { - gint asc; - - font->GetAscender (font, &asc); - render_bullet (context, &offx, *offy + asc); - } - - context->surface->SetFont (context->surface, font); - context->surface->DrawString (context->surface, - ITEM (text)->value, -1, - offx, *offy, DSTF_TOPLEFT); - - *offy += (size * 64) / 48; - - context_pop (context, (Item *) text); -} - -static void -render_bullet (Context *context, - gint *offx, - gint offy) -{ - IDirectFBSurface *src; - gchar *image; - gint w, h; - - image = context_get_bullet (context); - if (image) - { - src = resources_get_surface (image); - if (!src) - return; - - src->GetSize (src, &w, &h); - - context->surface->SetBlittingFlags (context->surface, - DSBLIT_BLEND_ALPHACHANNEL); - context->surface->Blit (context->surface, - src, NULL, *offx + 20, offy - h); - context->surface->SetBlittingFlags (context->surface, DSBLIT_NOFX); - - resources_release_surface (image); - - *offx += w + 24; - } -}