caca-canvas.c (libcaca-0.99.beta19) | : | caca-canvas.c (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
/* | /* | |||
* libcaca Ruby bindings | * libcaca Ruby bindings | |||
* Copyright (c) 2007-2014 Pascal Terjan <pterjan@linuxfr.org> | * Copyright © 2007—2014 Pascal Terjan <pterjan@linuxfr.org> | |||
* 2021 Sam Hocevar <sam@hocevar.net> | ||||
* All Rights Reserved | ||||
* | * | |||
* This library is free software. It comes without any warranty, to | * This library is free software. It comes without any warranty, to | |||
* the extent permitted by applicable law. You can redistribute it | * the extent permitted by applicable law. You can redistribute it | |||
* and/or modify it under the terms of the Do What the Fuck You Want | * and/or modify it under the terms of the Do What the Fuck You Want | |||
* to Public License, Version 2, as published by Sam Hocevar. See | * to Public License, Version 2, as published by Sam Hocevar. See | |||
* http://www.wtfpl.net/ for more details. | * http://www.wtfpl.net/ for more details. | |||
*/ | */ | |||
#include <ruby.h> | #include <ruby.h> | |||
#include <caca.h> | #include <caca.h> | |||
skipping to change at line 585 | skipping to change at line 587 | |||
{ | { | |||
void *buf; | void *buf; | |||
caca_font_t *f; | caca_font_t *f; | |||
VALUE b; | VALUE b; | |||
if(CLASS_OF(font) != cFont) | if(CLASS_OF(font) != cFont) | |||
{ | { | |||
rb_raise(rb_eArgError, "First argument is not a Caca::Font"); | rb_raise(rb_eArgError, "First argument is not a Caca::Font"); | |||
} | } | |||
buf = malloc(width*height*4); | buf = _caca_alloc2d(width, height, 4); | |||
if(buf == NULL) | if(buf == NULL) | |||
{ | { | |||
rb_raise(rb_eNoMemError, "Out of memory"); | rb_raise(rb_eNoMemError, "Out of memory"); | |||
} | } | |||
f = DATA_PTR(font); | f = DATA_PTR(font); | |||
caca_render_canvas(_SELF, f, buf, NUM2UINT(width), NUM2UINT(height), NUM2UIN T(pitch)); | caca_render_canvas(_SELF, f, buf, NUM2UINT(width), NUM2UINT(height), NUM2UIN T(pitch)); | |||
b = rb_str_new(buf, width*height*4); | b = rb_str_new(buf, width*height*4); | |||
free(buf); | free(buf); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added |