1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-09-28 11:17:47 +00:00

Indentation work. No actual code changes.

This commit is contained in:
FellippeHeitor 2018-06-30 12:16:59 -03:00
parent 729a1dd465
commit 12df99c8da
28 changed files with 31845 additions and 31845 deletions

View file

@ -16,101 +16,101 @@
#endif
#ifndef INC_COMMON_CPP
#define INC_COMMON_CPP
#include "os.h"
#define INC_COMMON_CPP
#include "os.h"
#define QB64_GL1
#define QB64_GLUT
#define QB64_GL1
#define QB64_GLUT
#ifdef DEPENDENCY_CONSOLE_ONLY
#ifdef DEPENDENCY_CONSOLE_ONLY
#undef QB64_GLUT
#else
#else
#define QB64_GUI
#endif
#endif
//core
#ifdef QB64_GUI
#ifdef QB64_GLUT
//This file only contains header stuff
#include "parts/core/src.c"
#endif
#endif
//core
#ifdef QB64_GUI
#ifdef QB64_GLUT
//This file only contains header stuff
#include "parts/core/src.c"
#endif
#endif
#ifdef QB64_WINDOWS
#ifdef QB64_WINDOWS
#ifndef QB64_GUI
#ifndef QB64_GUI
#undef int64 //definition of int64 from os.h conflicts with a definition within windows.h, temporarily undefine then redefine
#include <windows.h>
#define int64 __int64
#endif
#endif
#include <shfolder.h>
#include <shfolder.h>
#include <float.h>
#include <winbase.h>
#include <float.h>
#include <winbase.h>
#endif
#endif
//common includes
#include <stdio.h>
#ifdef QB64_MACOSX
//common includes
#include <stdio.h>
#ifdef QB64_MACOSX
#include <cmath>
#else
#else
//#include <math.h> //<-causes overloading abs conflicts in Windows
#include <cmath>
#endif
#include <time.h>
#include <iostream>
#include <fstream>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#endif
#include <time.h>
#include <iostream>
#include <fstream>
#include <time.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
//OS/compiler specific includes
#ifdef QB64_WINDOWS
#include <direct.h>
#ifdef DEPENDENCY_PRINTER
//OS/compiler specific includes
#ifdef QB64_WINDOWS
#include <direct.h>
#ifdef DEPENDENCY_PRINTER
#include <winspool.h>
#endif
#include <csignal>
#include <process.h> //required for multi-threading
#if defined DEPENDENCY_AUDIO_OUT || defined QB64_GUI
#endif
#include <csignal>
#include <process.h> //required for multi-threading
#if defined DEPENDENCY_AUDIO_OUT || defined QB64_GUI
#include <mmsystem.h>
#endif
#endif
#else
#else
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdint.h>
#include <pthread.h>
#ifndef QB64_MACOSX
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdint.h>
#include <pthread.h>
#ifndef QB64_MACOSX
#include <dlfcn.h>
#endif
#endif
#endif
#endif
#ifdef QB64_GUI
#ifdef QB64_GLUT
#include "parts/core/gl_headers/opengl_org_registery/glext.h"
#endif
#endif
#ifdef QB64_GUI
#ifdef QB64_GLUT
#include "parts/core/gl_headers/opengl_org_registery/glext.h"
#endif
#endif
using namespace std;
using namespace std;
//QB64 string descriptor structure
struct qbs_field{
//QB64 string descriptor structure
struct qbs_field{
int32 fileno;
int64 fileid;
int64 size;
int64 offset;
};
};
struct qbs{
struct qbs{
uint8 *chr;//a 32 bit pointer to the string's data
int32 len;//must be signed for comparisons against signed int32s
uint8 in_cmem;//set to 1 if in the conventional memory DBLOCK
@ -122,9 +122,9 @@ struct qbs{
uint8 fixed;//fixed length string
uint8 readonly;//set to 1 if string is read only
qbs_field *field;
};
};
struct img_struct{
struct img_struct{
void *lock_offset;
int64 lock_id;
uint8 valid;//0,1 0=invalid
@ -164,23 +164,23 @@ struct img_struct{
double draw_scale;
uint8 apm_p2;
//END apm
};
//img_struct flags
#define IMG_FREEPAL 1 //free palette data before freeing image
#define IMG_SCREEN 2 //img is linked to other screen pages
#define IMG_FREEMEM 4 //if set, it means memory must be freed
};
//img_struct flags
#define IMG_FREEPAL 1 //free palette data before freeing image
#define IMG_SCREEN 2 //img is linked to other screen pages
#define IMG_FREEMEM 4 //if set, it means memory must be freed
//QB64 internal variable type flags (internally referenced by some C functions)
#define ISSTRING 1073741824
#define ISFLOAT 536870912
#define ISUNSIGNED 268435456
#define ISPOINTER 134217728
#define ISFIXEDLENGTH 67108864 //only set for strings with pointer flag
#define ISINCONVENTIONALMEMORY 33554432
#define ISOFFSETINBITS 16777216
//QB64 internal variable type flags (internally referenced by some C functions)
#define ISSTRING 1073741824
#define ISFLOAT 536870912
#define ISUNSIGNED 268435456
#define ISPOINTER 134217728
#define ISFIXEDLENGTH 67108864 //only set for strings with pointer flag
#define ISINCONVENTIONALMEMORY 33554432
#define ISOFFSETINBITS 16777216
struct ontimer_struct{
struct ontimer_struct{
uint8 allocated;
uint32 id;//the event ID to trigger (0=no event)
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
@ -188,9 +188,9 @@ struct ontimer_struct{
uint8 state;//0=untriggered,1=triggered
double seconds;//how many seconds between events
double last_time;//the last time this event was triggered
};
};
struct onkey_struct{
struct onkey_struct{
uint32 id;//the event ID to trigger (0=no event)
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
uint8 active;//0=OFF, 1=ON, 2=STOP
@ -203,22 +203,22 @@ struct onkey_struct{
//0 No keyboard flag, 1-3 Either Shift key, 4 Ctrl key, 8 Alt key,32 NumLock key,64 Caps Lock key, 128 Extended keys on a 101-key keyboard
//To specify multiple shift states, add the values together. For example, a value of 12 specifies that the user-defined key is used in combination with the Ctrl and Alt keys.
qbs *text;
};
};
struct onstrig_struct{
struct onstrig_struct{
uint32 id;//the event ID to trigger (0=no event)
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
uint8 active;//0=OFF, 1=ON, 2=STOP
uint8 state;//0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
};
};
struct byte_element_struct
{
struct byte_element_struct
{
uint64 offset;
int32 length;
};
};
struct device_struct{
struct device_struct{
int32 used;
int32 type;
//0=Unallocated
@ -247,15 +247,15 @@ struct device_struct{
int32 axes;
int32 balls;
int32 hats;
};
};
//device_struct constants
#define QUEUED_EVENTS_LIMIT 1024
#define DEVICETYPE_CONTROLLER 1
#define DEVICETYPE_KEYBOARD 2
#define DEVICETYPE_MOUSE 3
//device_struct constants
#define QUEUED_EVENTS_LIMIT 1024
#define DEVICETYPE_CONTROLLER 1
#define DEVICETYPE_KEYBOARD 2
#define DEVICETYPE_MOUSE 3
struct mem_block{
struct mem_block{
ptrszint offset;
ptrszint size;
int64 lock_id;//64-bit key, must be present at lock's offset or memory region is invalid
@ -270,8 +270,8 @@ struct mem_block{
*/
ptrszint elementsize;
int32 image;
};
struct mem_lock{
};
struct mem_lock{
uint64 id;
int32 type;//required to know what action to take (if any) when a request is made to free the block
//0=no security (eg. user defined block from _OFFSET)
@ -281,6 +281,6 @@ struct mem_lock{
//4=array
//---- type specific variables follow ----
void *offset;//used by malloc'ed blocks to free them
};
};
#endif //INC_COMMON_CPP

File diff suppressed because it is too large Load diff

View file

@ -1,71 +1,71 @@
#ifndef INC_LIBQB_H
#define INC_LIBQB_H
#include "common.h"
#define INC_LIBQB_H
#include "common.h"
void error(int32 error_number);
extern uint32 new_error;
extern uint32 error_err; //=0;
extern double error_erl; //=0;
extern uint32 error_occurred;
extern uint32 error_goto_line;
extern uint32 error_handling;
extern uint32 error_retry;
void error(int32 error_number);
extern uint32 new_error;
extern uint32 error_err; //=0;
extern double error_erl; //=0;
extern uint32 error_occurred;
extern uint32 error_goto_line;
extern uint32 error_handling;
extern uint32 error_retry;
void sub_shell4(qbs*,int32);//_DONTWAIT & _HIDE
int32 func__source();
int32 func_pos(int32 ignore);
void sub__printimage(int32 i);
double func_timer(double accuracy,int32 passed);
int32 func__newimage(int32 x,int32 y,int32 bpp,int32 passed);
void display();
void validatepage(int32);
void sub__dest(int32);
void sub__source(int32);
int32 func__printwidth(qbs*,int32,int32);
void sub_cls(int32,uint32,int32);
void qbs_print(qbs*,int32);
int32 func__copyimage(int32 i,int32 mode,int32 passed);
int32 func__dest();
int32 func__display();
void qbg_sub_view_print(int32,int32,int32);
qbs *qbs_new(int32,uint8);
qbs *qbs_new_txt(const char*);
qbs *qbs_add(qbs*,qbs*);
qbs *qbs_set(qbs*,qbs*);
void qbg_sub_window(float,float,float,float,int32);
extern int32 autodisplay;
//GFS forward references
int32 gfs_eof_passed(int32 i);
int32 gfs_eof_reached(int32 i);
int64 gfs_getpos(int32 i);
int32 gfs_fileno_valid(int32 f);
int32 gfs_fileno_freefile();//like FREEFILE
void gfs_fileno_use(int32 f, int32 i);
int32 gfs_open(qbs *filename,int32 access,int32 restrictions, int32 how);
int32 gfs_close(int32 i);
int64 gfs_lof(int32 i);
int32 gfs_setpos(int32 i, int64 position);
int32 gfs_write(int32 i,int64 position,uint8 *data,int64 size);
int32 gfs_read(int32 i,int64 position,uint8 *data,int64 size);
int64 gfs_read_bytes();
void sub_shell4(qbs*,int32);//_DONTWAIT & _HIDE
int32 func__source();
int32 func_pos(int32 ignore);
void sub__printimage(int32 i);
double func_timer(double accuracy,int32 passed);
int32 func__newimage(int32 x,int32 y,int32 bpp,int32 passed);
void display();
void validatepage(int32);
void sub__dest(int32);
void sub__source(int32);
int32 func__printwidth(qbs*,int32,int32);
void sub_cls(int32,uint32,int32);
void qbs_print(qbs*,int32);
int32 func__copyimage(int32 i,int32 mode,int32 passed);
int32 func__dest();
int32 func__display();
void qbg_sub_view_print(int32,int32,int32);
qbs *qbs_new(int32,uint8);
qbs *qbs_new_txt(const char*);
qbs *qbs_add(qbs*,qbs*);
qbs *qbs_set(qbs*,qbs*);
void qbg_sub_window(float,float,float,float,int32);
extern int32 autodisplay;
//GFS forward references
int32 gfs_eof_passed(int32 i);
int32 gfs_eof_reached(int32 i);
int64 gfs_getpos(int32 i);
int32 gfs_fileno_valid(int32 f);
int32 gfs_fileno_freefile();//like FREEFILE
void gfs_fileno_use(int32 f, int32 i);
int32 gfs_open(qbs *filename,int32 access,int32 restrictions, int32 how);
int32 gfs_close(int32 i);
int64 gfs_lof(int32 i);
int32 gfs_setpos(int32 i, int64 position);
int32 gfs_write(int32 i,int64 position,uint8 *data,int64 size);
int32 gfs_read(int32 i,int64 position,uint8 *data,int64 size);
int64 gfs_read_bytes();
extern uint8 cmem[1114099];//16*65535+65535+3 (enough for highest referencable dword in conv memory)
extern uint8 cmem[1114099];//16*65535+65535+3 (enough for highest referencable dword in conv memory)
//keyhit cyclic buffer
extern int64 keyhit[8192];
// keyhit specific internal flags: (stored in high 32-bits)
// &4294967296->numpad was used
extern int32 keyhit_nextfree;
extern int32 keyhit_next;
//note: if full, the oldest message is discarded to make way for the new message
//keyhit cyclic buffer
extern int64 keyhit[8192];
// keyhit specific internal flags: (stored in high 32-bits)
// &4294967296->numpad was used
extern int32 keyhit_nextfree;
extern int32 keyhit_next;
//note: if full, the oldest message is discarded to make way for the new message
extern uint8 port60h_event[256];
extern int32 port60h_events;
extern uint8 port60h_event[256];
extern int32 port60h_events;
extern int32 window_exists;
extern int32 no_control_characters2;
extern int32 window_exists;
extern int32 no_control_characters2;
extern qbs *qbs_lcase(qbs *str);
extern qbs *qbs_ucase(qbs *str);
extern qbs *qbs_lcase(qbs *str);
extern qbs *qbs_ucase(qbs *str);
#endif

View file

@ -1,12 +1,12 @@
int32 displayorder_screen=1;
int32 displayorder_hardware=2;
int32 displayorder_glrender=3;
int32 displayorder_hardware1=4;
int32 displayorder_screen=1;
int32 displayorder_hardware=2;
int32 displayorder_glrender=3;
int32 displayorder_hardware1=4;
//sub__displayorder( 1 , 2 , 4 , 3 );
//id.specialformat = "[{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}]]]]"
void sub__displayorder(int32 method1,int32 method2,int32 method3,int32 method4){
//sub__displayorder( 1 , 2 , 4 , 3 );
//id.specialformat = "[{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}[,{_SCREEN|_HARDWARE|_HARDWARE1|_GLRENDER}]]]]"
void sub__displayorder(int32 method1,int32 method2,int32 method3,int32 method4){
//check no value has been used twice
if (method1!=0) if (method1==method2||method1==method3||method1==method4){error(5); return;}
@ -28,15 +28,15 @@
if (method==3) displayorder_hardware1=i;
if (method==4) displayorder_glrender=i;
}
}
}
//int32 gl_render_method=2; //1=behind, 2=ontop[default], 3=only
void sub__glrender(int32 method){
//int32 gl_render_method=2; //1=behind, 2=ontop[default], 3=only
void sub__glrender(int32 method){
//gl_render_method=method;
if (method==1) sub__displayorder(4,1,2,3);
if (method==2) sub__displayorder(1,2,4,3);
if (method==3) sub__displayorder(4,0,0,0);
}
}
#ifndef QB64_GUI //begin stubs
@ -44,7 +44,7 @@
#else //end stubs
#else //end stubs
@ -68,9 +68,9 @@
//displaycall is the window of time to update our display
#ifdef DEPENDENCY_GL
#ifdef DEPENDENCY_GL
extern void SUB__GL();
#endif
#endif
@ -80,8 +80,8 @@
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
#define GL_BGR 0x80E0
#define GL_BGRA 0x80E1
@ -118,9 +118,9 @@
GLuint texture=(GLuint)hardware_img->texture_handle;
glDeleteTextures(1, &texture);
//test reasset of hardware+img
//hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,handle);
//if (hardware_img==NULL) alert("free_hardware_img: image does not exist");
//test reasset of hardware+img
//hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,handle);
//if (hardware_img==NULL) alert("free_hardware_img: image does not exist");
//if image has not been used, it may still have buffered pixel content
@ -331,15 +331,15 @@
float *hardware_buffer_vertices=(float*)malloc(sizeof(float)*1);
int32 hardware_buffer_vertices_max=1;
int32 hardware_buffer_vertices_count=0;
float *hardware_buffer_vertices=(float*)malloc(sizeof(float)*1);
int32 hardware_buffer_vertices_max=1;
int32 hardware_buffer_vertices_count=0;
float *hardware_buffer_texcoords=(float*)malloc(sizeof(float)*1);
int32 hardware_buffer_texcoords_max=1;
int32 hardware_buffer_texcoords_count=0;
float *hardware_buffer_texcoords=(float*)malloc(sizeof(float)*1);
int32 hardware_buffer_texcoords_max=1;
int32 hardware_buffer_texcoords_count=0;
void hardware_buffer_flush(){
void hardware_buffer_flush(){
if (hardware_buffer_vertices_count){
//ref: http://stackoverflow.com/questions/5009014/draw-square-with-opengl-es-for-ios
if (hardware_buffer_vertices_count==hardware_buffer_texcoords_count){
@ -354,67 +354,67 @@ void hardware_buffer_flush(){
hardware_buffer_vertices_count=0;
hardware_buffer_texcoords_count=0;
}
}
}
void set_smooth(int32 new_mode_shrunk,int32 new_mode_stretched){
static int32 current_mode_shrunk;
current_mode_shrunk=render_state.source->smooth_shrunk;
static int32 current_mode_stretched;
current_mode_stretched=render_state.source->smooth_stretched;
if (new_mode_shrunk==current_mode_shrunk&&new_mode_stretched==current_mode_stretched) return;
hardware_buffer_flush();
if (new_mode_shrunk==SMOOTH_MODE__DONT_SMOOTH){
void set_smooth(int32 new_mode_shrunk,int32 new_mode_stretched){
static int32 current_mode_shrunk;
current_mode_shrunk=render_state.source->smooth_shrunk;
static int32 current_mode_stretched;
current_mode_stretched=render_state.source->smooth_stretched;
if (new_mode_shrunk==current_mode_shrunk&&new_mode_stretched==current_mode_stretched) return;
hardware_buffer_flush();
if (new_mode_shrunk==SMOOTH_MODE__DONT_SMOOTH){
if (render_state.source->PO2_fix==PO2_FIX__MIPMAPPED){
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}else{
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);//Use _MAPTRIANGLE's _SMOOTHSHRUNK to apply linear filtering here
}
}
if (new_mode_shrunk==SMOOTH_MODE__SMOOTH){
}
if (new_mode_shrunk==SMOOTH_MODE__SMOOTH){
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
if (new_mode_stretched==SMOOTH_MODE__DONT_SMOOTH){
}
if (new_mode_stretched==SMOOTH_MODE__DONT_SMOOTH){
if (render_state.source->PO2_fix==PO2_FIX__MIPMAPPED){
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}else{
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
}
if (new_mode_stretched==SMOOTH_MODE__SMOOTH){
}
if (new_mode_stretched==SMOOTH_MODE__SMOOTH){
glTexParameterf ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
render_state.source->smooth_shrunk=new_mode_shrunk;
render_state.source->smooth_stretched=new_mode_stretched;
}
}
render_state.source->smooth_shrunk=new_mode_shrunk;
render_state.source->smooth_stretched=new_mode_stretched;
}
void set_texture_wrap(int32 new_mode){
static int32 current_mode;
current_mode=render_state.source->texture_wrap;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==TEXTURE_WRAP_MODE__DONT_WRAP){
void set_texture_wrap(int32 new_mode){
static int32 current_mode;
current_mode=render_state.source->texture_wrap;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==TEXTURE_WRAP_MODE__DONT_WRAP){
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}
if (new_mode==TEXTURE_WRAP_MODE__WRAP){
}
if (new_mode==TEXTURE_WRAP_MODE__WRAP){
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
render_state.source->texture_wrap=new_mode;
}
}
render_state.source->texture_wrap=new_mode;
}
void set_alpha(int32 new_mode){
static int32 current_mode;
current_mode=render_state.use_alpha;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==ALPHA_MODE__DONT_BLEND){
void set_alpha(int32 new_mode){
static int32 current_mode;
current_mode=render_state.use_alpha;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==ALPHA_MODE__DONT_BLEND){
glDisable(GL_BLEND);
}
if (new_mode==ALPHA_MODE__BLEND){
}
if (new_mode==ALPHA_MODE__BLEND){
glEnable(GL_BLEND);
if (framebufferobjects_supported){
#ifndef QB64_GLES
@ -426,59 +426,59 @@ if (new_mode==ALPHA_MODE__BLEND){
}else{
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
render_state.use_alpha=new_mode;
}
}
render_state.use_alpha=new_mode;
}
void set_depthbuffer(int32 new_mode){
void set_depthbuffer(int32 new_mode){
static int32 current_mode;
current_mode=render_state.depthbuffer_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==DEPTHBUFFER_MODE__OFF){
static int32 current_mode;
current_mode=render_state.depthbuffer_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==DEPTHBUFFER_MODE__OFF){
glDisable(GL_DEPTH_TEST);
glAlphaFunc(GL_ALWAYS, 0);
}
if (new_mode==DEPTHBUFFER_MODE__ON){
}
if (new_mode==DEPTHBUFFER_MODE__ON){
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glAlphaFunc(GL_GREATER, 0.001);
glEnable(GL_ALPHA_TEST);
}
if (new_mode==DEPTHBUFFER_MODE__LOCKED){
}
if (new_mode==DEPTHBUFFER_MODE__LOCKED){
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glAlphaFunc(GL_ALWAYS, 0);
}
render_state.depthbuffer_mode=new_mode;
}
}
render_state.depthbuffer_mode=new_mode;
}
void set_cull_mode(int32 new_mode){
static int32 current_mode;
current_mode=render_state.cull_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==CULL_MODE__NONE){
void set_cull_mode(int32 new_mode){
static int32 current_mode;
current_mode=render_state.cull_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==CULL_MODE__NONE){
glDisable(GL_CULL_FACE);
}
if (new_mode==CULL_MODE__CLOCKWISE_ONLY){
}
if (new_mode==CULL_MODE__CLOCKWISE_ONLY){
glFrontFace(GL_CW);
if (current_mode!=CULL_MODE__ANTICLOCKWISE_ONLY) glEnable(GL_CULL_FACE);
}
if (new_mode==CULL_MODE__ANTICLOCKWISE_ONLY){
}
if (new_mode==CULL_MODE__ANTICLOCKWISE_ONLY){
glFrontFace(GL_CCW);
if (current_mode!=CULL_MODE__CLOCKWISE_ONLY) glEnable(GL_CULL_FACE);
}
render_state.cull_mode=new_mode;
}
}
render_state.cull_mode=new_mode;
}
void set_view(int32 new_mode){ //set view can only be called after the correct destination is chosen
static int32 current_mode;
current_mode=render_state.view_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==VIEW_MODE__RESET){
void set_view(int32 new_mode){ //set view can only be called after the correct destination is chosen
static int32 current_mode;
current_mode=render_state.view_mode;
if (new_mode==current_mode) return;
hardware_buffer_flush();
if (new_mode==VIEW_MODE__RESET){
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
@ -507,8 +507,8 @@ if (new_mode==VIEW_MODE__RESET){
set_render_source(INVALID_HARDWARE_HANDLE);
set_render_dest(INVALID_HARDWARE_HANDLE);
new_mode=VIEW_MODE__UNKNOWN;//resets are performed before unknown operations are executed
}
if (new_mode==VIEW_MODE__2D){
}
if (new_mode==VIEW_MODE__2D){
if (current_mode!=VIEW_MODE__3D){
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glDisable(GL_COLOR_MATERIAL);
@ -528,8 +528,8 @@ if (new_mode==VIEW_MODE__2D){
dst_w=environment__window_width;
dst_h=environment__window_height;
//alert(dst_w);
//alert(dst_h);
//alert(dst_w);
//alert(dst_h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@ -551,8 +551,8 @@ if (new_mode==VIEW_MODE__2D){
glLoadIdentity();
glViewport(0,0,hardware_img->w,hardware_img->h);
}
}
if (new_mode==VIEW_MODE__3D){
}
if (new_mode==VIEW_MODE__3D){
if (current_mode!=VIEW_MODE__2D){
glColor4f(1.f, 1.f, 1.f, 1.f);
glDisable(GL_COLOR_MATERIAL);
@ -609,56 +609,56 @@ if (new_mode==VIEW_MODE__3D){
glLoadIdentity();
//alert("3D rendering onto FBO not supported yet");
}
}
render_state.view_mode=new_mode;
}//change_render_state
}
render_state.view_mode=new_mode;
}//change_render_state
void set_render_source(int32 new_handle){
if (new_handle==INVALID_HARDWARE_HANDLE){
void set_render_source(int32 new_handle){
if (new_handle==INVALID_HARDWARE_HANDLE){
hardware_buffer_flush();
render_state.source_handle=INVALID_HARDWARE_HANDLE;
return;
}
int32 current_handle;
current_handle=render_state.source_handle;
}
int32 current_handle;
current_handle=render_state.source_handle;
if (current_handle==new_handle) return;
if (current_handle==new_handle) return;
hardware_buffer_flush();
hardware_buffer_flush();
hardware_img_struct* hardware_img;
hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,new_handle);
if (hardware_img->texture_handle==0) hardware_img_buffer_to_texture(new_handle);
glBindTexture (GL_TEXTURE_2D, hardware_img->texture_handle);
render_state.source_handle=new_handle;
render_state.source=&hardware_img->source_state;
hardware_img_struct* hardware_img;
hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,new_handle);
if (hardware_img->texture_handle==0) hardware_img_buffer_to_texture(new_handle);
glBindTexture (GL_TEXTURE_2D, hardware_img->texture_handle);
render_state.source_handle=new_handle;
render_state.source=&hardware_img->source_state;
//note: some older systems require calling glTexParameterf after textures are rebound
if (framebufferobjects_supported==0){
//note: some older systems require calling glTexParameterf after textures are rebound
if (framebufferobjects_supported==0){
render_state.source->smooth_shrunk=SMOOTH_MODE__UNKNOWN;
render_state.source->smooth_stretched=SMOOTH_MODE__UNKNOWN;
}
}
}
}
void set_render_dest(int32 new_handle){
if (new_handle==INVALID_HARDWARE_HANDLE){
void set_render_dest(int32 new_handle){
if (new_handle==INVALID_HARDWARE_HANDLE){
hardware_buffer_flush();
render_state.dest_handle=INVALID_HARDWARE_HANDLE;
set_view(VIEW_MODE__UNKNOWN);
return;
}
//0=primary surface
static int32 current_handle;
current_handle=render_state.dest_handle;
if (new_handle==current_handle) return;
hardware_buffer_flush();
set_view(VIEW_MODE__UNKNOWN);
if (new_handle==0){
}
//0=primary surface
static int32 current_handle;
current_handle=render_state.dest_handle;
if (new_handle==current_handle) return;
hardware_buffer_flush();
set_view(VIEW_MODE__UNKNOWN);
if (new_handle==0){
if (framebufferobjects_supported) glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
render_state.dest=&dest_render_state0;
}else{
}else{
static hardware_img_struct* hardware_img;
hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,new_handle);
//convert to regular texture first if necessary
@ -683,9 +683,9 @@ if (new_handle==0){
glBindFramebufferEXT(GL_FRAMEBUFFER, hardware_img->dest_context_handle);
}
render_state.dest=&hardware_img->dest_state;
}
render_state.dest_handle=new_handle;
}
}
render_state.dest_handle=new_handle;
}
@ -783,10 +783,10 @@ render_state.dest_handle=new_handle;
//adjust for render (x2 & y2 need to be one greater than the destination offset)
dst_x2++; dst_y2++;
if (src_hardware_img->source_state.PO2_fix){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
}
}
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f;
@ -855,179 +855,179 @@ if (src_hardware_img->source_state.PO2_fix){
static hardware_img_struct* dst_hardware_img;
dst_hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,dst_img);
static int32 dst_w,dst_h;
dst_w=dst_hardware_img->w;
dst_h=dst_hardware_img->h;
//SEAMLESS adjustments:
//reduce texture co-ordinates (maintaining top-left)
//(todo)
//NON-SEAMLESS adjustments:
//Extend rhs/bottom row to fill extra pixel space
//calculate extents
int32 rx1;
int32 rx2;
rx1=dst_x1;
if (dst_x2<rx1){
rx1=dst_x2;
}
if (dst_x3<rx1){
rx1=dst_x3;
}
rx2=dst_x1;
if (dst_x2>rx2){
rx2=dst_x2;
}
if (dst_x3>rx2){
rx2=dst_x3;
}
float xr;//the multiplier for where we should be (1=no change)
if (rx1==rx2){
xr=1.0f;
}else{
xr=((float)rx2-(float)rx1+1.0)/((float)rx2-(float)rx1);
}
int32 ry1;
int32 ry2;
ry1=dst_y1;
if (dst_y2<ry1){
ry1=dst_y2;
}
if (dst_y3<ry1){
ry1=dst_y3;
}
ry2=dst_y1;
if (dst_y2>ry2){
ry2=dst_y2;
}
if (dst_y3>ry2){
ry2=dst_y3;
}
float yr;//the multiplier for where we should be (1=no change)
if (ry1==ry2){
yr=1.0f;
}else{
yr=((float)ry2-(float)ry1+1.0f)/((float)ry2-(float)ry1);
}
//apply multipliers so right-most and bottom-most rows will be filled
static int32 basex;
basex=rx1;
dst_x1=qbr_float_to_long(
((float)(dst_x1-rx1))*xr+(float)basex
);
dst_x2=qbr_float_to_long(
((float)(dst_x2-rx1))*xr+(float)basex
);
dst_x3=qbr_float_to_long(
((float)(dst_x3-rx1))*xr+(float)basex
);
static int32 basey;
basey=ry1;
dst_y1=qbr_float_to_long(
((float)(dst_y1-ry1))*yr+(float)basey
);
dst_y2=qbr_float_to_long(
((float)(dst_y2-ry1))*yr+(float)basey
);
dst_y3=qbr_float_to_long(
((float)(dst_y3-ry1))*yr+(float)basey
);
static int32 dst_w,dst_h;
dst_w=dst_hardware_img->w;
dst_h=dst_hardware_img->h;
//SEAMLESS adjustments:
//reduce texture co-ordinates (maintaining top-left)
//(todo)
//NON-SEAMLESS adjustments:
//Extend rhs/bottom row to fill extra pixel space
//calculate extents
int32 rx1;
int32 rx2;
rx1=dst_x1;
if (dst_x2<rx1){
rx1=dst_x2;
}
if (dst_x3<rx1){
rx1=dst_x3;
}
rx2=dst_x1;
if (dst_x2>rx2){
rx2=dst_x2;
}
if (dst_x3>rx2){
rx2=dst_x3;
}
float xr;//the multiplier for where we should be (1=no change)
if (rx1==rx2){
xr=1.0f;
}else{
xr=((float)rx2-(float)rx1+1.0)/((float)rx2-(float)rx1);
}
int32 ry1;
int32 ry2;
ry1=dst_y1;
if (dst_y2<ry1){
ry1=dst_y2;
}
if (dst_y3<ry1){
ry1=dst_y3;
}
ry2=dst_y1;
if (dst_y2>ry2){
ry2=dst_y2;
}
if (dst_y3>ry2){
ry2=dst_y3;
}
float yr;//the multiplier for where we should be (1=no change)
if (ry1==ry2){
yr=1.0f;
}else{
yr=((float)ry2-(float)ry1+1.0f)/((float)ry2-(float)ry1);
}
//apply multipliers so right-most and bottom-most rows will be filled
static int32 basex;
basex=rx1;
dst_x1=qbr_float_to_long(
((float)(dst_x1-rx1))*xr+(float)basex
);
dst_x2=qbr_float_to_long(
((float)(dst_x2-rx1))*xr+(float)basex
);
dst_x3=qbr_float_to_long(
((float)(dst_x3-rx1))*xr+(float)basex
);
static int32 basey;
basey=ry1;
dst_y1=qbr_float_to_long(
((float)(dst_y1-ry1))*yr+(float)basey
);
dst_y2=qbr_float_to_long(
((float)(dst_y2-ry1))*yr+(float)basey
);
dst_y3=qbr_float_to_long(
((float)(dst_y3-ry1))*yr+(float)basey
);
}else{ //dest is 0
static int32 dst_w,dst_h;
dst_w=environment__window_width;
dst_h=environment__window_height;
//SEAMLESS adjustments:
//reduce texture co-ordinates (maintaining top-left)
//(todo)
//NON-SEAMLESS adjustments:
//Extend rhs/bottom row to fill extra pixel space
//calculate extents
int32 rx1;
int32 rx2;
rx1=dst_x1;
if (dst_x2<rx1){
rx1=dst_x2;
}
if (dst_x3<rx1){
rx1=dst_x3;
}
rx2=dst_x1;
if (dst_x2>rx2){
rx2=dst_x2;
}
if (dst_x3>rx2){
rx2=dst_x3;
}
float xr;//the multiplier for where we should be (1=no change)
if (rx1==rx2){
xr=1.0f;
}else{
xr=((float)rx2-(float)rx1+1.0)/((float)rx2-(float)rx1);
}
int32 ry1;
int32 ry2;
ry1=dst_y1;
if (dst_y2<ry1){
ry1=dst_y2;
}
if (dst_y3<ry1){
ry1=dst_y3;
}
ry2=dst_y1;
if (dst_y2>ry2){
ry2=dst_y2;
}
if (dst_y3>ry2){
ry2=dst_y3;
}
float yr;//the multiplier for where we should be (1=no change)
if (ry1==ry2){
yr=1.0f;
}else{
yr=((float)ry2-(float)ry1+1.0f)/((float)ry2-(float)ry1);
}
//apply multipliers so right-most and bottom-most rows will be filled
static int32 basex;
basex=
qbr_float_to_long(
((float)(rx1))*environment_2d__screen_x_scale+(float)environment_2d__screen_x1
);
dst_x1=
basex+
qbr_float_to_long(
((float)(dst_x1-rx1))*environment_2d__screen_x_scale*xr
);
dst_x2=
basex+
qbr_float_to_long(
((float)(dst_x2-rx1))*environment_2d__screen_x_scale*xr
);
dst_x3=
basex+
qbr_float_to_long(
((float)(dst_x3-rx1))*environment_2d__screen_x_scale*xr
);
static int32 basey;
basey=
qbr_float_to_long(
((float)(ry1))*environment_2d__screen_y_scale+(float)environment_2d__screen_y1
);
dst_y1=
basey+
qbr_float_to_long(
((float)(dst_y1-ry1))*environment_2d__screen_y_scale*yr
);
dst_y2=
basey+
qbr_float_to_long(
((float)(dst_y2-ry1))*environment_2d__screen_y_scale*yr
);
dst_y3=
basey+
qbr_float_to_long(
((float)(dst_y3-ry1))*environment_2d__screen_y_scale*yr
);
static int32 dst_w,dst_h;
dst_w=environment__window_width;
dst_h=environment__window_height;
//SEAMLESS adjustments:
//reduce texture co-ordinates (maintaining top-left)
//(todo)
//NON-SEAMLESS adjustments:
//Extend rhs/bottom row to fill extra pixel space
//calculate extents
int32 rx1;
int32 rx2;
rx1=dst_x1;
if (dst_x2<rx1){
rx1=dst_x2;
}
if (dst_x3<rx1){
rx1=dst_x3;
}
rx2=dst_x1;
if (dst_x2>rx2){
rx2=dst_x2;
}
if (dst_x3>rx2){
rx2=dst_x3;
}
float xr;//the multiplier for where we should be (1=no change)
if (rx1==rx2){
xr=1.0f;
}else{
xr=((float)rx2-(float)rx1+1.0)/((float)rx2-(float)rx1);
}
int32 ry1;
int32 ry2;
ry1=dst_y1;
if (dst_y2<ry1){
ry1=dst_y2;
}
if (dst_y3<ry1){
ry1=dst_y3;
}
ry2=dst_y1;
if (dst_y2>ry2){
ry2=dst_y2;
}
if (dst_y3>ry2){
ry2=dst_y3;
}
float yr;//the multiplier for where we should be (1=no change)
if (ry1==ry2){
yr=1.0f;
}else{
yr=((float)ry2-(float)ry1+1.0f)/((float)ry2-(float)ry1);
}
//apply multipliers so right-most and bottom-most rows will be filled
static int32 basex;
basex=
qbr_float_to_long(
((float)(rx1))*environment_2d__screen_x_scale+(float)environment_2d__screen_x1
);
dst_x1=
basex+
qbr_float_to_long(
((float)(dst_x1-rx1))*environment_2d__screen_x_scale*xr
);
dst_x2=
basex+
qbr_float_to_long(
((float)(dst_x2-rx1))*environment_2d__screen_x_scale*xr
);
dst_x3=
basex+
qbr_float_to_long(
((float)(dst_x3-rx1))*environment_2d__screen_x_scale*xr
);
static int32 basey;
basey=
qbr_float_to_long(
((float)(ry1))*environment_2d__screen_y_scale+(float)environment_2d__screen_y1
);
dst_y1=
basey+
qbr_float_to_long(
((float)(dst_y1-ry1))*environment_2d__screen_y_scale*yr
);
dst_y2=
basey+
qbr_float_to_long(
((float)(dst_y2-ry1))*environment_2d__screen_y_scale*yr
);
dst_y3=
basey+
qbr_float_to_long(
((float)(dst_y3-ry1))*environment_2d__screen_y_scale*yr
);
}
@ -1063,10 +1063,10 @@ qbr_float_to_long(
set_depthbuffer(DEPTHBUFFER_MODE__OFF);
set_cull_mode(CULL_MODE__NONE);
if (src_hardware_img->source_state.PO2_fix){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
}
}
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f,x3f,y3f;
@ -1102,7 +1102,7 @@ if (src_hardware_img->source_state.PO2_fix){
}
void clear_depthbuffer(int32 dst_img){
void clear_depthbuffer(int32 dst_img){
hardware_buffer_flush();
if (dst_img<0) dst_img=0;//both layers render to the primary context
set_render_dest(dst_img);
@ -1110,7 +1110,7 @@ void clear_depthbuffer(int32 dst_img){
hardware_img_requires_depthbuffer((hardware_img_struct*)list_get(hardware_img_handles,dst_img));
}
glClear(GL_DEPTH_BUFFER_BIT);
}
}
void hardware_img_tri3d(float dst_x1,float dst_y1,float dst_z1,float dst_x2,float dst_y2,float dst_z2,float dst_x3,float dst_y3,float dst_z3,
int32 src_img,int32 dst_img,
@ -1175,10 +1175,10 @@ void clear_depthbuffer(int32 dst_img){
set_cull_mode(cull_mode);
if (src_hardware_img->source_state.PO2_fix){
if (src_hardware_img->source_state.PO2_fix){
src_w=src_hardware_img->PO2_w;
src_h=src_hardware_img->PO2_h;
}
}
//calc source texture co-ordinates
static float x1f,y1f,x2f,y2f,x3f,y3f;
@ -1318,10 +1318,10 @@ if (src_hardware_img->source_state.PO2_fix){
if (i==last_i){
if (full_screen_set==-1){//no pending full-screen changes
if (os_resize_event==0){//no resize events
#ifndef DEPENDENCY_GL //we aren't using SUB _GL
#ifndef DEPENDENCY_GL //we aren't using SUB _GL
in_GLUT_DISPLAY_REQUEST=0;
return;
#endif
#endif
if (displayorder_glrender==0){
in_GLUT_DISPLAY_REQUEST=0;
return;
@ -1616,7 +1616,7 @@ if (src_hardware_img->source_state.PO2_fix){
}else{
if (level==displayorder_glrender){
#ifdef DEPENDENCY_GL
#ifdef DEPENDENCY_GL
set_view(VIEW_MODE__RESET);
@ -1632,7 +1632,7 @@ if (src_hardware_img->source_state.PO2_fix){
abort_gl:;
display_lock_released=display_lock_confirmed;
#endif //DEPENDENCY_GL
#endif //DEPENDENCY_GL
}//level==displayorder_glrender
@ -1917,7 +1917,7 @@ if (src_hardware_img->source_state.PO2_fix){
void GLUT_MouseButton_Up(int button,int x,int y){
#ifdef QB64_GLUT
#ifdef QB64_GLUT
int32 i;
int32 handle;
handle=mouse_message_queue_first;
@ -1949,11 +1949,11 @@ if (src_hardware_img->source_state.PO2_fix){
}//valid range
}//core devices required
#endif
#endif
}
void GLUT_MouseButton_Down(int button,int x,int y){
#ifdef QB64_GLUT
#ifdef QB64_GLUT
int32 i;
int32 handle;
@ -2004,14 +2004,14 @@ if (src_hardware_img->source_state.PO2_fix){
}//4-5
}//not 1-3
}//core devices required
#endif
#endif
}
void GLUT_MOUSE_FUNC(int glut_button,int state,int x,int y){
#ifdef QB64_GLUT
#ifdef QB64_GLUT
if (state==GLUT_DOWN) GLUT_MouseButton_Down(glut_button + 1,x,y);
if (state==GLUT_UP) GLUT_MouseButton_Up(glut_button + 1,x,y);
#endif
#endif
}
void GLUT_MOTION_FUNC(int x, int y){
@ -2109,7 +2109,7 @@ if (src_hardware_img->source_state.PO2_fix){
void GLUT_MOUSEWHEEL_FUNC(int wheel, int direction, int x, int y){
#ifdef QB64_GLUT
#ifdef QB64_GLUT
//Note: freeglut specific, limited documentation existed so the following research was done:
// qbs_print(qbs_str(wheel),NULL); <-- was always 0 [could 1 indicate horizontal wheel?]
// qbs_print(qbs_str(direction),NULL); <-- 1(up) or -1(down)
@ -2117,7 +2117,7 @@ if (src_hardware_img->source_state.PO2_fix){
// qbs_print(qbs_str(y),1); <
if (direction>0){GLUT_MouseButton_Down(4,x,y); GLUT_MouseButton_Up(4,x,y);}
if (direction<0){GLUT_MouseButton_Down(5,x,y); GLUT_MouseButton_Up(5,x,y);}
#endif
#endif
}

View file

@ -3,8 +3,8 @@ int32 requestedKeyboardOverlayImage=0;
#ifndef QB64_GUI //begin stubs
//STUB: simulate generating a hardware surface
int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
//STUB: simulate generating a hardware surface
int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
//create hardware img
int32 handle;
hardware_img_struct* hardware_img;
@ -33,7 +33,7 @@ int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
}
}
return handle;
}
}
@ -49,63 +49,63 @@ int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
#else //end stubs
#else //end stubs
int32 force_NPO2_fix=0;//This should only be set to 1 for debugging QB64
int32 force_NPO2_fix=0;//This should only be set to 1 for debugging QB64
uint32 *NPO2_buffer=(uint32*)malloc(4);
int32 NPO2_buffer_size_in_pixels=1;
uint32 *NPO2_buffer=(uint32*)malloc(4);
int32 NPO2_buffer_size_in_pixels=1;
uint32 *NPO2_texture_generate(int32 *px, int32 *py, uint32 *pixels){
int32 ox=*px;
int32 oy=*py;
int32 nx=1;
int32 ny=1;
uint32 *NPO2_texture_generate(int32 *px, int32 *py, uint32 *pixels){
int32 ox=*px;
int32 oy=*py;
int32 nx=1;
int32 ny=1;
//assume not negative & not 0
while ((ox&1)==0){
//assume not negative & not 0
while ((ox&1)==0){
ox>>=1;
nx<<=1;
}
if (ox!=1){//x is not a power of 2
}
if (ox!=1){//x is not a power of 2
while (ox!=0){
ox>>=1;
nx<<=1;
}
nx<<1;
}
while ((oy&1)==0){
}
while ((oy&1)==0){
oy>>=1;
ny<<=1;
}
if (oy!=1){//y is not a power of 2
}
if (oy!=1){//y is not a power of 2
while (oy!=0){
oy>>=1;
ny<<=1;
}
ny<<1;
}
}
//reset original values
ox=*px;
oy=*py;
//reset original values
ox=*px;
oy=*py;
if (nx==ox&&ny==oy){ //no action required
if (nx==ox&&ny==oy){ //no action required
return pixels;
}
}
int32 size_in_pixels=nx*ny;
if (size_in_pixels>NPO2_buffer_size_in_pixels){
int32 size_in_pixels=nx*ny;
if (size_in_pixels>NPO2_buffer_size_in_pixels){
NPO2_buffer=(uint32*)realloc(NPO2_buffer,size_in_pixels*4);
NPO2_buffer_size_in_pixels=size_in_pixels;
}
}
//copy source NPO2 rectangle into destination PO2 rectangle
if (nx==ox){ //can copy as a single block
//copy source NPO2 rectangle into destination PO2 rectangle
if (nx==ox){ //can copy as a single block
memcpy(NPO2_buffer,pixels,ox*oy*4);
}else{
}else{
uint32 *dst_pixel_offset=NPO2_buffer;
uint32 *src_pixel_offset=pixels;
while (oy--){
@ -114,45 +114,45 @@ if (nx==ox){ //can copy as a single block
src_pixel_offset+=ox;
}
oy=*py;
}
}
//tidy edges - extend the right-most column and bottom-most row to avoid pixel/color bleeding
//rhs column
if (ox!=nx){
for (int y=0;y<oy;y++){
NPO2_buffer[ox+nx*y]=NPO2_buffer[ox+nx*y-1];
}
}
//bottom row + 1 pixel for corner
if (oy!=ny){
for (int x=0;x<(ox+1);x++){
NPO2_buffer[nx*oy+x]=NPO2_buffer[nx*oy+x-nx];
}
}
//tidy edges - extend the right-most column and bottom-most row to avoid pixel/color bleeding
//rhs column
if (ox!=nx){
for (int y=0;y<oy;y++){
NPO2_buffer[ox+nx*y]=NPO2_buffer[ox+nx*y-1];
}
}
//bottom row + 1 pixel for corner
if (oy!=ny){
for (int x=0;x<(ox+1);x++){
NPO2_buffer[nx*oy+x]=NPO2_buffer[nx*oy+x-nx];
}
}
//int maxtexsize;
//glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize);
//alert(maxtexsize);
//int maxtexsize;
//glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxtexsize);
//alert(maxtexsize);
//alert(nx);
//alert(ny);
//alert(nx);
//alert(ny);
*px=nx;
*py=ny;
*px=nx;
*py=ny;
return NPO2_buffer;
return NPO2_buffer;
}
}
int32 new_texture_handle(){
int32 new_texture_handle(){
GLuint texture=0;
glGenTextures(1,&texture);
return (int32)texture;
}
}
int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
//note: non power-of-2 dimensioned textures are supported on modern 3D cards and
// even on some older cards, as long as mip-mapping is not being used
// therefore, no attempt is made to convert the non-power-of-2 SCREEN sizes via software
@ -226,9 +226,9 @@ int32 new_hardware_img(int32 x, int32 y, uint32 *pixels, int32 flags){
set_render_source(INVALID_HARDWARE_HANDLE);
}
return handle;
}
}
void hardware_img_buffer_to_texture(int32 handle){
void hardware_img_buffer_to_texture(int32 handle){
static hardware_img_struct* hardware_img;
hardware_img=(hardware_img_struct*)list_get(hardware_img_handles,handle);
if (hardware_img->texture_handle==0){
@ -264,13 +264,13 @@ void hardware_img_buffer_to_texture(int32 handle){
hardware_img->software_pixel_buffer=NULL;//2015 critical bug fix
set_render_source(INVALID_HARDWARE_HANDLE);
}
}
}
void hardware_img_requires_depthbuffer(hardware_img_struct* hardware_img){
if (hardware_img->depthbuffer_handle==0){
void hardware_img_requires_depthbuffer(hardware_img_struct* hardware_img){
if (hardware_img->depthbuffer_handle==0){
//inspiration... http://www.opengl.org/wiki/Framebuffer_Object_Examples#Color_texture.2C_Depth_texture
static GLuint depth_tex;
#ifndef QB64_GLES
#ifndef QB64_GLES
glGenTextures(1, &depth_tex);
glBindTexture(GL_TEXTURE_2D, depth_tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
@ -282,18 +282,18 @@ if (hardware_img->depthbuffer_handle==0){
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, hardware_img->w, hardware_img->h, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, depth_tex, 0/*mipmap level*/);
#else
#else
glGenRenderbuffers(1, &depth_tex);
glBindRenderbuffer(GL_RENDERBUFFER, depth_tex);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, hardware_img->w, hardware_img->h);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depth_tex);
#endif
#endif
//NULL means reserve texture memory, but texels are undefined
glClear(GL_DEPTH_BUFFER_BIT);
hardware_img->depthbuffer_handle=depth_tex;
set_render_source(INVALID_HARDWARE_HANDLE);
}
}
}
}
#endif

View file

@ -5,7 +5,7 @@
return;
}
#else
#else
void sub__printimage(int32 i){

View file

@ -37,7 +37,7 @@
//#include <string.h> /* for strncpy */
int32 _fmsbintoieee(float *src4, float *dest4)
{
{
unsigned char *msbin = (unsigned char *)src4;
unsigned char *ieee = (unsigned char *)dest4;
unsigned char sign = 0x00;
@ -87,11 +87,11 @@ int32 _fmsbintoieee(float *src4, float *dest4)
ieee[0] = msbin[0];
return 0;
}
}
int32 _fieeetomsbin(float *src4, float *dest4)
{
{
unsigned char *ieee = (unsigned char *)src4;
unsigned char *msbin = (unsigned char *)dest4;
unsigned char sign = 0x00;
@ -118,12 +118,12 @@ int32 _fieeetomsbin(float *src4, float *dest4)
msbin[0] = ieee[0];
return 0;
}
}
int32 _dmsbintoieee(double *src8, double *dest8)
{
{
unsigned char msbin[8];
unsigned char *ieee = (unsigned char *)dest8;
unsigned char sign = 0x00;
@ -200,10 +200,10 @@ int32 _dmsbintoieee(double *src8, double *dest8)
return 1;
else
return 0;
}
}
int32 _dieeetomsbin(double *src8, double *dest8)
{
{
unsigned char ieee[8];
unsigned char *msbin = (unsigned char *)dest8;
unsigned char sign = 0x00;
@ -240,7 +240,7 @@ int32 _dieeetomsbin(double *src8, double *dest8)
msbin[0] |= ieee[0] << 3;
return 0;
}
}

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x2))=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x2))=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x1))=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x1))=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,15 +149,15 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset32++)=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset32++)=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x2*dheight+y))=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x2*dheight+y))=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x1*dheight+y))=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x1*dheight+y))=src_offset32[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,16 +149,16 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset32=src_offset32[(ty>>16)*swidth+(tx>>16)];
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset32=src_offset32[(ty>>16)*swidth+(tx>>16)];
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x2))=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x2))=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x1))=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(y*dwidth+x1))=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,15 +149,15 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset32++)=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset32++)=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x2*dheight+y))=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x2*dheight+y))=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x1*dheight+y))=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset32+(x1*dheight+y))=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,16 +149,16 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset32=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset32=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,21 +104,21 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x2);
//--------plot pixel--------
switch((col=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(y*dwidth+x2);
//--------plot pixel--------
switch((col=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -126,9 +126,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -144,21 +144,21 @@ default:
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(y*dwidth+x1);
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -166,9 +166,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -195,27 +195,27 @@ default:
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -223,10 +223,10 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
pixel_offset32++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
pixel_offset32++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,21 +104,21 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x2*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(x2*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[(g2ty>>16)*swidth+(g2tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -126,9 +126,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -144,21 +144,21 @@ default:
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(x1*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -166,9 +166,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -195,27 +195,27 @@ default:
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
//--------plot pixel--------
switch((col=src_offset32[(ty>>16)*swidth+(tx>>16)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -223,10 +223,10 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,21 +104,21 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x2);
//--------plot pixel--------
switch((col=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(y*dwidth+x2);
//--------plot pixel--------
switch((col=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -126,9 +126,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -144,21 +144,21 @@ default:
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(y*dwidth+x1);
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -166,9 +166,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -195,27 +195,27 @@ default:
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -223,10 +223,10 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
pixel_offset32++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
pixel_offset32++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,21 +104,21 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x2*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(x2*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -126,9 +126,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -144,21 +144,21 @@ default:
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
pixel_offset32=dst_offset32+(x1*dheight+y);
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -166,9 +166,9 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -195,27 +195,27 @@ default:
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset32=dst_offset32+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
//--------plot pixel--------
switch((col=src_offset32[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)])&0xFF000000){
case 0xFF000000:
*pixel_offset32=col;
break;
case 0x0:
break;
case 0x80000000:
break;
case 0x0:
break;
case 0x80000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend128[*pixel_offset32>>24]<<24);
break;
case 0x7F000000:
break;
case 0x7F000000:
*pixel_offset32=(((*pixel_offset32&0xFEFEFE)+(col&0xFEFEFE))>>1)+(ablend127[*pixel_offset32>>24]<<24);
break;
default:
break;
default:
destcol=*pixel_offset32;
cp=cblend+(col>>24<<16);
*pixel_offset32=
@ -223,10 +223,10 @@ default:
+(cp[(col&0xFF00) +(destcol>>8&255) ]<<8)
+(cp[(col>>8&0xFF00)+(destcol>>16&255)]<<16)
+(ablend[(col>>24)+(destcol>>16&0xFF00)]<<24);
};//switch
//--------done plot pixel--------
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
};//switch
//--------done plot pixel--------
pixel_offset32+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x2))=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x2))=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x1))=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x1))=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,15 +149,15 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset++)=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset++)=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x2*dheight+y))=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x2*dheight+y))=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x1*dheight+y))=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x1*dheight+y))=src_offset[(ty>>16)*swidth+(tx>>16)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,16 +149,16 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset=src_offset[(ty>>16)*swidth+(tx>>16)];
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset=src_offset[(ty>>16)*swidth+(tx>>16)];
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x2))=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x2))=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x1))=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(y*dwidth+x1))=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,15 +149,15 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset++)=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(pixel_offset++)=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,8 +104,8 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x2*dheight+y))=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x2*dheight+y))=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -121,8 +121,8 @@ for(y=y1;y<=y2;y++){
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x1*dheight+y))=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*(dst_offset+(x1*dheight+y))=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -149,16 +149,16 @@ for(y=y1;y<=y2;y++){
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
*pixel_offset=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,9 +104,9 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -122,9 +122,9 @@ if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -151,17 +151,17 @@ if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,9 +104,9 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(g2ty>>16)*swidth+(g2tx>>16)];
if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -122,9 +122,9 @@ if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -151,17 +151,17 @@ if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[(ty>>16)*swidth+(tx>>16)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,9 +104,9 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -122,9 +122,9 @@ if (col!=transparent_color) *(dst_offset+(y*dwidth+x2))=col;
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -151,17 +151,17 @@ if (col!=transparent_color) *(dst_offset+(y*dwidth+x1))=col;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(y*dwidth+x1);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset++;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -104,9 +104,9 @@ for(y=y1;y<=y2;y++){
if(x2 < dwidth & no_edge_overlap == 0){ //onscreen check
//draw rhs pixel as is
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((g2ty>>16)%sheight)*swidth+((g2tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//move left one position
x2--;
@ -122,9 +122,9 @@ if (col!=transparent_color) *(dst_offset+(x2*dheight+y))=col;
//draw lhs pixel as is
if(x1 >= 0){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
//skip to next x location, effectively reducing steps by 1
x1++;
@ -151,17 +151,17 @@ if (col!=transparent_color) *(dst_offset+(x1*dheight+y))=col;
}
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
pixel_offset=dst_offset+(x1*dheight+y);
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//bottleneck
for(x=x1;x<=x2;x++){
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
col=src_offset[((ty>>16)%sheight)*swidth+((tx>>16)%swidth)];
if (col!=transparent_color) *pixel_offset=col;
pixel_offset+=dheight;
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
tx += txi;
ty += tyi;

View file

@ -3,21 +3,21 @@
//Note: Updated 15/7/2013: Switched to 223.27.25.123 because of DNS issues
/*
PRINT whatismyip$
PRINT whatismyip$
$CHECKING:OFF
FUNCTION whatismyip$
c = _OPENCLIENT("TCP/IP:80:www.qb64.net")
IF c = 0 THEN EXIT FUNCTION
'send request
e$ = CHR$(13) + CHR$(10)
x$ = "GET /ip.php HTTP/1.1" + e$
x$ = x$ + "Host: www.qb64.net" + e$
x$ = x$ + "" + e$
PUT #c, , x$
'wait for reply
t! = TIMER
DO
$CHECKING:OFF
FUNCTION whatismyip$
c = _OPENCLIENT("TCP/IP:80:www.qb64.net")
IF c = 0 THEN EXIT FUNCTION
'send request
e$ = CHR$(13) + CHR$(10)
x$ = "GET /ip.php HTTP/1.1" + e$
x$ = x$ + "Host: www.qb64.net" + e$
x$ = x$ + "" + e$
PUT #c, , x$
'wait for reply
t! = TIMER
DO
IF TIMER - t! > 5 THEN CLOSE c: EXIT FUNCTION
_DELAY 0.1
GET #c, , a2$
@ -40,170 +40,170 @@ DO
END IF
END IF
NEXT
LOOP
CLOSE c
whatismyip$ = ip$
END FUNCTION
$CHECKING:ON
LOOP
CLOSE c
whatismyip$ = ip$
END FUNCTION
$CHECKING:ON
*/
qbs* WHATISMYIP(){ //changed name from FUNC_WHATISMYIP to WHATISMYIP
qbs *tqbs;
ptrszint tmp_long;
int32 tmp_fileno;
uint32 qbs_tmp_base=qbs_tmp_list_nexti;
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
qbs *tqbs;
ptrszint tmp_long;
int32 tmp_fileno;
uint32 qbs_tmp_base=qbs_tmp_list_nexti;
uint8 *tmp_mem_static_pointer=mem_static_pointer;
uint32 tmp_cmem_sp=cmem_sp;
//data.txt
qbs *_FUNC_WHATISMYIP_STRING_WHATISMYIP=NULL;
if (!_FUNC_WHATISMYIP_STRING_WHATISMYIP)_FUNC_WHATISMYIP_STRING_WHATISMYIP=qbs_new(0,0);
float *_FUNC_WHATISMYIP_SINGLE_C=NULL;
if(_FUNC_WHATISMYIP_SINGLE_C==NULL){
_FUNC_WHATISMYIP_SINGLE_C=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_C=0;
}
qbs *_FUNC_WHATISMYIP_STRING_E=NULL;
if (!_FUNC_WHATISMYIP_STRING_E)_FUNC_WHATISMYIP_STRING_E=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_X=NULL;
if (!_FUNC_WHATISMYIP_STRING_X)_FUNC_WHATISMYIP_STRING_X=qbs_new(0,0);
byte_element_struct *byte_element_5276=NULL;
if (!byte_element_5276){
if ((mem_static_pointer+=12)<mem_static_limit) byte_element_5276=(byte_element_struct*)(mem_static_pointer-12); else byte_element_5276=(byte_element_struct*)mem_static_malloc(12);
}
float *_FUNC_WHATISMYIP_SINGLE_T=NULL;
if(_FUNC_WHATISMYIP_SINGLE_T==NULL){
_FUNC_WHATISMYIP_SINGLE_T=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_T=0;
}
qbs *_FUNC_WHATISMYIP_STRING_A2=NULL;
if (!_FUNC_WHATISMYIP_STRING_A2)_FUNC_WHATISMYIP_STRING_A2=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_A=NULL;
if (!_FUNC_WHATISMYIP_STRING_A)_FUNC_WHATISMYIP_STRING_A=qbs_new(0,0);
float *_FUNC_WHATISMYIP_SINGLE_DOTS=NULL;
if(_FUNC_WHATISMYIP_SINGLE_DOTS==NULL){
_FUNC_WHATISMYIP_SINGLE_DOTS=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_DOTS=0;
}
float *_FUNC_WHATISMYIP_SINGLE_START=NULL;
if(_FUNC_WHATISMYIP_SINGLE_START==NULL){
_FUNC_WHATISMYIP_SINGLE_START=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_START=0;
}
float *_FUNC_WHATISMYIP_SINGLE_X=NULL;
if(_FUNC_WHATISMYIP_SINGLE_X==NULL){
_FUNC_WHATISMYIP_SINGLE_X=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_X=0;
}
double fornext_value5279;
double fornext_finalvalue5279;
double fornext_step5279;
uint8 fornext_step_negative5279;
byte_element_struct *byte_element_5280=NULL;
if (!byte_element_5280){
if ((mem_static_pointer+=12)<mem_static_limit) byte_element_5280=(byte_element_struct*)(mem_static_pointer-12); else byte_element_5280=(byte_element_struct*)mem_static_malloc(12);
}
float *_FUNC_WHATISMYIP_SINGLE_A=NULL;
if(_FUNC_WHATISMYIP_SINGLE_A==NULL){
_FUNC_WHATISMYIP_SINGLE_A=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_A=0;
}
qbs *_FUNC_WHATISMYIP_STRING_IP=NULL;
if (!_FUNC_WHATISMYIP_STRING_IP)_FUNC_WHATISMYIP_STRING_IP=qbs_new(0,0);
//data.txt
qbs *_FUNC_WHATISMYIP_STRING_WHATISMYIP=NULL;
if (!_FUNC_WHATISMYIP_STRING_WHATISMYIP)_FUNC_WHATISMYIP_STRING_WHATISMYIP=qbs_new(0,0);
float *_FUNC_WHATISMYIP_SINGLE_C=NULL;
if(_FUNC_WHATISMYIP_SINGLE_C==NULL){
_FUNC_WHATISMYIP_SINGLE_C=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_C=0;
}
qbs *_FUNC_WHATISMYIP_STRING_E=NULL;
if (!_FUNC_WHATISMYIP_STRING_E)_FUNC_WHATISMYIP_STRING_E=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_X=NULL;
if (!_FUNC_WHATISMYIP_STRING_X)_FUNC_WHATISMYIP_STRING_X=qbs_new(0,0);
byte_element_struct *byte_element_5276=NULL;
if (!byte_element_5276){
if ((mem_static_pointer+=12)<mem_static_limit) byte_element_5276=(byte_element_struct*)(mem_static_pointer-12); else byte_element_5276=(byte_element_struct*)mem_static_malloc(12);
}
float *_FUNC_WHATISMYIP_SINGLE_T=NULL;
if(_FUNC_WHATISMYIP_SINGLE_T==NULL){
_FUNC_WHATISMYIP_SINGLE_T=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_T=0;
}
qbs *_FUNC_WHATISMYIP_STRING_A2=NULL;
if (!_FUNC_WHATISMYIP_STRING_A2)_FUNC_WHATISMYIP_STRING_A2=qbs_new(0,0);
qbs *_FUNC_WHATISMYIP_STRING_A=NULL;
if (!_FUNC_WHATISMYIP_STRING_A)_FUNC_WHATISMYIP_STRING_A=qbs_new(0,0);
float *_FUNC_WHATISMYIP_SINGLE_DOTS=NULL;
if(_FUNC_WHATISMYIP_SINGLE_DOTS==NULL){
_FUNC_WHATISMYIP_SINGLE_DOTS=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_DOTS=0;
}
float *_FUNC_WHATISMYIP_SINGLE_START=NULL;
if(_FUNC_WHATISMYIP_SINGLE_START==NULL){
_FUNC_WHATISMYIP_SINGLE_START=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_START=0;
}
float *_FUNC_WHATISMYIP_SINGLE_X=NULL;
if(_FUNC_WHATISMYIP_SINGLE_X==NULL){
_FUNC_WHATISMYIP_SINGLE_X=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_X=0;
}
double fornext_value5279;
double fornext_finalvalue5279;
double fornext_step5279;
uint8 fornext_step_negative5279;
byte_element_struct *byte_element_5280=NULL;
if (!byte_element_5280){
if ((mem_static_pointer+=12)<mem_static_limit) byte_element_5280=(byte_element_struct*)(mem_static_pointer-12); else byte_element_5280=(byte_element_struct*)mem_static_malloc(12);
}
float *_FUNC_WHATISMYIP_SINGLE_A=NULL;
if(_FUNC_WHATISMYIP_SINGLE_A==NULL){
_FUNC_WHATISMYIP_SINGLE_A=(float*)mem_static_malloc(4);
*_FUNC_WHATISMYIP_SINGLE_A=0;
}
qbs *_FUNC_WHATISMYIP_STRING_IP=NULL;
if (!_FUNC_WHATISMYIP_STRING_IP)_FUNC_WHATISMYIP_STRING_IP=qbs_new(0,0);
if (new_error) goto exit_subfunc;
mem_lock *sf_mem_lock;
new_mem_lock();
sf_mem_lock=mem_lock_tmp;
sf_mem_lock->type=3;
*_FUNC_WHATISMYIP_SINGLE_C=func__openclient(qbs_new_txt_len("TCP/IP:80:www.qb64.net",22));
qbs_cleanup(qbs_tmp_base,0);
if ((-(*_FUNC_WHATISMYIP_SINGLE_C== 0 ))||new_error){
goto exit_subfunc;
}
qbs_set(_FUNC_WHATISMYIP_STRING_E,qbs_add(func_chr( 13 ),func_chr( 10 )));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_new_txt_len("GET /ip.php HTTP/1.1",20),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_add(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("Host: www.qb64.net",18)),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_add(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("",0)),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
sub_put2(qbr(*_FUNC_WHATISMYIP_SINGLE_C),NULL,byte_element((uint64)_FUNC_WHATISMYIP_STRING_X->chr,_FUNC_WHATISMYIP_STRING_X->len,byte_element_5276),0);
qbs_cleanup(qbs_tmp_base,0);
*_FUNC_WHATISMYIP_SINGLE_T=func_timer(NULL,0);
do{
if ((-((func_timer(NULL,0)-*_FUNC_WHATISMYIP_SINGLE_T)>( 5 )))||new_error){
sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_C),1);
goto exit_subfunc;
}
sub__delay( 0.1E+0 );
sub_get2(qbr(*_FUNC_WHATISMYIP_SINGLE_C),NULL,_FUNC_WHATISMYIP_STRING_A2,0);
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_A2));
qbs_cleanup(qbs_tmp_base,0);
*_FUNC_WHATISMYIP_SINGLE_DOTS= 0 ;
*_FUNC_WHATISMYIP_SINGLE_START= 0 ;
fornext_value5279= 1 ;
fornext_finalvalue5279=_FUNC_WHATISMYIP_STRING_A->len;
fornext_step5279= 1 ;
if (fornext_step5279<0) fornext_step_negative5279=1; else fornext_step_negative5279=0;
if (new_error) goto fornext_error5279;
goto fornext_entrylabel5279;
while(1){
fornext_value5279=fornext_step5279+(*_FUNC_WHATISMYIP_SINGLE_X);
fornext_entrylabel5279:
*_FUNC_WHATISMYIP_SINGLE_X=fornext_value5279;
qbs_cleanup(qbs_tmp_base,0);
if (fornext_step_negative5279){
if (fornext_value5279<fornext_finalvalue5279) break;
}else{
if (fornext_value5279>fornext_finalvalue5279) break;
}
fornext_error5279:;
*_FUNC_WHATISMYIP_SINGLE_A=qbs_asc(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_X));
qbs_cleanup(qbs_tmp_base,0);
if (((-(*_FUNC_WHATISMYIP_SINGLE_A>= 48 ))&(-(*_FUNC_WHATISMYIP_SINGLE_A<= 57 )))||new_error){
if ((-(*_FUNC_WHATISMYIP_SINGLE_START== 0 ))||new_error){
*_FUNC_WHATISMYIP_SINGLE_START=*_FUNC_WHATISMYIP_SINGLE_X;
}
}else{
if (((-(*_FUNC_WHATISMYIP_SINGLE_A== 46 ))&(-(*_FUNC_WHATISMYIP_SINGLE_START!= 0 )))||new_error){
*_FUNC_WHATISMYIP_SINGLE_DOTS=*_FUNC_WHATISMYIP_SINGLE_DOTS+ 1 ;
}else{
if ((-(*_FUNC_WHATISMYIP_SINGLE_DOTS== 3 ))||new_error){
qbs_set(_FUNC_WHATISMYIP_STRING_IP,func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_START),qbr(*_FUNC_WHATISMYIP_SINGLE_X-*_FUNC_WHATISMYIP_SINGLE_START),1));
qbs_cleanup(qbs_tmp_base,0);
goto dl_exit_5277;
}
*_FUNC_WHATISMYIP_SINGLE_START= 0 ;
*_FUNC_WHATISMYIP_SINGLE_DOTS= 0 ;
}
}
}
fornext_exit_5278:;
}while(1);
dl_exit_5277:;
sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_C),1);
qbs_set(_FUNC_WHATISMYIP_STRING_WHATISMYIP,_FUNC_WHATISMYIP_STRING_IP);
qbs_cleanup(qbs_tmp_base,0);
exit_subfunc:;
free_mem_lock(sf_mem_lock);
if (new_error) goto exit_subfunc;
mem_lock *sf_mem_lock;
new_mem_lock();
sf_mem_lock=mem_lock_tmp;
sf_mem_lock->type=3;
*_FUNC_WHATISMYIP_SINGLE_C=func__openclient(qbs_new_txt_len("TCP/IP:80:www.qb64.net",22));
qbs_cleanup(qbs_tmp_base,0);
if ((-(*_FUNC_WHATISMYIP_SINGLE_C== 0 ))||new_error){
goto exit_subfunc;
}
qbs_set(_FUNC_WHATISMYIP_STRING_E,qbs_add(func_chr( 13 ),func_chr( 10 )));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_new_txt_len("GET /ip.php HTTP/1.1",20),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_add(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("Host: www.qb64.net",18)),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_X,qbs_add(qbs_add(_FUNC_WHATISMYIP_STRING_X,qbs_new_txt_len("",0)),_FUNC_WHATISMYIP_STRING_E));
qbs_cleanup(qbs_tmp_base,0);
sub_put2(qbr(*_FUNC_WHATISMYIP_SINGLE_C),NULL,byte_element((uint64)_FUNC_WHATISMYIP_STRING_X->chr,_FUNC_WHATISMYIP_STRING_X->len,byte_element_5276),0);
qbs_cleanup(qbs_tmp_base,0);
*_FUNC_WHATISMYIP_SINGLE_T=func_timer(NULL,0);
do{
if ((-((func_timer(NULL,0)-*_FUNC_WHATISMYIP_SINGLE_T)>( 5 )))||new_error){
sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_C),1);
goto exit_subfunc;
}
sub__delay( 0.1E+0 );
sub_get2(qbr(*_FUNC_WHATISMYIP_SINGLE_C),NULL,_FUNC_WHATISMYIP_STRING_A2,0);
qbs_cleanup(qbs_tmp_base,0);
qbs_set(_FUNC_WHATISMYIP_STRING_A,qbs_add(_FUNC_WHATISMYIP_STRING_A,_FUNC_WHATISMYIP_STRING_A2));
qbs_cleanup(qbs_tmp_base,0);
*_FUNC_WHATISMYIP_SINGLE_DOTS= 0 ;
*_FUNC_WHATISMYIP_SINGLE_START= 0 ;
fornext_value5279= 1 ;
fornext_finalvalue5279=_FUNC_WHATISMYIP_STRING_A->len;
fornext_step5279= 1 ;
if (fornext_step5279<0) fornext_step_negative5279=1; else fornext_step_negative5279=0;
if (new_error) goto fornext_error5279;
goto fornext_entrylabel5279;
while(1){
fornext_value5279=fornext_step5279+(*_FUNC_WHATISMYIP_SINGLE_X);
fornext_entrylabel5279:
*_FUNC_WHATISMYIP_SINGLE_X=fornext_value5279;
qbs_cleanup(qbs_tmp_base,0);
if (fornext_step_negative5279){
if (fornext_value5279<fornext_finalvalue5279) break;
}else{
if (fornext_value5279>fornext_finalvalue5279) break;
}
fornext_error5279:;
*_FUNC_WHATISMYIP_SINGLE_A=qbs_asc(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_X));
qbs_cleanup(qbs_tmp_base,0);
if (((-(*_FUNC_WHATISMYIP_SINGLE_A>= 48 ))&(-(*_FUNC_WHATISMYIP_SINGLE_A<= 57 )))||new_error){
if ((-(*_FUNC_WHATISMYIP_SINGLE_START== 0 ))||new_error){
*_FUNC_WHATISMYIP_SINGLE_START=*_FUNC_WHATISMYIP_SINGLE_X;
}
}else{
if (((-(*_FUNC_WHATISMYIP_SINGLE_A== 46 ))&(-(*_FUNC_WHATISMYIP_SINGLE_START!= 0 )))||new_error){
*_FUNC_WHATISMYIP_SINGLE_DOTS=*_FUNC_WHATISMYIP_SINGLE_DOTS+ 1 ;
}else{
if ((-(*_FUNC_WHATISMYIP_SINGLE_DOTS== 3 ))||new_error){
qbs_set(_FUNC_WHATISMYIP_STRING_IP,func_mid(_FUNC_WHATISMYIP_STRING_A,qbr(*_FUNC_WHATISMYIP_SINGLE_START),qbr(*_FUNC_WHATISMYIP_SINGLE_X-*_FUNC_WHATISMYIP_SINGLE_START),1));
qbs_cleanup(qbs_tmp_base,0);
goto dl_exit_5277;
}
*_FUNC_WHATISMYIP_SINGLE_START= 0 ;
*_FUNC_WHATISMYIP_SINGLE_DOTS= 0 ;
}
}
}
fornext_exit_5278:;
}while(1);
dl_exit_5277:;
sub_close(qbr(*_FUNC_WHATISMYIP_SINGLE_C),1);
qbs_set(_FUNC_WHATISMYIP_STRING_WHATISMYIP,_FUNC_WHATISMYIP_STRING_IP);
qbs_cleanup(qbs_tmp_base,0);
exit_subfunc:;
free_mem_lock(sf_mem_lock);
//free.txt
qbs_free(_FUNC_WHATISMYIP_STRING_E);
qbs_free(_FUNC_WHATISMYIP_STRING_X);
qbs_free(_FUNC_WHATISMYIP_STRING_A2);
qbs_free(_FUNC_WHATISMYIP_STRING_A);
qbs_free(_FUNC_WHATISMYIP_STRING_IP);
//free.txt
qbs_free(_FUNC_WHATISMYIP_STRING_E);
qbs_free(_FUNC_WHATISMYIP_STRING_X);
qbs_free(_FUNC_WHATISMYIP_STRING_A2);
qbs_free(_FUNC_WHATISMYIP_STRING_A);
qbs_free(_FUNC_WHATISMYIP_STRING_IP);
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
qbs_maketmp(_FUNC_WHATISMYIP_STRING_WHATISMYIP);return _FUNC_WHATISMYIP_STRING_WHATISMYIP;
if ((tmp_mem_static_pointer>=mem_static)&&(tmp_mem_static_pointer<=mem_static_limit)) mem_static_pointer=tmp_mem_static_pointer; else mem_static_pointer=mem_static;
cmem_sp=tmp_cmem_sp;
qbs_maketmp(_FUNC_WHATISMYIP_STRING_WHATISMYIP);return _FUNC_WHATISMYIP_STRING_WHATISMYIP;
}

