Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/382112c58f9c9745224c6100c99a4ea4f98b7dc0
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/382112c58f9c9745224c6100c99a4ea4f98b7dc0
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/382112c58f9c9745224c6100c99a4ea4f98b7dc0

The branch, vince/qt6 has been updated
       via  382112c58f9c9745224c6100c99a4ea4f98b7dc0 (commit)
      from  73247fefc0fc68886737ac6b3962eb4150cabcf8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=382112c58f9c9745224c6100c99a4ea4f98b7dc0
commit 382112c58f9c9745224c6100c99a4ea4f98b7dc0
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    add bitmap plotting

diff --git a/frontends/qt/bitmap.cpp b/frontends/qt/bitmap.cpp
index 72c6ede..f60c7f8 100644
--- a/frontends/qt/bitmap.cpp
+++ b/frontends/qt/bitmap.cpp
@@ -22,6 +22,7 @@
  */
 
 #include <stddef.h>
+#include <QImage>
 
 extern "C" {
 
@@ -42,7 +43,14 @@ extern "C" {
  */
 static void *nsqt_bitmap_create(int width, int height, enum gui_bitmap_flags 
flags)
 {
-       return NULL;
+       enum QImage::Format qfmt;
+       if (flags & BITMAP_OPAQUE) {
+               qfmt = QImage::Format_RGB32;
+       } else {
+               qfmt = QImage::Format_ARGB32;
+       }
+
+       return new QImage(width, height, qfmt);
 }
 
 /**
@@ -52,6 +60,8 @@ static void *nsqt_bitmap_create(int width, int height, enum 
gui_bitmap_flags fla
  */
 static void nsqt_bitmap_destroy(void *bitmap)
 {
+       QImage *img = (QImage *)bitmap;
+       delete img;
 }
 
 /**
@@ -84,7 +94,8 @@ static bool nsqt_bitmap_get_opaque(void *bitmap)
  */
 static unsigned char *nsqt_bitmap_get_buffer(void *bitmap)
 {
-       return NULL;
+       QImage *img = (QImage *)bitmap;
+       return img->bits();
 }
 
 /**
@@ -95,7 +106,8 @@ static unsigned char *nsqt_bitmap_get_buffer(void *bitmap)
  */
 static size_t nsqt_bitmap_get_rowstride(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->bytesPerLine();
 }
 
 /**
@@ -106,7 +118,8 @@ static size_t nsqt_bitmap_get_rowstride(void *bitmap)
  */
 static int nsqt_bitmap_get_width(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->width();
 }
 
 /**
@@ -117,7 +130,8 @@ static int nsqt_bitmap_get_width(void *bitmap)
  */
 static int nsqt_bitmap_get_height(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->height();
 }
 
 
diff --git a/frontends/qt/main.cpp b/frontends/qt/main.cpp
index a1c89c3..b012439 100644
--- a/frontends/qt/main.cpp
+++ b/frontends/qt/main.cpp
@@ -29,6 +29,7 @@ extern "C" {
 #include "utils/nsoption.h"
 #include "utils/nsurl.h"
 
+#include "netsurf/bitmap.h"
 #include "netsurf/netsurf.h"
 #include "netsurf/content.h"
 #include "netsurf/browser_window.h"
@@ -91,7 +92,6 @@ static nserror nsqt_init(int *pargc, char** argv,QApplication 
**papp)
                return res;
        }
 
-       
        /* Initialise logging. Not fatal if it fails but not much we
         * can do about it either.
         */
@@ -125,6 +125,13 @@ static nserror nsqt_start(int argc, char** argv)
        char *addr = NULL;
        nsurl *url;
        nserror res;
+       bitmap_fmt_t qtfmt = {
+               .layout = BITMAP_LAYOUT_ARGB8888,
+               .pma = false,
+       };
+
+       // set bitmap format
+       bitmap_set_format(&qtfmt );
 
        /* If there is a url specified on the command line use it */
        if (argc > 1) {
diff --git a/frontends/qt/plotters.cpp b/frontends/qt/plotters.cpp
index 6986e84..4d56a85 100644
--- a/frontends/qt/plotters.cpp
+++ b/frontends/qt/plotters.cpp
@@ -274,6 +274,11 @@ nsqt_plot_bitmap(const struct redraw_context *ctx,
                   colour bg,
                   bitmap_flags_t flags)
 {
+       QImage *img = (QImage *)bitmap;
+       QPainter* painter = (QPainter*)ctx->priv;
+       QRectF source(0,0,img->width(),img->height());
+       QRectF target(x,y,width,height);
+       painter->drawImage(target,*img,source);
        return NSERROR_OK;
 }
 


-----------------------------------------------------------------------

Summary of changes:
 frontends/qt/bitmap.cpp   |   24 +++++++++++++++++++-----
 frontends/qt/main.cpp     |    9 ++++++++-
 frontends/qt/plotters.cpp |    5 +++++
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/frontends/qt/bitmap.cpp b/frontends/qt/bitmap.cpp
index 72c6ede..f60c7f8 100644
--- a/frontends/qt/bitmap.cpp
+++ b/frontends/qt/bitmap.cpp
@@ -22,6 +22,7 @@
  */
 
 #include <stddef.h>
+#include <QImage>
 
 extern "C" {
 
@@ -42,7 +43,14 @@ extern "C" {
  */
 static void *nsqt_bitmap_create(int width, int height, enum gui_bitmap_flags 
flags)
 {
-       return NULL;
+       enum QImage::Format qfmt;
+       if (flags & BITMAP_OPAQUE) {
+               qfmt = QImage::Format_RGB32;
+       } else {
+               qfmt = QImage::Format_ARGB32;
+       }
+
+       return new QImage(width, height, qfmt);
 }
 
 /**
@@ -52,6 +60,8 @@ static void *nsqt_bitmap_create(int width, int height, enum 
gui_bitmap_flags fla
  */
 static void nsqt_bitmap_destroy(void *bitmap)
 {
+       QImage *img = (QImage *)bitmap;
+       delete img;
 }
 
 /**
@@ -84,7 +94,8 @@ static bool nsqt_bitmap_get_opaque(void *bitmap)
  */
 static unsigned char *nsqt_bitmap_get_buffer(void *bitmap)
 {
-       return NULL;
+       QImage *img = (QImage *)bitmap;
+       return img->bits();
 }
 
 /**
@@ -95,7 +106,8 @@ static unsigned char *nsqt_bitmap_get_buffer(void *bitmap)
  */
 static size_t nsqt_bitmap_get_rowstride(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->bytesPerLine();
 }
 
 /**
@@ -106,7 +118,8 @@ static size_t nsqt_bitmap_get_rowstride(void *bitmap)
  */
 static int nsqt_bitmap_get_width(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->width();
 }
 
 /**
@@ -117,7 +130,8 @@ static int nsqt_bitmap_get_width(void *bitmap)
  */
 static int nsqt_bitmap_get_height(void *bitmap)
 {
-       return 0;
+       QImage *img = (QImage *)bitmap;
+       return img->height();
 }
 
 
diff --git a/frontends/qt/main.cpp b/frontends/qt/main.cpp
index a1c89c3..b012439 100644
--- a/frontends/qt/main.cpp
+++ b/frontends/qt/main.cpp
@@ -29,6 +29,7 @@ extern "C" {
 #include "utils/nsoption.h"
 #include "utils/nsurl.h"
 
+#include "netsurf/bitmap.h"
 #include "netsurf/netsurf.h"
 #include "netsurf/content.h"
 #include "netsurf/browser_window.h"
@@ -91,7 +92,6 @@ static nserror nsqt_init(int *pargc, char** argv,QApplication 
**papp)
                return res;
        }
 
-       
        /* Initialise logging. Not fatal if it fails but not much we
         * can do about it either.
         */
@@ -125,6 +125,13 @@ static nserror nsqt_start(int argc, char** argv)
        char *addr = NULL;
        nsurl *url;
        nserror res;
+       bitmap_fmt_t qtfmt = {
+               .layout = BITMAP_LAYOUT_ARGB8888,
+               .pma = false,
+       };
+
+       // set bitmap format
+       bitmap_set_format(&qtfmt );
 
        /* If there is a url specified on the command line use it */
        if (argc > 1) {
diff --git a/frontends/qt/plotters.cpp b/frontends/qt/plotters.cpp
index 6986e84..4d56a85 100644
--- a/frontends/qt/plotters.cpp
+++ b/frontends/qt/plotters.cpp
@@ -274,6 +274,11 @@ nsqt_plot_bitmap(const struct redraw_context *ctx,
                   colour bg,
                   bitmap_flags_t flags)
 {
+       QImage *img = (QImage *)bitmap;
+       QPainter* painter = (QPainter*)ctx->priv;
+       QRectF source(0,0,img->width(),img->height());
+       QRectF target(x,y,width,height);
+       painter->drawImage(target,*img,source);
        return NSERROR_OK;
 }
 


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to