From: Greg J. <gv...@gm...> - 2016-02-01 04:44:41
|
Hi Phil, > Greg, can I ask what the specific call order to plplot is and how do > you end up making use of the buffer in the first place? I can't identify where the plot buffer is used, I thought it was used routinely now in 5.11. > For example do > you plot with gcc then the error occurs during a resize? The previous message should clarify this. The window is holding a mix of painted btmaps and line drawings. somehow the bitmap gets buried. First the line drawings are made, then Saturn image is put on via PaintImage which calls directly SetDIBitsToDevice(hdc , ...). > Has plinit > already been called (directly or indirectly)? Do you do something a > bit more unusual such as initially set the buffer to null, do the > plotting to generate the buffer, then use plcpstrm() to copy to the > gcc driver? there is no plcpstrm call in the code at all. Images are put up directly via SetDIBitsToDevice(hdc, ...) from an internally maintained buffer tv_buf through GDLWINSTREAM::PaintImage and it is redrawn from ::RedrawTV() These functionalities have only recently been adapted in the gdlwin driver. I think I need to expose the GDL/plplot connection, which starts at the general class for all GDL devices > >> class GDLGStream: public plstream > > { > > // protected: > > // void init(); // prevent plstream::init from being called directly > > private: > > gdlpage pageLayout; > > gdlbox boxLayout; > > > > protected: > > bool valid; > > gdlCharInfo theCurrentChar; > > gdlCharInfo theDefaultChar; > > int gdlDefaultCharInitialized; > > gdlbox theBox; > > gdlpage thePage; > > PLStream* pls; > > DFloat thickFactor; > > > > public: > > >> GDLGStream( int nx, int ny, const char *driver, const char *file=NULL) > > : plstream( nx, ny, driver, file), valid( true), thickFactor(1.0) > > { > > if (!checkPlplotDriver(driver)) > > ThrowGDLException(std::string("PLplot installation lacks the >> requested driver: ") + driver); > > gdlDefaultCharInitialized=0; > > thePage.nbPages=0; > > theBox.initialized=false; > > plgpls( &pls); > > if (GDL_DEBUG_PLSTREAM) printf(" new GDLGstream( %d , %d , %s ):pls=%p >> \n", nx, ny, driver, (void *)pls); > > >> } > > >> any supported device has a specifically programmed GraphicsDevice which for windows: > >> class DeviceWIN : public GraphicsDevice > > { > > private: > > static LRESULT CALLBACK _CallWndProc(int nCode, WPARAM wParam, LPARAM >> lParam); > > LRESULT CallWndProc(int nCode, WPARAM wParam, LPARAM lParam); > > static LRESULT CALLBACK _GetMsgProc(int nCode, WPARAM wParam, LPARAM >> lParam); > > LRESULT GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); > > >> std::vector<GDLGStream*> winList; > > std::vector<long> oList; > > long oIx; > > int actWin; > > int decomposed; // false -> use color table > > .. etc... > > a window needs a specifically programmed stream class which for windows: > >> class GDLWINStream : public GDLGStream > > { > > private: > > //Atom wm_protocols; > > //Atom wm_delete_window; > > HWND refocus; > > >> PLStream* pls; > > plstream *plst; > > >> tv_buf_t tv_buf; > > int _mode; > > PLGraphicsIn *_gin; > > POINT GinPoint; > > HCURSOR CrosshairCursor; > > bool rbutton, xbutton, mbutton, buttonpressed; > > public: > > std::map<UINT, void (CALLBACK GDLWINStream::*)(UINT, WPARAM, LPARAM)> >> msghooks; > > >> GDLWINStream(int nx, int ny) : > > #ifdef USE_WINGDI_NOT_WINGCC > > GDLGStream(nx, ny, "wingdi") > > #else > > GDLGStream(nx, ny, "wingcc") > > #endif > > { > > pls = 0; > > // get the command interpreter window's handle > > // plsetopt("drvopt","nofocus"); // avoid stealing focus on window >> creation > > // plsetopt("drvopt","text"); // use freetype fonts > > refocus = GetForegroundWindow(); > > } > > >> ~GDLWINStream(); > > void Init(); > > void EventHandler(); > > > so this is happening: > > void GDLWINStream::Init() { this->plstream::init(); plgpls(&pls); #ifdef USE_WINGDI_NOT_WINGCC #else wingcc_Dev* dev = (wingcc_Dev *)pls->dev; dev->waiting = 1; #endif UnsetFocus(); tv_buf.has_data = false; > HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL); CrosshairCursor = CreateCursor(hInstance, 15, 14, 32, 32, > ANDmaskCursor, XORmaskCursor); } > -------------------- So the action goes as follows, for the WINDOW,# command; > bool success = actDevice->SetBackingStore(retainType); > success = actDevice->WOpen( wIx, title, xSize, ySize, xPos, yPos); bool DeviceWIN::WOpen( int wIx, const std::string& title, > > int xSize, int ySize, int xPos, int yPos) > > { > > winList[ wIx] = new GDLWINStream( nx, ny); > // set initial window size > PLFLT xp; PLFLT yp; > PLINT xleng; PLINT yleng; > PLINT xoff; PLINT yoff; > winList[ wIx]->plstream::gpage( xp, yp, xleng, yleng, xoff, yoff); > ... winList[ wIx]->spage( xp, yp, xleng, yleng, xoff, yoff); > // no pause on win destruction winList[ wIx]->spause( false); if(debug) cout << " WOpen: ->fontld( 1) WOpen: ->scolor( "; > // extended fonts winList[ wIx]->fontld( 1); > // we want color winList[ wIx]->scolor( 1); > PLINT r[256], g[256], b[256]; actCT.Get( r, g, b); // winList[ wIx]->scmap0( r, g, b, actCT.size()); winList[ wIx]->scmap1( r, g, b, ctSize); > if(debug) cout << "; WOpen:winList[ wIx]->Init("; > winList[ wIx]->Init(); ... winList[ wIx]->ssub(1,1); > > winList[ wIx]->adv(0); > > // load font > > winList[ wIx]->font( 1); > > winList[ wIx]->vpor(0,1,0,1); > > winList[ wIx]->wind(0,1,0,1); > > winList[ wIx]->DefaultCharSize(); > > > On Sun, Jan 31, 2016 at 6:51 AM, Phil Rosenberg <p.d...@gm...> wrote: > Hi Greg > I appreciate your frustrations. There is clearly a bug somewhere. t is > just a case of finding it and deterimining which side of the > GDL/plplot boundary it lies on - or if it is a Plplot documentation or > error checking issue. Clearly any call to plplot which results in a > segfault/crash of any sort is bad. > > For some reason I can't build the gcc driver on my system (Windows > 10), so I am doing this with the wxWidgets driver > >> > >> Ok I can simply build plplot without the bop() in rdbuf_bop and now I > ask, > >> which example does it affect in linux? > > I have just stepped through the function calls with the wxWidgets > driver in the Visual Studio debugger.The only thing that the plbop() > call at the end of rdbuf_bop() does is call plP_subpInit(), this is > because plsc->page_status is set to AT_BOP already. In this case all > that is actually done is to check that the number of sub pages in each > direction is > 0, set the current subpage to 0 and set the text and > tick mark sizes. Actually it turns out there is a bug here and the > text size is not set correctly for x03 because the orientation change > is not saved which affects the scale. I am looking to fix that now. > > Regarding the specific bug with GDL and gcc driver. The gcc driver > should not actually called by the plbop() call. It would only get > called if plsc->page_status was not already AT_BOP. > > Greg, can I ask what the specific call order to plplot is and how do > you end up making use of the buffer in the first place? For example do > you plot with gcc then the error occurs during a resize? Has plinit > already been called (directly or indirectly)? Do you do something a > bit more unusual such as initially set the buffer to null, do the > plotting to generate the buffer, then use plcpstrm() to copy to the > gcc driver? > > Phil > |