From 7fd3e7193637ec92629eb44be42c8ca79f2059f5 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 7 May 2025 18:39:11 +0200 Subject: [PATCH] XV-Display: partial success with the fallback / pixbuf display The new solution is to (still) use a Gdk::Pixbuf, because in GTK-3 the more modern alternatives are not yet provided. But we can pass this Pixbuf directly to Gtk::Image, instead of trying to do low-level drawing on the X-Window. Other than that, I more or less transformed the old C-style code into the corresponding calls in Gdkmm. __SUCCESS__: we get **some display** __TODO__ : the displayed image is Garbage, which means that the pixel layout is not correct --- src/stage/output/null-displayer.cpp | 11 +++--- src/stage/output/null-displayer.hpp | 4 +-- src/stage/output/pixbuf-displayer.cpp | 43 +++++++++++++---------- src/stage/output/pixbuf-displayer.hpp | 5 ++- src/stage/output/xv-displayer.cpp | 12 +++---- src/stage/output/xv-displayer.hpp | 4 +-- src/stage/widget/video-display-widget.cpp | 6 ++-- wiki/thinkPad.ichthyo.mm | 40 +++++++++++++++++++-- 8 files changed, 81 insertions(+), 44 deletions(-) diff --git a/src/stage/output/null-displayer.cpp b/src/stage/output/null-displayer.cpp index 0a1ccf888..5cc9841e1 100644 --- a/src/stage/output/null-displayer.cpp +++ b/src/stage/output/null-displayer.cpp @@ -26,15 +26,14 @@ namespace stage { namespace output { - NullDisplayer::NullDisplayer (Gtk::Widget* drawing_area, + NullDisplayer::NullDisplayer (Gtk::Widget& drawing_area, int width, int height) : Displayer{width,height} , drawingArea_{drawing_area} { - REQUIRE (drawing_area); REQUIRE (width > 0); REQUIRE (height > 0); - cout << "NullDisplayer("<get_width(), - drawingArea_->get_height(), + drawingArea_.get_width(), + drawingArea_.get_height(), videoWidth, videoHeight, video_x, video_y, video_width, video_height); - GdkWindow *window = drawingArea_->get_window()->gobj(); + GdkWindow *window = drawingArea_.get_window()->gobj(); REQUIRE (window != NULL); cout << "put("< 0); REQUIRE (height > 0); + auto iconSet = Gtk::IconSet::lookup_default (Gtk::StockID("panel_play")); + drawingArea_.set(iconSet, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); cout << "USING PixbufDisplayer" <get_width(), - drawingArea_->get_height(), + drawingArea_.get_width(), + drawingArea_.get_height(), videoWidth, videoHeight, - video_x, video_y, video_width, video_height); + video_x, video_y, destWidth, destHeight); - GdkWindow *window = drawingArea_->get_window()->gobj(); + GdkWindow *window = drawingArea_.get_window()->gobj(); REQUIRE (window != NULL); - if (not init_) - { - auto iconSet = Gtk::IconSet::lookup_default (Gtk::StockID("panel_play")); - drawingArea_->set(iconSet, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG)); - init_ = true; - cout << "INIT Pixbuf"<< iconSet.get() <queue_draw(); - int pixSiz = drawingArea_->property_pixel_size(); - cout << "bong.."< (image); + auto rawBuf = Gdk::Pixbuf::create_from_data (imageData + ,Gdk::COLORSPACE_RGB + ,false // has_alpha + ,8 // bits_per_sample + ,videoWidth + ,videoHeight + ,0 // rowstride (can be used to round up to even powers of two per row) + ); + ASSERT (rawBuf); + auto scaledBuf = rawBuf->scale_simple (destWidth, destHeight, Gdk::INTERP_NEAREST); + drawingArea_.set (scaledBuf); + drawingArea_.queue_draw(); + cout << "bong.."< 0); REQUIRE (height > 0); @@ -44,7 +43,7 @@ namespace output { shmInfo.shmaddr = NULL; - Glib::RefPtr area_window = drawing_area->get_window(); + Glib::RefPtr area_window = drawing_area.get_window(); window = GDK_WINDOW_XID (area_window->gobj()); display = GDK_WINDOW_XDISPLAY (area_window->gobj()); @@ -206,7 +205,6 @@ namespace output { XvDisplayer::put (void* const image) { REQUIRE (image != NULL); - REQUIRE (drawingArea_ != NULL); if (xvImage != NULL) { @@ -214,8 +212,8 @@ namespace output { int video_x = 0, video_y = 0, video_width = 0, video_height = 0; calculateVideoLayout( - drawingArea_->get_width(), - drawingArea_->get_height(), + drawingArea_.get_width(), + drawingArea_.get_height(), videoWidth, videoHeight, video_x, video_y, video_width, video_height ); diff --git a/src/stage/output/xv-displayer.hpp b/src/stage/output/xv-displayer.hpp index 01323009f..84b0cea11 100644 --- a/src/stage/output/xv-displayer.hpp +++ b/src/stage/output/xv-displayer.hpp @@ -59,7 +59,7 @@ namespace output { * @param height The height of the video image in pixels. This value * must be greater than zero. */ - XvDisplayer (Gtk::Widget* drawing_area, int width, int height); + XvDisplayer (Gtk::Widget& drawing_area, int width, int height); ~XvDisplayer(); @@ -92,7 +92,7 @@ namespace output { * The widget that video will be drawn into. * @remarks This value must be a valid pointer. */ - Gtk::Widget* drawingArea_; + Gtk::Widget& drawingArea_; /** * The display that video will be drawn into. diff --git a/src/stage/widget/video-display-widget.cpp b/src/stage/widget/video-display-widget.cpp index d609fbad3..f4f69bad1 100644 --- a/src/stage/widget/video-display-widget.cpp +++ b/src/stage/widget/video-display-widget.cpp @@ -71,15 +71,15 @@ namespace widget { REQUIRE (videoWidth > 0); REQUIRE (videoHeight > 0); /* - displayer_ = make_unique (this, videoWidth, videoHeight); + displayer_ = make_unique (*this, videoWidth, videoHeight); if (displayer_->usable()) return; */ - displayer_ = make_unique (this, videoWidth, videoHeight); + displayer_ = make_unique (*this, videoWidth, videoHeight); if (displayer_->usable()) return; - displayer_ = make_unique (this, videoWidth, videoHeight); + displayer_ = make_unique (*this, videoWidth, videoHeight); ENSURE (displayer_->usable()); } diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index bfdc77b93..3f0ba08f6 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -129990,12 +129990,48 @@ StM_bind(Builder<R1> b1, Extension<R1,R2> extension) - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ Erfolg-1 : es wird irgendwas angezeigt +

+ + +
+ + +