Usermode/AxWin4 - Fix bitmap upscale
authorJohn Hodge (sonata) <[email protected]>
Fri, 26 Dec 2014 23:28:38 +0000 (07:28 +0800)
committerJohn Hodge (sonata) <[email protected]>
Fri, 26 Dec 2014 23:28:38 +0000 (07:28 +0800)
Usermode/Applications/axwin4_src/Server/draw_text.cpp
Usermode/Applications/axwin4_src/UI/taskbar.c

index dd3bad9..4fc35a5 100644 (file)
@@ -48,7 +48,7 @@ void CFontFallback::renderAtRes(CSurface& dest, const CRect& rect, uint32_t cp,
        assert(char_idx < 256);
        const uint8_t*  char_ptr = &VTermFont[char_idx * FONT_HEIGHT];
        unsigned int    out_h = Size;
        assert(char_idx < 256);
        const uint8_t*  char_ptr = &VTermFont[char_idx * FONT_HEIGHT];
        unsigned int    out_h = Size;
-       unsigned int    out_w = (Size * FONT_WIDTH / FONT_HEIGHT) + 1;
+       unsigned int    out_w = (Size * FONT_WIDTH / FONT_HEIGHT);
        uint32_t        char_data[out_w];
        if( Size == FONT_HEIGHT ) {
                // Standard blit
        uint32_t        char_data[out_w];
        if( Size == FONT_HEIGHT ) {
                // Standard blit
@@ -69,10 +69,10 @@ void CFontFallback::renderAtRes(CSurface& dest, const CRect& rect, uint32_t cp,
                // up-scaled blit
                for( unsigned int row = 0; row < out_h; row ++ )
                {
                // up-scaled blit
                for( unsigned int row = 0; row < out_h; row ++ )
                {
-                       unsigned int yf16 = row * out_h * 0x10000 / Size;
+                       unsigned int yf16 = row * FONT_HEIGHT * 0x10000 / out_h;
                        for( unsigned int col = 0; col < out_w; col ++ )
                        {
                        for( unsigned int col = 0; col < out_w; col ++ )
                        {
-                               unsigned int xf16 = col * out_w * 0x10000 / FONT_WIDTH;
+                               unsigned int xf16 = col * FONT_WIDTH * 0x10000 / out_w;
                                uint8_t alpha = getValueAtPt(char_ptr, xf16, yf16);
                                //_SysDebug("row %i (%05x), col %i (%05x): alpha = %02x", row, yf16, col, xf16, alpha);
                                char_data[col] = ((uint32_t)alpha << 24) | (FGC & 0xFFFFFF);
                                uint8_t alpha = getValueAtPt(char_ptr, xf16, yf16);
                                //_SysDebug("row %i (%05x), col %i (%05x): alpha = %02x", row, yf16, col, xf16, alpha);
                                char_data[col] = ((uint32_t)alpha << 24) | (FGC & 0xFFFFFF);
@@ -131,13 +131,12 @@ uint8_t CFontFallback::getValueAtPt(const uint8_t* char_ptr, unsigned int xf16,
 
 uint8_t CFontFallback::getValueAtRaw(const uint8_t* char_ptr, unsigned int x, unsigned int y)
 {
 
 uint8_t CFontFallback::getValueAtRaw(const uint8_t* char_ptr, unsigned int x, unsigned int y)
 {
-       if( x == 0 || y == 0 )
-               return 0;
-       x --;
-       y --;
+       //if( x == 0 || y == 0 )
+       //      return 0;
+       //x --; y --;
        if(x >= FONT_WIDTH || y >= FONT_HEIGHT)
                return 0;
        if(x >= FONT_WIDTH || y >= FONT_HEIGHT)
                return 0;
-       return (char_ptr[y] & (1 << (8-x))) ? 255 : 0;
+       return (char_ptr[y] & (1 << (7-x))) ? 255 : 0;
 }
 
 unsigned int CFontFallback::unicodeToCharmap(uint32_t cp) const
 }
 
 unsigned int CFontFallback::unicodeToCharmap(uint32_t cp) const
index 3f63268..f6261d4 100644 (file)
@@ -83,7 +83,12 @@ void Taskbar_Redraw(void)
                time(&rawtime);
                strftime(timestr, 5, "%H%M", localtime(&rawtime));
                //AxWin4_DrawControl(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, active_height, AXWIN4_CTL_BOX);
                time(&rawtime);
                strftime(timestr, 5, "%H%M", localtime(&rawtime));
                //AxWin4_DrawControl(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, active_height, AXWIN4_CTL_BOX);
+               
+               //unsigned int clock_height = 16;       // Hard-code the standard font height
+               //unsigned int clock_yofs = (active_height - clock_height)/2;
+               //AxWin4_DrawText(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER + clock_yofs, TASKBAR_CLOCKSIZE, clock_height, 0, timestr);
                AxWin4_DrawText(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, active_height, 0, timestr);
                AxWin4_DrawText(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, active_height, 0, timestr);
+               
                //AxWin4_DrawText(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, 16, 0, timestr);
        }
        
                //AxWin4_DrawText(gpTaskbar_Window, clock_start_x, TASKBAR_BORDER, TASKBAR_CLOCKSIZE, 16, 0, timestr);
        }
        

UCC git Repository :: git.ucc.asn.au