src/video/SDL_stretch.c
branchSDL-1.2
changeset 4355 9b464226e541
parent 4159 a1b03ba2fcd0
child 4356 ab2dfac9d5c1
equal deleted inserted replaced
4354:1e191391e68d 4355:9b464226e541
   101 		break;
   101 		break;
   102 	    default:
   102 	    default:
   103 		SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
   103 		SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp);
   104 		return(-1);
   104 		return(-1);
   105 	}
   105 	}
       
   106 #ifdef HAVE_MPROTECT
       
   107 	/* Make the code writeable */
       
   108 	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_WRITE) < 0 ) {
       
   109 		SDL_SetError("Couldn't make copy buffer writeable");
       
   110 		return(-1);
       
   111 	}
       
   112 #endif
   106 	pos = 0x10000;
   113 	pos = 0x10000;
   107 	inc = (src_w << 16) / dst_w;
   114 	inc = (src_w << 16) / dst_w;
   108 	eip = copy_row;
   115 	eip = copy_row;
   109 	for ( i=0; i<dst_w; ++i ) {
   116 	for ( i=0; i<dst_w; ++i ) {
   110 		while ( pos >= 0x10000L ) {
   117 		while ( pos >= 0x10000L ) {
   126 	if ( eip > (copy_row+sizeof(copy_row)) ) {
   133 	if ( eip > (copy_row+sizeof(copy_row)) ) {
   127 		SDL_SetError("Copy buffer overflow");
   134 		SDL_SetError("Copy buffer overflow");
   128 		return(-1);
   135 		return(-1);
   129 	}
   136 	}
   130 #ifdef HAVE_MPROTECT
   137 #ifdef HAVE_MPROTECT
   131 	/* Make the code executable */
   138 	/* Make the code executable but not writeable */
   132 	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_WRITE|PROT_EXEC) < 0 ) {
   139 	if ( mprotect(copy_row, sizeof(copy_row), PROT_READ|PROT_EXEC) < 0 ) {
   133 		SDL_SetError("Couldn't make copy buffer executable");
   140 		SDL_SetError("Couldn't make copy buffer executable");
   134 		return(-1);
   141 		return(-1);
   135 	}
   142 	}
   136 #endif
   143 #endif
   137 	last.status = 0;
   144 	last.status = 0;