Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 96b8a31b01
Fetching contributors…

Cannot retrieve contributors at this time

executable file 71 lines (58 sloc) 2.054 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

This program was created by Grazioli Giovanni Dante <wargio@libero.it>.
*/

#include <NoRSX/Bitmap.h>

void Bitmap::GenerateBitmap(NoRSX_Bitmap *a){
a->bitmap = new uint32_t[G->width * G->height];
a->height = G->height;
a->width = G->width;
a->load = 1;
}

void Bitmap::GenerateCustomBitmap(uint32_t width, uint32_t height, NoRSX_Bitmap *a){
a->bitmap = new uint32_t[width*height];

a->height = height;
a->width = width;

a->load = 1;
}

void Bitmap::ClearBitmap(NoRSX_Bitmap *a){
if(a->load==1){
free(a->bitmap);
a->load = 0;
}
}

void Bitmap::RegenBitmap(NoRSX_Bitmap *a){
if(a->load==1){
delete [] a->bitmap;
a->bitmap = new uint32_t[(sizeof(u32) * G->width * G->height)];
}else{
a->bitmap = new uint32_t[(sizeof(u32) * G->width * G->height)];
a->load = 1;
}
}

void Bitmap::DrawBitmap(NoRSX_Bitmap *a){
if(a->load==1){
s32 size = G->buffers[G->currentBuffer].height * G->buffers[G->currentBuffer].width;
for(s32 i = 0; i < size; i++) {
G->buffers[G->currentBuffer].ptr[i] = a->bitmap[i];
}
}
}

void Bitmap::DrawCustomBitmap(uint32_t start_width, uint32_t start_height, uint32_t end_width, uint32_t end_height, NoRSX_Bitmap *a){
if(a->load==1){
s32 size = G->buffers[G->currentBuffer].height * G->buffers[G->currentBuffer].width;
u32 pos = start_height*a->width+start_width;
for(s32 i = 0; i < size; i++) {
G->buffers[G->currentBuffer].ptr[i] = a->bitmap[pos+i];
}
}
}
Something went wrong with that request. Please try again.