void DrawViewTreatment() { // Draw view elements (edge treatment). // added by ajw. int i; int iOffset = 0; // HDC hdcTarget = ( stretchfactor == 1 ) ? gBitsDC : gBufferDC; BYTE* pBitsTarget = ( stretchfactor == 1 ) ? gBits : gBufferBits; int iWidthTarget = ( stretchfactor == 1 ) ? MAXX : MAXX*2; // if (state == STATE_GAME && (GameGetState() == GAME_PLAY || GameGetState() == GAME_SELECT)) if (GetFocus() == hMain) iOffset = 4; for( i = iOffset; i < iOffset + ( NUM_VIEW_ELEMENTS / 2 ); i++ ) { BitCopy( pBitsTarget, iWidthTarget, ViewElements[i].x, ViewElements[i].y, ViewElements[i].width, ViewElements[i].height, ViewElements[i].bits, 0, 0, DIBWIDTH( ViewElements[i].width ), OBB_FLIP | OBB_TRANSPARENT ); // OffscreenBitBlt( hdcTarget, ViewElements[i].x, ViewElements[i].y, ViewElements[i].width, ViewElements[i].height, // ViewElements[i].bits, 0, 0, DIBWIDTH( ViewElements[i].width ), OBB_COPY | OBB_FLIP | OBB_TRANSPARENT ); GdiFlush(); } // Ensure that border, which covers up parts of view treatment, is drawn. DrawGridBorder(); GdiFlush(); GdiFlush(); GdiFlush(); GdiFlush(); GdiFlush(); }
void DrawPattern(int tileindex) { gRect r; int colorindex = currindex; /*!!! Layer* savelayer = NULL; viewport* saveview0 = NULL; */ // fill the background with state 0 color glClearColor(currlayer->cellr[0]/255.0, currlayer->cellg[0]/255.0, currlayer->cellb[0]/255.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); // if grid is bounded then ensure viewport's central cell is not outside grid edges if ( currlayer->algo->gridwd > 0) { if ( currlayer->view->x < currlayer->algo->gridleft ) currlayer->view->setpositionmag(currlayer->algo->gridleft, currlayer->view->y, currlayer->view->getmag()); else if ( currlayer->view->x > currlayer->algo->gridright ) currlayer->view->setpositionmag(currlayer->algo->gridright, currlayer->view->y, currlayer->view->getmag()); } if ( currlayer->algo->gridht > 0) { if ( currlayer->view->y < currlayer->algo->gridtop ) currlayer->view->setpositionmag(currlayer->view->x, currlayer->algo->gridtop, currlayer->view->getmag()); else if ( currlayer->view->y > currlayer->algo->gridbottom ) currlayer->view->setpositionmag(currlayer->view->x, currlayer->algo->gridbottom, currlayer->view->getmag()); } if (nopattupdate) { // don't draw incomplete pattern, just draw grid lines and border currwd = currlayer->view->getwidth(); currht = currlayer->view->getheight(); if ( showgridlines && currlayer->view->getmag() >= mingridmag ) { DrawGridLines(currwd, currht); } if ( currlayer->algo->gridwd > 0 || currlayer->algo->gridht > 0 ) { DrawGridBorder(currwd, currht); } return; } /*!!! if ( numlayers > 1 && tilelayers ) { if ( tileindex < 0 ) { DrawTileBorders(dc); return; } // tileindex >= 0 so temporarily change some globals to draw this tile if ( syncviews && tileindex != currindex ) { // make sure this layer uses same location and scale as current layer GetLayer(tileindex)->view->setpositionmag(currlayer->view->x, currlayer->view->y, currlayer->view->getmag()); } savelayer = currlayer; currlayer = GetLayer(tileindex); viewptr = currlayer->tilewin; colorindex = tileindex; } else if ( numlayers > 1 && stacklayers ) { // draw all layers starting with layer 0 but using current layer's viewport savelayer = currlayer; if ( currindex != 0 ) { // change currlayer to layer 0 currlayer = GetLayer(0); saveview0 = currlayer->view; currlayer->view = savelayer->view; } colorindex = 0; } */ if (showicons && currlayer->view->getmag() > 2) { // only show icons at scales 1:8 and above if (currlayer->view->getmag() == 3) { icontextures = currlayer->textures7x7; } else if (currlayer->view->getmag() == 4) { icontextures = currlayer->textures15x15; } else { icontextures = currlayer->textures31x31; } } currwd = currlayer->view->getwidth(); currht = currlayer->view->getheight(); // draw pattern using a sequence of pixblit calls currlayer->algo->draw(*currlayer->view, renderer); if ( showgridlines && currlayer->view->getmag() >= mingridmag ) { DrawGridLines(currwd, currht); } // if universe is bounded then draw border regions (if visible) if ( currlayer->algo->gridwd > 0 || currlayer->algo->gridht > 0 ) { DrawGridBorder(currwd, currht); } if ( currlayer->currsel.Visible(&r) ) { DrawSelection(r, colorindex == currindex); } /*!!! if ( numlayers > 1 && stacklayers ) { // must restore currlayer before we call DrawStackedLayers currlayer = savelayer; if ( saveview0 ) { // restore layer 0's viewport GetLayer(0)->view = saveview0; } // draw layers 1, 2, ... numlayers-1 DrawStackedLayers(dc); } */ if (waitingforpaste) { DrawPasteImage(); } /*!!! if ( numlayers > 1 && tilelayers ) { // restore globals changed above currlayer = savelayer; viewptr = currlayer->tilewin; } */ }