View file

@ -11,7 +11,7 @@
*
* QB64_32: A 32bit system (the default)
* QB64_64: A 64bit system (assumes all Macs are 64 bit)
*/
*/
#ifdef WIN32
#define QB64_WINDOWS
#define QB64_BACKSLASH_FILESYSTEM
@ -22,21 +22,21 @@
#define QB64_GCC
#define QB64_MINGW
#endif
#elif defined(__APPLE__)
#elif defined(__APPLE__)
#define QB64_MACOSX
#define QB64_UNIX
#define QB64_GCC
#elif defined(__linux__)
#elif defined(__linux__)
#define QB64_LINUX
#define QB64_UNIX
#define QB64_GCC
#else
#else
#error "Unknown system; refusing to build. Edit os.h if needed"
#endif
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined(QB64_MACOSX)
#define QB64_64
#else
#else
#define QB64_32
#endif
@ -44,7 +44,7 @@
* file to not have these included.
*
* Should this be adapted to check for each type before defining?
*/
*/
#ifndef QB64_OS_H_NO_TYPES
#ifdef QB64_WINDOWS
#define uint64 unsigned __int64

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/* Copyright (c) Robert Walker, support@tunesmithy.co.uk
* Free source. Do what you wish with it - treat it as you would
* example code in a book on c programming.
*/
*/
#include "time64.h"
#undef time
#undef localtime
@ -16,7 +16,7 @@
#define SECS_TO_FT_MULT 10000000
#ifdef _DEBUG
#define DEBUG_TIME_T
#define DEBUG_TIME_T
#endif
/* From MSVC help:
@ -29,12 +29,12 @@
* So here is the struct to use for our 64 bit implementation
*
* However, it may be useful to be able to make this thread safe
*/
*/
#ifdef USE_THREAD_LOCAL_VARIABLES
#define TIME64_THREAD_LOCAL _declspec(thread)
#else
#define TIME64_THREAD_LOCAL
#define TIME64_THREAD_LOCAL _declspec(thread)
#else
#define TIME64_THREAD_LOCAL
#endif
TIME64_THREAD_LOCAL static struct tm today_ret;
@ -59,10 +59,10 @@ static void FileTimeToT64(FILETIME *pft,t64 *pt)
//#define FindTimeTBase() ((t64) 11644473600)
#define FindTimeTBase() (((__int64)11644)*1000000+473600)
// calculated using
// calculated using
/**
static t64 FindTimeTBase(void)
{
static t64 FindTimeTBase(void)
{
// Find 1st Jan 1970 as a FILETIME
SYSTEMTIME st;
FILETIME ft;
@ -73,7 +73,7 @@ static t64 FindTimeTBase(void)
SystemTimeToFileTime(&st, &ft);
FileTimeToT64(&ft,&tbase);
return tbase;
}
}
**/
static void SystemTimeToT64(SYSTEMTIME *pst,t64 *pt)
@ -101,18 +101,18 @@ t64 time_64(t64 *pt)
SYSTEMTIME st;
GetSystemTime(&st);
SystemTimeToT64(&st,&t);
#ifdef DEBUG_TIME_T
#ifdef DEBUG_TIME_T
{
time_t t2=time(NULL);
if(t2>=0)
//2005 assert(abs(t2-(int)t)<=1);
//2005 assert(abs(t2-(int)t)<=1);
assert(abs((long)(t2-(int)t))<=1);
// the <=1 here is in case the seconds get incremented
// betweeen the GetSystemTime(..) call and the time(..) call
}
#endif
#endif
if(pt)
*pt=t;
return t;
@ -162,13 +162,13 @@ struct tm *gmtime_64(t64 t)
today_ret.tm_yday=(int)((t-t64Year)/DAY_IN_SECS);
}
today_ret.tm_isdst=0;
#ifdef DEBUG_TIME_T
#ifdef DEBUG_TIME_T
{
struct tm today2;
long t32=(int)t;
if(t32>=0)
{
//2005 today2=*gmtime(&t32);
//2005 today2=*gmtime(&t32);
today2=*gmtime((time_t*)&t32);
assert(today_ret.tm_yday==today2.tm_yday);
@ -185,7 +185,7 @@ struct tm *gmtime_64(t64 t)
t64 t2=mktime64(&today_ret);
assert(t2==t);
}
#endif
#endif
return &today_ret;
}

View file

@ -1,7 +1,7 @@
/* Copyright (c) Robert Walker, support@tunesmithy.co.uk
* Free source. Do what you wish with it - treat it as you would
* example code in a book on c programming.
*/
*/
/* Note
* When you include this header then all your time_t variables will become
@ -30,7 +30,7 @@
*
* If your compiler has some other type of native 64 bit type then
* change the line typedef __int64 t64
*/
*/
#include <time.h>
@ -48,7 +48,7 @@
* You can't use this method with DLLs that might be loaded using LoadLibrary
* - see
* http://msdn.microsoft.com/library/en-us/dllproc/base/dynamic_link_library_data.asp
*/
*/
// #define USE_THREAD_LOCAL_VARIABLES
@ -80,4 +80,4 @@ struct tm *gmtime_64(t64 t);
* #include <time.h>
* ...
* #include "time64.h"
*/
*/