Hello 

I get now 16 bit working.readrect was miss.

For big endian is diffrent function need for blit and readrect.

netsurf do not work with internal fonts or fb_font_monochrome:1 in both 16
and 32 bit.
what do you think is that a libnsfb Problem or a netsurf Core problem ?.
does this work on other netsurf builds ?

When set in the SDL framebuffer build in Option file
fb_font_monochrome:1

then antialiasing is switch off and text is render with 

glyph1(nsfb_t *nsfb,
       nsfb_bbox_t *loc,
       const uint8_t *pixel,
       int pitch,
       nsfb_colour_t c)

but this not work on newest netsurf with libnsfb.

in old netsurf without nsfb it work and speed is near same as use internal
fonts.
code look now near same as old.

On old func is named fb_32bpp_draw_ft_monobitmap

Does this work on your system, so can see if problem is in libnsfb or not ?

Regards
--- E:/amiga/AmiDevCpp/bernd/libnsfb_checkout/src/16bpp_plotters.c      Fri Jul 
10 14:17:50 2009

+++ E:/amiga/AmiDevCpp/bernd/netsurf/libnsfb/src/16bpp_plotters.c       Tue Nov 
03 12:23:20 2009

@@ -28,6 +28,35 @@

               ((pixel & 0x7E0) << 5) |

               ((pixel & 0xF800) >> 8);

 }

+#if __BYTE_ORDER == __BIG_ENDIAN

+static inline nsfb_colour_t nsfb_plot_ablend_be(nsfb_colour_t 
pixel,nsfb_colour_t  scrpixel)

+{

+         int opacity = pixel & 0xFF;

+         int transp = 0x100 - opacity;

+      uint32_t rb, g; 

+         pixel >>= 8;

+         scrpixel >>= 8;

+         rb = ((pixel & 0xFF00FF) * opacity +

+          (scrpixel & 0xFF00FF) * transp) >> 8;

+      g  = ((pixel & 0x00FF00) * opacity +

+          (scrpixel & 0x00FF00) * transp) >> 8;

+

+    return ((rb & 0xFF00FF) | (g & 0xFF00)) << 8; 

+

+}

+static inline nsfb_colour_t pixel_be_to_colour(uint16_t pixel)

+{

+        return ((pixel & 0x1F) << (8+3)) |

+              ((pixel & 0x7E0) << (8+5)) |

+              ((pixel & 0xF800) << (16));

+}

+static inline uint16_t colour_be_to_pixel(nsfb_colour_t c)

+{

+

+        //return ((c & 0xF8) << 8) | ((c & 0xFC00 ) >> 5) | ((c & 0xF80000) >> 
19);

+           return ((c & 0xF8000000) >> 16) | ((c & 0xFC0000) >> (16-3)) | ((c 
& 0xF800) >> 11  );

+}

+#endif

 

 /* convert a colour value to a 16bpp pixel value ready for screen output */

 static inline uint16_t colour_to_pixel(nsfb_colour_t c)

@@ -286,7 +317,7 @@

         int y = loc->y0;

         int width = loc->x1 - loc->x0;

         int height = loc->y1 - loc->y0;

-        uint16_t fgcol;

+        uint32_t fgcol;

 

         if (!nsfb_plot_clip_ctx(nsfb, loc))

                 return true;

@@ -381,6 +411,15 @@

                 for (yloop = yoff; yloop < height; yloop += bmp_stride) {

                         for (xloop = 0; xloop < width; xloop++) {

                                 abpixel = pixel[yloop + xloop + xoff];

+#if __BYTE_ORDER == __BIG_ENDIAN

+                                if ((abpixel & 0x000000FF) != 0) {

+                                        if ((abpixel & 0x000000FF) != 
0x000000FF) {

+                                                                               
abpixel = nsfb_plot_ablend_be(abpixel,

+                                                                               
        pixel_be_to_colour(*(pvideo + xloop)));

+                                                                               
}

+                                                                               
*(pvideo + xloop) = colour_be_to_pixel(abpixel);

+                                                               }

+#else

                                 if ((abpixel & 0xFF000000) != 0) {

                                         if ((abpixel & 0xFF000000) != 
0xFF000000) {

                                                 abpixel = 
nsfb_plot_ablend(abpixel,

@@ -386,17 +425,22 @@

                                                 abpixel = 
nsfb_plot_ablend(abpixel,

                                                                            
pixel_to_colour(*(pvideo + xloop)));

                                         }

-

                                         *(pvideo + xloop) = 
colour_to_pixel(abpixel);

                                 }

+#endif

                         }

+                                                               

                         pvideo += (nsfb->linelen >> 1);

                 }

         } else {

                 for (yloop = yoff; yloop < height; yloop += bmp_stride) {

                         for (xloop = 0; xloop < width; xloop++) {

                                 abpixel = pixel[yloop + xloop + xoff];

+#if __BYTE_ORDER == __BIG_ENDIAN

+                                *(pvideo + xloop) = 
colour_be_to_pixel(abpixel);

+#else

                                 *(pvideo + xloop) = colour_to_pixel(abpixel);

+#endif

                         }

                         pvideo += (nsfb->linelen >> 1);

                 }

@@ -405,7 +449,34 @@

        return true;

 }

 

+static bool readrect(nsfb_t *nsfb, nsfb_bbox_t *rect, nsfb_colour_t *buffer)

+{

+        uint16_t *pvideo;

+        int xloop, yloop;

+        int width; 

+

+        if (!nsfb_plot_clip_ctx(nsfb, rect)) {

+                return true;

+        }

+

+        width = rect->x1 - rect->x0;

 

+        pvideo = get_xy_loc(nsfb, rect->x0, rect->y0);

+

+        for (yloop = rect->y0; yloop < rect->y1; yloop += 1) {

+                for (xloop = 0; xloop < width; xloop++) {

+#if __BYTE_ORDER == __BIG_ENDIAN                       

+                                           

+                        *buffer = pixel_be_to_colour(*(pvideo + xloop));

+#else

+                        *buffer = pixel_to_colour(*(pvideo + xloop));

+#endif

+                        buffer++;

+                }

+                pvideo += (nsfb->linelen >> 1);

+        }

+        return true;

+}

 

 

 const nsfb_plotter_fns_t _nsfb_16bpp_plotters = {

@@ -415,6 +486,7 @@

         .bitmap = bitmap,

         .glyph8 = glyph8,

         .glyph1 = glyph1,

+               .readrect = readrect,

 };

 

 /*

Reply via email to