static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; IDirectFBSurface *destsurf = data->target; DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); /* Use antialiasing when available */ #if (DFB_VERSION_ATLEAST(1,2,0)) SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS)); #endif destsurf->GetClip(destsurf, &clip_region); for (i=0; i < count - 1; i++) { int x1 = points[i].x + clip_region.x1; int y1 = points[i].y + clip_region.y1; int x2 = points[i + 1].x + clip_region.x1; int y2 = points[i + 1].y + clip_region.y1; SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x1, y1, x2, y2)); } return 0; error: return -1; }
static int l_DrawLine (lua_State* L) { // [ sfc | x1 | y1 | x2 | y2 ] IDirectFBSurface* sfc = * (IDirectFBSurface**) luaL_checkudata(L, 1, "ldirectfb.IDirectFBSurface"); DFBCHECK( sfc->DrawLine(sfc, luaL_checknumber(L, 2), luaL_checknumber(L, 3), luaL_checknumber(L, 4), luaL_checknumber(L, 5)) ) return 0; }
static mrb_value surface_draw_line(mrb_state *mrb, mrb_value self) { IDirectFBSurface* surface = mrb_directfb_surface(mrb, self); DFBResult ret = -1; if (surface != NULL) { mrb_int x1, y1, x2, y2; mrb_get_args(mrb, "iiii", &x1, &y1, &x2, &y2); ret = surface->DrawLine(surface, x1, y1, x2, y2); } return mrb_fixnum_value(ret); }
static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, const SDL_Point * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; IDirectFBSurface *destsurf = get_dfb_surface(data->window); int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); for (i=0; i < count; i++) SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y)); return 0; error: return -1; }
static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; IDirectFBSurface *destsurf = data->target; DFBRegion clip_region; int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); destsurf->GetClip(destsurf, &clip_region); for (i=0; i < count; i++) { int x = points[i].x + clip_region.x1; int y = points[i].y + clip_region.y1; SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, x, y, x, y)); } return 0; error: return -1; }
static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, const SDL_Point * points, int count) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; IDirectFBSurface *destsurf = get_dfb_surface(data->window); int i; DirectFB_ActivateRenderer(renderer); PrepareDraw(renderer); /* Use antialiasing when available */ #if (DFB_VERSION_ATLEAST(1,2,0)) SDL_DFB_CHECKERR(destsurf->SetRenderOptions(destsurf, DSRO_ANTIALIAS)); #endif for (i=0; i < count - 1; i++) SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i+1].x, points[i+1].y)); return 0; error: return -1; }
void DirectFB_WM_RedrawLayout(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); IDirectFBSurface *s = windata->window_surface; DFB_Theme *t = &windata->theme; int i; int d = (t->caption_size - t->font_size) / 2; int x, y, w; if (!windata->is_managed || (window->flags & SDL_WINDOW_FULLSCREEN)) return; SDL_DFB_CHECK(s->SetSrcBlendFunction(s, DSBF_ONE)); SDL_DFB_CHECK(s->SetDstBlendFunction(s, DSBF_ZERO)); SDL_DFB_CHECK(s->SetDrawingFlags(s, DSDRAW_NOFX)); SDL_DFB_CHECK(s->SetBlittingFlags(s, DSBLIT_NOFX)); LoadFont(_this, window); /* s->SetDrawingFlags(s, DSDRAW_BLEND); */ s->SetColor(s, COLOR_EXPAND(t->frame_color)); /* top */ for (i = 0; i < t->top_size; i++) s->DrawLine(s, 0, i, windata->size.w, i); /* bottom */ for (i = windata->size.h - t->bottom_size; i < windata->size.h; i++) s->DrawLine(s, 0, i, windata->size.w, i); /* left */ for (i = 0; i < t->left_size; i++) s->DrawLine(s, i, 0, i, windata->size.h); /* right */ for (i = windata->size.w - t->right_size; i < windata->size.w; i++) s->DrawLine(s, i, 0, i, windata->size.h); /* Caption */ s->SetColor(s, COLOR_EXPAND(t->caption_color)); s->FillRectangle(s, t->left_size, t->top_size, windata->client.w, t->caption_size); /* Close Button */ w = t->caption_size; x = windata->size.w - t->right_size - w + d; y = t->top_size + d; s->SetColor(s, COLOR_EXPAND(t->close_color)); DrawTriangle(s, 1, x, y, w - 2 * d); /* Max Button */ s->SetColor(s, COLOR_EXPAND(t->max_color)); DrawTriangle(s, window->flags & SDL_WINDOW_MAXIMIZED ? 1 : 0, x - w, y, w - 2 * d); /* Caption */ if (*window->title) { s->SetColor(s, COLOR_EXPAND(t->font_color)); DrawCraption(_this, s, (x - w) / 2, t->top_size + d, window->title); } /* Icon */ if (windata->icon) { DFBRectangle dr; dr.x = t->left_size + d; dr.y = t->top_size + d; dr.w = w - 2 * d; dr.h = w - 2 * d; s->SetBlittingFlags(s, DSBLIT_BLEND_ALPHACHANNEL); s->StretchBlit(s, windata->icon, NULL, &dr); } windata->wm_needs_redraw = 0; }