//A appeler une fois terminé void oslUnlockImage(OSL_IMAGE *img) { // if (img->location == OSL_IN_RAM) oslUncacheImage(img); //Texture courante? if (img->data == osl_curTexture) osl_curTexture = NULL; //Avec OpenGL, on recopie le contenu de l'image (modifiée) vers le framebuffer #ifndef PSP if (img == osl_curBuf) { //On doit désactiver (temporairement) le texturage 2D int bTextureEnabled = glIsEnabled(GL_TEXTURE_2D), bBlendingEnabled = glIsEnabled(GL_BLEND); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); //Lit les données du backbuffer dans l'image utilisée jusque là comme drawbuffer glRasterPos2i(0, 0); glPixelZoom(1, -1); glDrawPixels(img->sysSizeX, img->sizeY, GL_RGBA, emu_pixelPhysFormats[img->pixelFormat], img->data); //Réactive si jamais if (bTextureEnabled) glEnable(GL_TEXTURE_2D); if (bBlendingEnabled) glEnable(GL_BLEND); } #endif }
static PyObject* image_uncache(PyImage *self, PyObject *args, PyObject *kwargs) { if (!PyArg_ParseTuple(args, ":uncache")) return NULL; oslUncacheImage(self->pImg); Py_INCREF(Py_None); return Py_None; }
static OSL_IMAGE *logoCreeImageFond() { OSL_IMAGE *fond; unsigned char *data; int i, j; fond = oslCreateImage(480, 272, OSL_IN_RAM, OSL_PF_8BIT); if (!fond) return 0; fond->palette = oslCreatePalette(256, OSL_PF_8888); if (!fond->palette) { oslDeleteImage(fond); return 0; } for (j=0;j<HEIGHT;j++) { data = (unsigned char*)oslGetImageLine(fond, j); for (i=0;i<WIDTH/2;i++) { *data++ = i; *data++ = i; } } oslUncacheImage(fond); return fond; }