summaryrefslogtreecommitdiff
path: root/userspace/put_pixel.h
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
committerMiguel <m.i@gmx.at>2018-09-29 19:57:52 +0200
commit75433d155c152b809e9f25b1099fc06d6106308b (patch)
treef4f84309e6cf2aa9bc0d9df5ae532b94a60fea0f /userspace/put_pixel.h
parent73e80bf4b6c69b92a04b525f114a072a1c4b0d3a (diff)
improving window compositor
Diffstat (limited to 'userspace/put_pixel.h')
-rw-r--r--userspace/put_pixel.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/userspace/put_pixel.h b/userspace/put_pixel.h
index f879772..445e890 100644
--- a/userspace/put_pixel.h
+++ b/userspace/put_pixel.h
@@ -1,33 +1,44 @@
#include <stdint.h>
-#define VESA_FRAMEBUFFER 0xf6000000
+#define VESA_FRAMEBUFFER 0xfa000000
#define VESA_PITCH 2560
#define VESA_BPP 4
//https://forum.osdev.org/viewtopic.php?t=10018&p=64358
// TODO: what will happen in 24bit mode?
+/*
volatile int c;
int delay()
{
c++;
}
-void put_pixel(int x,int y, uint32_t color)
-{
- //do not write memory outside the screen buffer, check parameters against the VBE mode info
- //if (x<0 || x>vesaXres|| y<0 || y>vesaYres) return;
- //if (x) x = (x*(VESA_BPP>>3)); // get bytes (divide by 8)
- //if (y) y = (y*VESA_PITCH);
- //uint8_t *cTemp=VbeModeInfoBlock->physbase;
+*/
+void put_rect(int x,int y, int w, int h,uint32_t col)
+{
+ // start
uint8_t *p=VESA_FRAMEBUFFER+y*VESA_PITCH+x*VESA_BPP;
uint32_t *pix=p;
- *pix=color;
-// for(int i=0;i<100;i++)delay();
+ for(int yy=y; yy<y+h; yy++) // iter over lines
+ {
+ for(int xx=x; xx<x+w; xx++) // single line
+ {
+ *pix=col;
+ pix++;
+ }
+ pix+=640-w;
+
+ }
}
-
+void put_pixel(int x,int y, uint32_t color)
+{
+ uint8_t *p=VESA_FRAMEBUFFER+y*VESA_PITCH+x*VESA_BPP;
+ uint32_t *pix=p;
+ *pix=color;
+}
void put_pixel_old(int x,int y, int color)
{