Compare commits
2 Commits
6.18.3.761
...
6.19
| Author | SHA1 | Date | |
|---|---|---|---|
| 366a09d708 | |||
| 3fe3df9f23 |
+10
-1
@@ -7,6 +7,7 @@ http://www.renpy.org
|
||||
Ren'Py development takes place on the ``master`` branch, and occasionally
|
||||
on feature branches.
|
||||
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
@@ -132,10 +133,18 @@ For example::
|
||||
renpy.engine.warp_drive.engage(factor)
|
||||
|
||||
|
||||
Translating
|
||||
===========
|
||||
|
||||
For best practices when it comes to translating the launcher and template
|
||||
game, please read:
|
||||
|
||||
http://lemmasoft.renai.us/forums/viewtopic.php?p=321603#p321603
|
||||
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
||||
For bug fixes, documentation improvements, and simple changes, just
|
||||
make a pull request. For more complex changes, it might make sense
|
||||
to file an issue first so we can discuss the design.
|
||||
|
||||
|
||||
+31
-34
@@ -25,8 +25,7 @@
|
||||
* 11/08/2004 - Compr fix, levels -1,1-7 now work - Tyler Montbriand
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_byteorder.h>
|
||||
#include <SDL.h>
|
||||
#include <png.h>
|
||||
#include <zlib.h>
|
||||
#include "IMG_savepng.h"
|
||||
@@ -38,7 +37,7 @@
|
||||
int IMG_SavePNG(const char *file, SDL_Surface *surf,int compression){
|
||||
SDL_RWops *fp;
|
||||
int ret;
|
||||
|
||||
|
||||
fp=SDL_RWFromFile(file,"wb");
|
||||
|
||||
if( fp == NULL ) {
|
||||
@@ -60,24 +59,25 @@ int IMG_SavePNG_RW(SDL_RWops *src, SDL_Surface *surf,int compression){
|
||||
png_infop info_ptr;
|
||||
SDL_PixelFormat *fmt=NULL;
|
||||
SDL_Surface *tempsurf=NULL;
|
||||
int ret,funky_format,used_alpha;
|
||||
unsigned int i,temp_alpha;
|
||||
int ret,funky_format;
|
||||
unsigned int i;
|
||||
png_colorp palette;
|
||||
Uint8 *palette_alpha=NULL;
|
||||
png_byte **row_pointers=NULL;
|
||||
png_ptr=NULL;info_ptr=NULL;palette=NULL;ret=-1;
|
||||
funky_format=0;
|
||||
|
||||
SDL_BlendMode temp_blend;
|
||||
|
||||
if( !src || !surf) {
|
||||
goto savedone; /* Nothing to do. */
|
||||
}
|
||||
|
||||
row_pointers=(png_byte **)malloc(surf->h * sizeof(png_byte*));
|
||||
if (!row_pointers) {
|
||||
if (!row_pointers) {
|
||||
SDL_SetError("Couldn't allocate memory for rowpointers");
|
||||
goto savedone;
|
||||
}
|
||||
|
||||
|
||||
png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,NULL,NULL);
|
||||
if (!png_ptr){
|
||||
SDL_SetError("Couldn't allocate memory for PNG file");
|
||||
@@ -126,19 +126,19 @@ int IMG_SavePNG_RW(SDL_RWops *src, SDL_Surface *surf,int compression){
|
||||
palette[i].blue=fmt->palette->colors[i].b;
|
||||
}
|
||||
png_set_PLTE(png_ptr,info_ptr,palette,fmt->palette->ncolors);
|
||||
if (surf->flags&SDL_SRCCOLORKEY) {
|
||||
palette_alpha=(Uint8 *)malloc((fmt->colorkey+1)*sizeof(Uint8));
|
||||
if (!palette_alpha) {
|
||||
SDL_SetError("Couldn't create memory for palette transparency");
|
||||
goto savedone;
|
||||
}
|
||||
/* FIXME: memset? */
|
||||
for (i=0;i<(fmt->colorkey+1);i++) {
|
||||
palette_alpha[i]=255;
|
||||
}
|
||||
palette_alpha[fmt->colorkey]=0;
|
||||
png_set_tRNS(png_ptr,info_ptr,palette_alpha,fmt->colorkey+1,NULL);
|
||||
}
|
||||
// if (surf->flags&SDL_SRCCOLORKEY) {
|
||||
// palette_alpha=(Uint8 *)malloc((fmt->colorkey+1)*sizeof(Uint8));
|
||||
// if (!palette_alpha) {
|
||||
// SDL_SetError("Couldn't create memory for palette transparency");
|
||||
// goto savedone;
|
||||
// }
|
||||
// /* FIXME: memset? */
|
||||
// for (i=0;i<(fmt->colorkey+1);i++) {
|
||||
// palette_alpha[i]=255;
|
||||
// }
|
||||
// palette_alpha[fmt->colorkey]=0;
|
||||
// png_set_tRNS(png_ptr,info_ptr,palette_alpha,fmt->colorkey+1,NULL);
|
||||
// }
|
||||
}else{ /* Truecolor */
|
||||
if (fmt->Amask) {
|
||||
png_set_IHDR(png_ptr,info_ptr,
|
||||
@@ -172,11 +172,11 @@ int IMG_SavePNG_RW(SDL_RWops *src, SDL_Surface *surf,int compression){
|
||||
}else{
|
||||
/* Check for RGB/BGR/GBR/RBG/etc surfaces.*/
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
if(fmt->Rmask!=0xFF0000
|
||||
if(fmt->Rmask!=0xFF0000
|
||||
|| fmt->Gmask!=0x00FF00
|
||||
|| fmt->Bmask!=0x0000FF){
|
||||
#else
|
||||
if(fmt->Rmask!=0x0000FF
|
||||
if(fmt->Rmask!=0x0000FF
|
||||
|| fmt->Gmask!=0x00FF00
|
||||
|| fmt->Bmask!=0xFF0000){
|
||||
#endif
|
||||
@@ -185,7 +185,7 @@ int IMG_SavePNG_RW(SDL_RWops *src, SDL_Surface *surf,int compression){
|
||||
}
|
||||
}else if (fmt->BytesPerPixel==4){
|
||||
if (!fmt->Amask) { /* check for 32bit but no alpha */
|
||||
funky_format=1;
|
||||
funky_format=1;
|
||||
}else{
|
||||
/* Check for ARGB/ABGR/GBAR/RABG/etc surfaces.*/
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
@@ -228,21 +228,18 @@ int IMG_SavePNG_RW(SDL_RWops *src, SDL_Surface *surf,int compression){
|
||||
SDL_SetError("Couldn't allocate temp surface");
|
||||
goto savedone;
|
||||
}
|
||||
if(surf->flags&SDL_SRCALPHA){
|
||||
temp_alpha=fmt->alpha;
|
||||
used_alpha=1;
|
||||
SDL_SetAlpha(surf,0,255); /* Set for an opaque blit */
|
||||
}else{
|
||||
used_alpha=0;
|
||||
}
|
||||
|
||||
SDL_GetSurfaceBlendMode(surf, &temp_blend);
|
||||
SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
|
||||
|
||||
if(SDL_BlitSurface(surf,NULL,tempsurf,NULL)!=0){
|
||||
SDL_SetError("Couldn't blit surface to temp surface");
|
||||
SDL_FreeSurface(tempsurf);
|
||||
goto savedone;
|
||||
}
|
||||
if (used_alpha) {
|
||||
SDL_SetAlpha(surf,SDL_SRCALPHA,(Uint8)temp_alpha); /* Restore alpha settings*/
|
||||
}
|
||||
|
||||
SDL_SetSurfaceBlendMode(surf, temp_blend);
|
||||
|
||||
for(i=0;i<tempsurf->h;i++){
|
||||
row_pointers[i]= ((png_byte*)tempsurf->pixels) + i*tempsurf->pitch;
|
||||
}
|
||||
|
||||
+5
-9
@@ -23,17 +23,13 @@
|
||||
def version():
|
||||
return (6, 12, 0)
|
||||
|
||||
cdef extern from "pygame/pygame.h":
|
||||
cdef struct SDL_RWops:
|
||||
pass
|
||||
|
||||
void import_pygame_rwobject()
|
||||
SDL_RWops* RWopsFromPython(object obj)
|
||||
|
||||
from sdl2 cimport *
|
||||
from pygame_sdl2 cimport *
|
||||
|
||||
cdef extern from "renpy.h":
|
||||
|
||||
void core_init()
|
||||
void subpixel_init()
|
||||
|
||||
void save_png_core(object, SDL_RWops *, int)
|
||||
|
||||
@@ -425,6 +421,6 @@ def subpixel(pysrc, pydst, xoffset, yoffset, shift):
|
||||
|
||||
# Be sure to update scale.py when adding something new here!
|
||||
|
||||
import_pygame_rwobject()
|
||||
import_pygame_sdl2__rwobject()
|
||||
core_init()
|
||||
|
||||
subpixel_init()
|
||||
|
||||
+172
-172
File diff suppressed because it is too large
Load Diff
+6
-3
@@ -19,7 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <pygame/pygame.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <libavutil/avstring.h>
|
||||
@@ -35,6 +34,8 @@
|
||||
#include <SDL.h>
|
||||
#include <SDL_thread.h>
|
||||
|
||||
#include <pygame_sdl2/pygame_sdl2.surface_api.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#undef main /* We don't want SDL to override our main() */
|
||||
#endif
|
||||
@@ -1296,7 +1297,7 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
is->video_current_pts_time = av_gettime();
|
||||
|
||||
packet_queue_init(&is->videoq);
|
||||
is->video_tid = SDL_CreateThread(video_thread, is);
|
||||
is->video_tid = SDL_CreateThread(video_thread, "video_thread", is);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1606,7 +1607,7 @@ VideoState *ffpy_stream_open(SDL_RWops *rwops, const char *filename)
|
||||
is->quit_mutex = SDL_CreateMutex();
|
||||
is->quit_cond = SDL_CreateCond();
|
||||
|
||||
is->parse_tid = SDL_CreateThread(decode_thread, is);
|
||||
is->parse_tid = SDL_CreateThread(decode_thread, "decode_thread", is);
|
||||
|
||||
is->first_frame = 1;
|
||||
|
||||
@@ -1665,6 +1666,8 @@ void ffpy_init(int rate, int status) {
|
||||
|
||||
ffpy_did_init = 1;
|
||||
|
||||
import_pygame_sdl2__surface();
|
||||
|
||||
show_status = status;
|
||||
|
||||
audio_sample_rate = rate;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from sdl2 cimport SDL_Surface, SDL_RWops
|
||||
|
||||
cdef extern from "pygame_sdl2/pygame_sdl2.rwobject_api.h":
|
||||
void import_pygame_sdl2__rwobject()
|
||||
SDL_RWops* RWopsFromPython(object obj)
|
||||
|
||||
cdef extern from "pygame_sdl2/pygame_sdl2.surface_api.h":
|
||||
int import_pygame_sdl2__surface()
|
||||
SDL_Surface *PySurface_AsSurface(object)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+108
-108
@@ -23,8 +23,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "pss.h"
|
||||
#include <Python.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_thread.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_thread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/* Declarations of ffdecode functions. */
|
||||
@@ -37,7 +37,7 @@ int ffpy_refresh_event(struct VideoState *vs);
|
||||
void ffpy_init(int rate, int status);
|
||||
int ffpy_audio_decode(struct VideoState *is, Uint8 *stream, int len);
|
||||
|
||||
|
||||
|
||||
/* The current Python. */
|
||||
PyInterpreterState* interp;
|
||||
PyThreadState* thread = NULL;
|
||||
@@ -47,7 +47,7 @@ static void incref(PyObject *ref) {
|
||||
|
||||
PyEval_AcquireLock();
|
||||
oldstate = PyThreadState_Swap(thread);
|
||||
Py_INCREF(ref);
|
||||
Py_INCREF(ref);
|
||||
PyThreadState_Swap(oldstate);
|
||||
PyEval_ReleaseLock();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ static void decref(PyObject *ref) {
|
||||
|
||||
PyEval_AcquireLock();
|
||||
oldstate = PyThreadState_Swap(thread);
|
||||
Py_DECREF(ref);
|
||||
Py_DECREF(ref);
|
||||
PyThreadState_Swap(oldstate);
|
||||
PyEval_ReleaseLock();
|
||||
}
|
||||
@@ -116,9 +116,9 @@ struct Channel {
|
||||
|
||||
/* Is the playing sample tight? */
|
||||
int playing_tight;
|
||||
|
||||
|
||||
/* The queued up sample. */
|
||||
struct VideoState *queued;
|
||||
struct VideoState *queued;
|
||||
|
||||
/* The name of the queued up sample. */
|
||||
PyObject *queued_name;
|
||||
@@ -128,17 +128,17 @@ struct Channel {
|
||||
|
||||
/* Is the queued sample tight? */
|
||||
int queued_tight;
|
||||
|
||||
|
||||
/* Is this channel paused? */
|
||||
int paused;
|
||||
|
||||
|
||||
/* The volume of the channel. */
|
||||
int volume;
|
||||
|
||||
/* The position (in bytes) that this channel has queued to. */
|
||||
int pos;
|
||||
|
||||
/*
|
||||
/*
|
||||
* The number of bytes for each step of fade.
|
||||
* 0 when no fade is in progress.
|
||||
*/
|
||||
@@ -152,7 +152,7 @@ struct Channel {
|
||||
|
||||
/* The change in fade_vol for each step. */
|
||||
int fade_delta;
|
||||
|
||||
|
||||
/* The number of bytes in which we'll stop. */
|
||||
int stop_bytes;
|
||||
|
||||
@@ -215,7 +215,7 @@ static float interpolate_pan(struct Channel *c) {
|
||||
done = 1.0 * c->pan_done / c->pan_length;
|
||||
|
||||
return c->pan_start + done * (c->pan_end - c->pan_start);
|
||||
|
||||
|
||||
}
|
||||
|
||||
static float interpolate_vol2(struct Channel *c) {
|
||||
@@ -250,7 +250,7 @@ static void start_sample(struct Channel* c, int reset_fade) {
|
||||
c->pos = 0;
|
||||
|
||||
if (reset_fade) {
|
||||
|
||||
|
||||
if (c->playing_fadein == 0) {
|
||||
c->fade_step_len = 0;
|
||||
} else {
|
||||
@@ -268,7 +268,7 @@ static void start_sample(struct Channel* c, int reset_fade) {
|
||||
}
|
||||
|
||||
c->stop_bytes = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void free_sample(struct VideoState *ss) {
|
||||
@@ -294,7 +294,7 @@ static void mixaudio(Uint8 *dst, Uint8 *src, int length, int volume) {
|
||||
}
|
||||
|
||||
*sdst++ = (short) sound;
|
||||
ssrc++;
|
||||
ssrc++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ static void fade_mixaudio(struct Channel *c,
|
||||
Uint8 *dst, Uint8 *src, int length) {
|
||||
|
||||
while (length) {
|
||||
|
||||
|
||||
// No fade case.
|
||||
if (c->fade_step_len == 0) {
|
||||
mixaudio(dst, src, length, c->volume);
|
||||
@@ -316,14 +316,14 @@ static void fade_mixaudio(struct Channel *c,
|
||||
int l = min(c->fade_step_len - c->fade_off, length);
|
||||
|
||||
mixaudio(dst, src, l, c->fade_vol);
|
||||
|
||||
|
||||
length -= l;
|
||||
dst += l;
|
||||
src += l;
|
||||
c->fade_off += l;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, we have no space left in the current fade step.
|
||||
// Go to the next step.
|
||||
c->fade_off = 0;
|
||||
@@ -333,14 +333,14 @@ static void fade_mixaudio(struct Channel *c,
|
||||
if (c->fade_vol <= 0) {
|
||||
c->fade_vol = 0;
|
||||
}
|
||||
|
||||
|
||||
// Stop on a fadein.
|
||||
if (c->fade_vol >= c->volume) {
|
||||
c->fade_vol = c->volume;
|
||||
c->fade_step_len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -365,14 +365,14 @@ static void pan_audio(struct Channel *c, Uint8 *stream, int length) {
|
||||
float vol2;
|
||||
int left = 256;
|
||||
int right = 256;
|
||||
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < length; i++) {
|
||||
|
||||
if ((i & 0x1f) == 0) {
|
||||
pan = interpolate_pan(c);
|
||||
vol2 = interpolate_vol2(c);
|
||||
|
||||
|
||||
// If nothing to do, skip 32 samples.
|
||||
if (pan == 0.0 && vol2 == 1.0) {
|
||||
i += 31;
|
||||
@@ -402,7 +402,7 @@ static void pan_audio(struct Channel *c, Uint8 *stream, int length) {
|
||||
c->pan_done += 1;
|
||||
c->vol2_done += 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
@@ -410,7 +410,7 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
|
||||
for (channel = 0; channel < num_channels; channel++) {
|
||||
|
||||
|
||||
|
||||
int mixed = 0;
|
||||
struct Channel *c = &channels[channel];
|
||||
|
||||
@@ -430,10 +430,10 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
// Decode some amount of data.
|
||||
|
||||
bytes = ffpy_audio_decode(c->playing, buffer, mixleft);
|
||||
|
||||
|
||||
// We have some data in the buffer.
|
||||
if (c->stop_bytes && bytes) {
|
||||
|
||||
|
||||
if (c->stop_bytes != -1)
|
||||
bytes = min(c->stop_bytes, bytes);
|
||||
|
||||
@@ -441,12 +441,12 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
fade_mixaudio(c, &stream[mixed], buffer, bytes);
|
||||
|
||||
mixed += bytes;
|
||||
|
||||
|
||||
if (c->stop_bytes != -1)
|
||||
c->stop_bytes -= bytes;
|
||||
|
||||
c->pos += bytes;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -458,14 +458,14 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
|
||||
int old_tight = c->playing_tight;
|
||||
struct Dying *d;
|
||||
|
||||
|
||||
post_event(c);
|
||||
|
||||
d = malloc(sizeof(struct Dying));
|
||||
d->next = dying;
|
||||
d->stream = c->playing;
|
||||
dying = d;
|
||||
|
||||
|
||||
LOCK_NAME();
|
||||
|
||||
decref(c->playing_name);
|
||||
@@ -474,17 +474,17 @@ static void callback(void *userdata, Uint8 *stream, int length) {
|
||||
c->playing_name = c->queued_name;
|
||||
c->playing_fadein = c->queued_fadein;
|
||||
c->playing_tight = c->queued_tight;
|
||||
|
||||
|
||||
c->queued = NULL;
|
||||
c->queued_name = NULL;
|
||||
c->queued_fadein = 0;
|
||||
c->queued_tight = 0;
|
||||
|
||||
UNLOCK_NAME();
|
||||
|
||||
|
||||
start_sample(c, ! old_tight);
|
||||
|
||||
continue;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,14 +508,14 @@ static int check_channel(int c) {
|
||||
|
||||
if (c >= num_channels) {
|
||||
channels = realloc(channels, sizeof(struct Channel) * (c + 1));
|
||||
|
||||
|
||||
for (i = num_channels; i <= c; i++) {
|
||||
|
||||
|
||||
channels[i].playing = NULL;
|
||||
channels[i].queued = NULL;
|
||||
channels[i].playing_name = NULL;
|
||||
channels[i].queued_name = NULL;
|
||||
channels[i].volume = SDL_MIX_MAXVOLUME;
|
||||
channels[i].volume = SDL_MIX_MAXVOLUME;
|
||||
channels[i].paused = 1;
|
||||
channels[i].event = 0;
|
||||
channels[i].pan_start = 0.0;
|
||||
@@ -530,7 +530,7 @@ static int check_channel(int c) {
|
||||
|
||||
num_channels = c + 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -540,16 +540,16 @@ static int check_channel(int c) {
|
||||
* failure.
|
||||
*/
|
||||
struct VideoState *load_sample(SDL_RWops *rw, const char *ext) {
|
||||
struct VideoState *rv;
|
||||
struct VideoState *rv;
|
||||
rv = ffpy_stream_open(rw, ext);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int fadein, int tight, int paused) {
|
||||
|
||||
BEGIN();
|
||||
|
||||
|
||||
struct Channel *c;
|
||||
|
||||
if (check_channel(channel)) {
|
||||
@@ -558,7 +558,7 @@ void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int f
|
||||
|
||||
c = &channels[channel];
|
||||
ENTER();
|
||||
|
||||
|
||||
LOCK_NAME();
|
||||
|
||||
/* Free playing and queued samples. */
|
||||
@@ -569,7 +569,7 @@ void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int f
|
||||
c->playing_name = NULL;
|
||||
c->playing_tight = 0;
|
||||
}
|
||||
|
||||
|
||||
if (c->queued) {
|
||||
free_sample(c->queued);
|
||||
c->queued = NULL;
|
||||
@@ -579,7 +579,7 @@ void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int f
|
||||
}
|
||||
|
||||
/* Allocate playing sample. */
|
||||
|
||||
|
||||
c->playing = load_sample(rw, ext);
|
||||
|
||||
if (! c->playing) {
|
||||
@@ -594,11 +594,11 @@ void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int f
|
||||
|
||||
c->playing_fadein = fadein;
|
||||
c->playing_tight = tight;
|
||||
|
||||
|
||||
c->paused = paused;
|
||||
start_sample(c, 1);
|
||||
start_sample(c, 1);
|
||||
/* update_pause(); */
|
||||
|
||||
|
||||
UNLOCK_NAME();
|
||||
|
||||
EXIT();
|
||||
@@ -608,7 +608,7 @@ void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int f
|
||||
void PSS_queue(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int fadein, int tight) {
|
||||
|
||||
BEGIN();
|
||||
|
||||
|
||||
struct Channel *c;
|
||||
|
||||
if (check_channel(channel)) {
|
||||
@@ -616,18 +616,18 @@ void PSS_queue(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int
|
||||
}
|
||||
|
||||
c = &channels[channel];
|
||||
|
||||
|
||||
ENTER();
|
||||
|
||||
/* If we're not playing, then we should play instead of queue. */
|
||||
if (!c->playing) {
|
||||
EXIT();
|
||||
PSS_play(channel, rw, ext, name, fadein, tight, 0);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Free queued sample. */
|
||||
|
||||
|
||||
if (c->queued) {
|
||||
free_sample(c->queued);
|
||||
c->queued = NULL;
|
||||
@@ -635,7 +635,7 @@ void PSS_queue(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int
|
||||
c->queued_name = NULL;
|
||||
c->queued_tight = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Allocate queued sample. */
|
||||
c->queued = load_sample(rw, ext);
|
||||
|
||||
@@ -649,11 +649,11 @@ void PSS_queue(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int
|
||||
c->queued_name = name;
|
||||
c->queued_fadein = fadein;
|
||||
c->queued_tight = tight;
|
||||
|
||||
|
||||
EXIT();
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Stops all music from playing, freeing the data used by the
|
||||
@@ -676,7 +676,7 @@ void PSS_stop(int channel) {
|
||||
if (c->playing) {
|
||||
post_event(c);
|
||||
}
|
||||
|
||||
|
||||
/* Free playing and queued samples. */
|
||||
if (c->playing) {
|
||||
free_sample(c->playing);
|
||||
@@ -684,18 +684,18 @@ void PSS_stop(int channel) {
|
||||
decref(c->playing_name);
|
||||
c->playing_name = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (c->queued) {
|
||||
free_sample(c->queued);
|
||||
c->queued = NULL;
|
||||
decref(c->queued_name);
|
||||
c->queued_name = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* update_pause(); */
|
||||
|
||||
UNLOCK_NAME();
|
||||
EXIT();
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
@@ -731,8 +731,8 @@ void PSS_dequeue(int channel, int even_tight) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
EXIT();
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
@@ -757,8 +757,8 @@ int PSS_queue_depth(int channel) {
|
||||
|
||||
if (c->playing) rv++;
|
||||
if (c->queued) rv++;
|
||||
|
||||
EXIT();
|
||||
|
||||
EXIT();
|
||||
error(SUCCESS);
|
||||
|
||||
return rv;
|
||||
@@ -767,7 +767,7 @@ int PSS_queue_depth(int channel) {
|
||||
PyObject *PSS_playing_name(int channel) {
|
||||
BEGIN();
|
||||
PyObject *rv;
|
||||
|
||||
|
||||
struct Channel *c;
|
||||
|
||||
if (check_channel(channel)) {
|
||||
@@ -795,7 +795,7 @@ PyObject *PSS_playing_name(int channel) {
|
||||
ALTEXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -826,7 +826,7 @@ void PSS_fadeout(int channel, int ms) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fade_steps = c->volume;
|
||||
c->fade_delta = -1;
|
||||
c->fade_off = 0;
|
||||
@@ -838,15 +838,15 @@ void PSS_fadeout(int channel, int ms) {
|
||||
} else {
|
||||
c->fade_step_len = 0;
|
||||
}
|
||||
|
||||
|
||||
c->stop_bytes = ms_to_bytes(ms);
|
||||
c->queued_tight = 0;
|
||||
|
||||
if (!c->queued) {
|
||||
c->playing_tight = 0;
|
||||
}
|
||||
|
||||
EXIT();
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
@@ -856,7 +856,7 @@ void PSS_fadeout(int channel, int ms) {
|
||||
*/
|
||||
void PSS_pause(int channel, int pause) {
|
||||
BEGIN();
|
||||
|
||||
|
||||
struct Channel *c;
|
||||
|
||||
if (check_channel(channel)) {
|
||||
@@ -872,13 +872,13 @@ void PSS_pause(int channel, int pause) {
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PSS_unpause_all(void) {
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
BEGIN();
|
||||
|
||||
ENTER();
|
||||
@@ -890,7 +890,7 @@ void PSS_unpause_all(void) {
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -901,7 +901,7 @@ int PSS_get_pos(int channel) {
|
||||
struct Channel *c;
|
||||
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return -1;
|
||||
}
|
||||
@@ -909,7 +909,7 @@ int PSS_get_pos(int channel) {
|
||||
c = &channels[channel];
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
if (c->playing) {
|
||||
rv = bytes_to_ms(c->pos);
|
||||
} else {
|
||||
@@ -917,7 +917,7 @@ int PSS_get_pos(int channel) {
|
||||
}
|
||||
|
||||
EXIT();
|
||||
|
||||
|
||||
error(SUCCESS);
|
||||
return rv;
|
||||
}
|
||||
@@ -929,7 +929,7 @@ int PSS_get_pos(int channel) {
|
||||
void PSS_set_endevent(int channel, int event) {
|
||||
struct Channel *c;
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return;
|
||||
}
|
||||
@@ -937,12 +937,12 @@ void PSS_set_endevent(int channel, int event) {
|
||||
c = &channels[channel];
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
c->event = event;
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -952,7 +952,7 @@ void PSS_set_endevent(int channel, int event) {
|
||||
void PSS_set_volume(int channel, float volume) {
|
||||
struct Channel *c;
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return;
|
||||
}
|
||||
@@ -960,12 +960,12 @@ void PSS_set_volume(int channel, float volume) {
|
||||
c = &channels[channel];
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
c->volume = (int) (volume * SDL_MIX_MAXVOLUME);
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -973,10 +973,10 @@ void PSS_set_volume(int channel, float volume) {
|
||||
float PSS_get_volume(int channel) {
|
||||
|
||||
float rv;
|
||||
|
||||
|
||||
struct Channel *c;
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return 0.0;
|
||||
}
|
||||
@@ -984,12 +984,12 @@ float PSS_get_volume(int channel) {
|
||||
c = &channels[channel];
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
rv = 1.0 * c->volume / SDL_MIX_MAXVOLUME;
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
error(SUCCESS);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1000,7 @@ float PSS_get_volume(int channel) {
|
||||
void PSS_set_pan(int channel, float pan, float delay) {
|
||||
struct Channel *c;
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return;
|
||||
}
|
||||
@@ -1008,15 +1008,15 @@ void PSS_set_pan(int channel, float pan, float delay) {
|
||||
c = &channels[channel];
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
c->pan_start = interpolate_pan(c);
|
||||
c->pan_end = pan;
|
||||
c->pan_length = (int) (audio_spec.freq * delay);
|
||||
c->pan_done = 0;
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1025,7 +1025,7 @@ void PSS_set_pan(int channel, float pan, float delay) {
|
||||
void PSS_set_secondary_volume(int channel, float vol2, float delay) {
|
||||
struct Channel *c;
|
||||
BEGIN();
|
||||
|
||||
|
||||
if (check_channel(channel)) {
|
||||
return;
|
||||
}
|
||||
@@ -1038,10 +1038,10 @@ void PSS_set_secondary_volume(int channel, float vol2, float delay) {
|
||||
c->vol2_end = vol2;
|
||||
c->vol2_length = (int) (audio_spec.freq * delay);
|
||||
c->vol2_done = 0;
|
||||
|
||||
|
||||
EXIT();
|
||||
|
||||
error(SUCCESS);
|
||||
|
||||
error(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -1064,12 +1064,12 @@ void PSS_init(int freq, int stereo, int samples, int status) {
|
||||
interp = thread->interp;
|
||||
thread = PyThreadState_New(interp);
|
||||
}
|
||||
|
||||
|
||||
if (!thread) {
|
||||
error(SDL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (SDL_Init(SDL_INIT_AUDIO)) {
|
||||
error(SDL_ERROR);
|
||||
return;
|
||||
@@ -1090,7 +1090,7 @@ void PSS_init(int freq, int stereo, int samples, int status) {
|
||||
ffpy_init(audio_spec.freq, status);
|
||||
|
||||
SDL_PauseAudio(0);
|
||||
|
||||
|
||||
initialized = 1;
|
||||
|
||||
error(SUCCESS);
|
||||
@@ -1102,7 +1102,7 @@ void PSS_quit() {
|
||||
if (! initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int i;
|
||||
|
||||
ENTER();
|
||||
@@ -1130,14 +1130,14 @@ void PSS_periodic() {
|
||||
}
|
||||
|
||||
ENTER();
|
||||
|
||||
|
||||
while (dying) {
|
||||
struct Dying *d = dying;
|
||||
ffpy_stream_close(d->stream);
|
||||
dying = d->next;
|
||||
free(d);
|
||||
}
|
||||
|
||||
|
||||
EXIT();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define PSS_H
|
||||
|
||||
#include <Python.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
void PSS_play(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int fadeout, int tight, int paused);
|
||||
void PSS_queue(int channel, SDL_RWops *rw, const char *ext, PyObject *name, int fadeout, int tight);
|
||||
|
||||
@@ -20,11 +20,13 @@
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
cdef extern from "pygame/pygame.h":
|
||||
cdef extern from "SDL.h":
|
||||
cdef struct SDL_RWops:
|
||||
pass
|
||||
|
||||
void import_pygame_rwobject()
|
||||
cdef extern from "pygame_sdl2/pygame_sdl2.rwobject_api.h":
|
||||
|
||||
void import_pygame_sdl2__rwobject()
|
||||
SDL_RWops* RWopsFromPythonThreaded(object obj)
|
||||
|
||||
cdef extern from "pss.h":
|
||||
@@ -187,4 +189,4 @@ def check_version(version):
|
||||
if version < 2 or version > 4:
|
||||
raise Exception("pysdlsound version mismatch.")
|
||||
|
||||
import_pygame_rwobject()
|
||||
import_pygame_sdl2__rwobject()
|
||||
|
||||
+4
-3
@@ -2,9 +2,10 @@
|
||||
#define RENPY_H
|
||||
|
||||
#include <Python.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL.h>
|
||||
|
||||
void core_init(void);
|
||||
void subpixel_init(void);
|
||||
|
||||
void save_png_core(PyObject *pysurf, SDL_RWops *file, int compress);
|
||||
|
||||
@@ -62,7 +63,7 @@ void alphamunge_core(PyObject *pysrc,
|
||||
int src_aoff, // alpha offset.
|
||||
int dst_aoff, // alpha offset.
|
||||
char *amap);
|
||||
|
||||
|
||||
/* int stretch_core(PyObject *pysrc, */
|
||||
/* PyObject *pydst, */
|
||||
/* int x, */
|
||||
@@ -114,4 +115,4 @@ int subpixel32(
|
||||
float xoffset, float yoffset, int ashift);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -65,7 +65,7 @@ else:
|
||||
|
||||
include("zlib.h")
|
||||
include("png.h")
|
||||
include("SDL.h", directory="SDL")
|
||||
include("SDL.h", directory="SDL2")
|
||||
include("ft2build.h")
|
||||
include("freetype/freetype.h", directory="freetype2", optional=True) or include("freetype.h", directory="freetype2")
|
||||
include("libavutil/avstring.h")
|
||||
@@ -74,7 +74,7 @@ include("libavcodec/avcodec.h")
|
||||
include("libswscale/swscale.h")
|
||||
include("GL/glew.h")
|
||||
|
||||
library("SDL")
|
||||
library("SDL2")
|
||||
library("png")
|
||||
library("avformat")
|
||||
library("avcodec")
|
||||
@@ -91,7 +91,7 @@ has_angle = windows and library("EGL", optional=True) and library("GLESv2", opti
|
||||
if android:
|
||||
sdl = [ 'sdl', 'GLESv2', 'log' ]
|
||||
else:
|
||||
sdl = [ 'SDL' ]
|
||||
sdl = [ 'SDL2' ]
|
||||
|
||||
if has_fribidi:
|
||||
try:
|
||||
|
||||
+41
-35
@@ -7,15 +7,21 @@
|
||||
*/
|
||||
|
||||
#include "renpy.h"
|
||||
#include <pygame/pygame.h>
|
||||
#include <SDL.h>
|
||||
#include <pygame_sdl2/pygame_sdl2.surface_api.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
void subpixel_init() {
|
||||
import_pygame_sdl2__surface();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
#define GCC_MMX 1
|
||||
#include "mmx.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* MMX Register assignments (between applications of the blitter core).
|
||||
*
|
||||
* mm0 - new row 0
|
||||
@@ -33,7 +39,7 @@
|
||||
* This is the basic algorithm that does the subpixel blit
|
||||
* interpolation.
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
/* mm2 = destination; */
|
||||
|
||||
/* unpack mm0; */
|
||||
@@ -83,8 +89,8 @@
|
||||
#define MMX_EXPAND() \
|
||||
pxor_r2r(mm2, mm2); \
|
||||
punpcklbw_r2r(mm2, mm4); \
|
||||
punpcklbw_r2r(mm2, mm5);
|
||||
|
||||
punpcklbw_r2r(mm2, mm5);
|
||||
|
||||
|
||||
// This expects the two old pixels to be arranged like:
|
||||
// mm4 mm0
|
||||
@@ -140,7 +146,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
float xoffset, float yoffset, int ashift) {
|
||||
SDL_Surface *src;
|
||||
SDL_Surface *dst;
|
||||
|
||||
|
||||
int srcpitch, dstpitch;
|
||||
int srcw, srch;
|
||||
int dstw, dsth;
|
||||
@@ -148,7 +154,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
unsigned char *dstpixels;
|
||||
|
||||
int xfrac, yfrac;
|
||||
int xo, yo;
|
||||
int xo, yo;
|
||||
int sx, sy;
|
||||
|
||||
int draw_finalx;
|
||||
@@ -158,7 +164,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
unsigned int pixel;
|
||||
unsigned int blankpixel;
|
||||
|
||||
|
||||
unsigned char *s0;
|
||||
unsigned char *s1;
|
||||
unsigned char *d;
|
||||
@@ -170,12 +176,12 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
if (!SDL_HasMMX()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
src = PySurface_AsSurface(pysrc);
|
||||
dst = PySurface_AsSurface(pydst);
|
||||
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
|
||||
|
||||
srcpixels = (unsigned char *) src->pixels;
|
||||
dstpixels = (unsigned char *) dst->pixels;
|
||||
srcpitch = src->pitch;
|
||||
@@ -186,7 +192,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
dsth = dst->h;
|
||||
|
||||
inverted_alpha_mask = ~(0xff << ashift);
|
||||
|
||||
|
||||
// Due to mmx.
|
||||
ashift *= 2;
|
||||
|
||||
@@ -216,7 +222,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
if (sx >= srcw - 1 || sy >= srch - 1) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
// Figure out how many pixels we need to draw on each line.
|
||||
normal_pixels = min(srcw - sx - 1, dstw - xo);
|
||||
|
||||
@@ -236,7 +242,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
punpckldq_r2r(mm7, mm7);
|
||||
|
||||
movd_m2r(ashift, mm3);
|
||||
|
||||
|
||||
if (xo >= dstw) {
|
||||
goto done;
|
||||
}
|
||||
@@ -244,27 +250,27 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
// Draw the first line, when sy == -1.
|
||||
|
||||
if (sy == -1) {
|
||||
|
||||
|
||||
if (yo >= dsth) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
s1 = srcpixels + sx * 4;
|
||||
|
||||
|
||||
if (sx < 0) {
|
||||
pixel = (* (unsigned int *) (s1 + 4)) & inverted_alpha_mask;
|
||||
pixel = (* (unsigned int *) (s1 + 4)) & inverted_alpha_mask;
|
||||
} else {
|
||||
pixel = * (unsigned int *) s1;
|
||||
}
|
||||
|
||||
blankpixel = pixel & inverted_alpha_mask;
|
||||
|
||||
|
||||
movd_m2r(blankpixel, mm4);
|
||||
movd_m2r(pixel, mm5);
|
||||
|
||||
MMX_EXPAND();
|
||||
s1 += 4;
|
||||
|
||||
|
||||
d = dstpixels + xo * 4 + yo * dstpitch;
|
||||
dend = d + normal_pixels * 4;
|
||||
|
||||
@@ -272,7 +278,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
pixel = * (unsigned int *) s1;
|
||||
blankpixel = pixel & inverted_alpha_mask;
|
||||
movd_m2r(blankpixel, mm0);
|
||||
movd_m2r(pixel, mm1);
|
||||
movd_m2r(pixel, mm1);
|
||||
MMX_INTERP(* (unsigned int *) d);
|
||||
d += 4;
|
||||
s1 += 4;
|
||||
@@ -300,7 +306,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
|
||||
s0 = srcpixels + sx * 4 + (srcpitch * sy);
|
||||
s1 = srcpixels + sx * 4 + (srcpitch * (sy + 1));
|
||||
|
||||
|
||||
if (sx < 0) {
|
||||
blankpixel = (* (unsigned int *) (s0 + 4)) & inverted_alpha_mask;
|
||||
movd_m2r(blankpixel, mm4);
|
||||
@@ -314,20 +320,20 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
}
|
||||
|
||||
MMX_EXPAND();
|
||||
|
||||
|
||||
s0 += 4;
|
||||
s1 += 4;
|
||||
|
||||
|
||||
d = dstpixels + xo * 4 + yo * dstpitch;
|
||||
dend = d + normal_pixels * 4;
|
||||
|
||||
unsigned char *dp = d;
|
||||
|
||||
|
||||
while (d != dend) {
|
||||
movd_m2r(* (unsigned int *) s0, mm0);
|
||||
movd_m2r(* (unsigned int *) s1, mm1);
|
||||
movd_m2r(* (unsigned int *) s0, mm0);
|
||||
movd_m2r(* (unsigned int *) s1, mm1);
|
||||
MMX_INTERP(* (unsigned int *) d);
|
||||
|
||||
|
||||
d += 4;
|
||||
s0 += 4;
|
||||
s1 += 4;
|
||||
@@ -350,7 +356,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
}
|
||||
|
||||
// The final part, where we handle the bottom line of the source surface.
|
||||
|
||||
|
||||
if (yo >= dsth) {
|
||||
goto done;
|
||||
}
|
||||
@@ -360,29 +366,29 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
if (sx < 0) {
|
||||
pixel = * (unsigned int *) (s0 + 4);
|
||||
blankpixel = pixel & inverted_alpha_mask;
|
||||
|
||||
|
||||
movd_m2r(blankpixel, mm4);
|
||||
movd_m2r(blankpixel, mm5);
|
||||
} else {
|
||||
pixel = * (unsigned int *) s0;
|
||||
blankpixel = pixel & inverted_alpha_mask;
|
||||
|
||||
|
||||
movd_m2r(pixel, mm4);
|
||||
movd_m2r(blankpixel, mm5);
|
||||
}
|
||||
|
||||
MMX_EXPAND();
|
||||
|
||||
|
||||
s0 += 4;
|
||||
|
||||
|
||||
d = dstpixels + xo * 4 + yo * dstpitch;
|
||||
dend = d + normal_pixels * 4;
|
||||
|
||||
while (d != dend) {
|
||||
pixel = * (unsigned int *) s0;
|
||||
blankpixel = pixel & inverted_alpha_mask;
|
||||
|
||||
movd_m2r(pixel, mm0);
|
||||
|
||||
movd_m2r(pixel, mm0);
|
||||
movd_m2r(blankpixel, mm1);
|
||||
MMX_INTERP(* (unsigned int *) d);
|
||||
d += 4;
|
||||
@@ -395,7 +401,7 @@ int subpixel32(PyObject *pysrc, PyObject *pydst,
|
||||
MMX_INTERP(* (unsigned int *) d);
|
||||
}
|
||||
|
||||
|
||||
|
||||
done:
|
||||
|
||||
// Reset the MMX unit and call it a night.
|
||||
@@ -403,7 +409,7 @@ done:
|
||||
|
||||
Py_END_ALLOW_THREADS
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,6 +225,8 @@ def bootstrap(renpy_base):
|
||||
if renpy.macintosh:
|
||||
os.startfile = mac_start
|
||||
|
||||
import pygame_sdl2
|
||||
pygame_sdl2.import_as_pygame()
|
||||
|
||||
# Check that we have installed pygame properly. This also deals with
|
||||
# weird cases on Windows and Linux where we can't import modules. (On
|
||||
|
||||
@@ -30,29 +30,30 @@ from renpy.display.core import absolute
|
||||
# Surface copying
|
||||
################################################################################
|
||||
|
||||
from pygame cimport *
|
||||
|
||||
def nogil_copy(src, dest):
|
||||
"""
|
||||
Does a gil-less blit of src to dest, with minimal locking.
|
||||
"""
|
||||
|
||||
cdef SDL_Surface *src_surf
|
||||
cdef SDL_Surface *dst_surf
|
||||
dest.blit(src, (0, 0))
|
||||
|
||||
src_surf = PySurface_AsSurface(src)
|
||||
dest_surf = PySurface_AsSurface(dest)
|
||||
|
||||
old_alpha = src_surf.flags & SDL_SRCALPHA
|
||||
|
||||
if old_alpha:
|
||||
SDL_SetAlpha(src_surf, 0, 255)
|
||||
|
||||
with nogil:
|
||||
SDL_BlitSurface(src_surf, NULL, dest_surf, NULL)
|
||||
|
||||
if old_alpha:
|
||||
SDL_SetAlpha(src_surf, SDL_SRCALPHA, 255)
|
||||
# cdef SDL_Surface *src_surf
|
||||
# cdef SDL_Surface *dst_surf
|
||||
#
|
||||
# src_surf = PySurface_AsSurface(src)
|
||||
# dest_surf = PySurface_AsSurface(dest)
|
||||
#
|
||||
# old_alpha = src_surf.flags & SDL_SRCALPHA
|
||||
#
|
||||
# if old_alpha:
|
||||
# SDL_SetSurfaceAlpha(src_surf, 0, 255)
|
||||
#
|
||||
# with nogil:
|
||||
# SDL_BlitSurface(src_surf, NULL, dest_surf, NULL)
|
||||
#
|
||||
# if old_alpha:
|
||||
# SDL_SetAlpha(src_surf, SDL_SRCALPHA, 255)
|
||||
|
||||
################################################################################
|
||||
# Transform render function
|
||||
|
||||
+5
-1
@@ -24,9 +24,12 @@
|
||||
DEF ANGLE = False
|
||||
|
||||
from libc.stdlib cimport malloc, free
|
||||
from pygame cimport *
|
||||
from sdl2 cimport *
|
||||
from gl cimport *
|
||||
|
||||
from pygame_sdl2 cimport *
|
||||
import_pygame_sdl2__surface()
|
||||
|
||||
import renpy
|
||||
import pygame
|
||||
import os
|
||||
@@ -40,6 +43,7 @@ cimport gltexture
|
||||
import gltexture
|
||||
import glblacklist
|
||||
|
||||
|
||||
cdef extern from "glcompat.h":
|
||||
GLenum glewInit()
|
||||
GLubyte *glewGetErrorString(GLenum)
|
||||
|
||||
@@ -25,7 +25,10 @@ DEF ANGLE = False
|
||||
|
||||
from gl cimport *
|
||||
from gldraw cimport *
|
||||
from pygame cimport *
|
||||
|
||||
from sdl2 cimport *
|
||||
from pygame_sdl2 cimport *
|
||||
import_pygame_sdl2__surface()
|
||||
|
||||
from cpython.string cimport PyString_FromStringAndSize
|
||||
from libc.stdlib cimport calloc, free
|
||||
@@ -1112,7 +1115,9 @@ def premultiply(
|
||||
cdef unsigned char *out = rv
|
||||
|
||||
# The pixels in the source image.
|
||||
cdef unsigned char *pixels, *pixels_end
|
||||
cdef unsigned char *pixels
|
||||
cdef unsigned char *pixels_end
|
||||
|
||||
cdef SDL_Surface *surf
|
||||
|
||||
# Pointer to the current pixel.
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
from pygame cimport *
|
||||
from sdl2 cimport *
|
||||
from pygame_sdl2 cimport *
|
||||
import_pygame_sdl2__surface()
|
||||
|
||||
from freetype cimport *
|
||||
from ttgsubtable cimport *
|
||||
from textsupport cimport Glyph, SPLIT_INSTEAD
|
||||
|
||||
Reference in New Issue
Block a user