Ejemplo n.º 1
1
static void PaintWindowThread(void *)
{
	/* First tell the main thread we're started */
	_draw_mutex->BeginCritical();
	SetEvent(_draw_thread_initialized);

	/* Now wait for the first thing to draw! */
	_draw_mutex->WaitForSignal();

	while (_draw_continue) {
		/* Convert update region from logical to device coordinates. */
		POINT pt = {0, 0};
		ClientToScreen(_wnd.main_wnd, &pt);
		OffsetRect(&_wnd.update_rect, pt.x, pt.y);

		/* Create a device context that is clipped to the region we need to draw.
		 * GetDCEx 'consumes' the update region, so we may not destroy it ourself. */
		HRGN rgn = CreateRectRgnIndirect(&_wnd.update_rect);
		HDC dc = GetDCEx(_wnd.main_wnd, rgn, DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_INTERSECTRGN);

		PaintWindow(dc);

		/* Clear update rect. */
		SetRectEmpty(&_wnd.update_rect);
		ReleaseDC(_wnd.main_wnd, dc);

		/* Flush GDI buffer to ensure drawing here doesn't conflict with any GDI usage in the main WndProc. */
		GdiFlush();

		_draw_mutex->WaitForSignal();
	}

	_draw_mutex->EndCritical();
	_draw_thread->Exit();
}
Ejemplo n.º 2
0
/*
 * InterfaceDrawElements:  Draw spiffy interface elements.
 */
void InterfaceDrawElements(HDC hdc)
{
  int i, x, y;
  InterfaceElement *e;
  Bool vertical;

  for (i=0; i < NUM_AUTO_ELEMENTS; i++)
  {
	  //	Temp. disable xxx
/*	  if( i >= ELEMENT_ULTOP && i <= ELEMENT_LRRIGHT )
		  continue;
	  if( i >= ELEMENT_IULTOP && i <= ELEMENT_ILRRIGHT )
		  continue;
	  if( i == ELEMENT_BLLBOTTOM || i == ELEMENT_BLRBOTTOM )
		  continue;*/

    OffscreenWindowBackground(NULL, elements[i].x, elements[i].y, elements[i].width, elements[i].height);
    
    OffscreenBitBlt(hdc, elements[i].x, elements[i].y, elements[i].width, elements[i].height,
		    elements[i].bits, 0, 0, DIBWIDTH(elements[i].width), 
		    OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
    GdiFlush();
  }

  for (i=0; i < NUM_AUTO_REPEATERS; i++)
  {
	  //	Temp. disable xxx
	if( i >= ELEMENT_ITOP && i <= ELEMENT_IRIGHT )
		continue;
	  //	disable xxx
	if( i >= ELEMENT_TOP && i <= ELEMENT_RIGHT )
		continue;
	if( i == ELEMENT_BBOTTOM )
		continue;

	e = &repeaters[i].element;
    x = e->x;
    y = e->y;
    vertical = repeaters[i].vertical;
        
    while (1)
    {
      if ((vertical && y > repeaters[i].end) || (!vertical && x > repeaters[i].end))
	break;
      
      OffscreenWindowBackground(NULL, x, y, e->width, e->height);
      OffscreenBitBlt(hdc, x, y, e->width, e->height, e->bits, 0, 0, DIBWIDTH(e->width), 
		      OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
      if (vertical)
	y += e->height;
      else x += e->width;

      GdiFlush();
    }
  }
}
FREObject __cdecl AmbireCaptureCapture(FREContext ctx, void * functionData, uint32_t argc, FREObject argv[]) {
	bool success = false;
	POINT pt = { 0 };
	FREBitmapData bd = { 0 };
	FREResult result = FREAcquireBitmapData(argv[0], &bd);
	if(result == FRE_OK) {
		int width = bd.width;
		int height = bd.height;
		BITMAPINFOHEADER bmi = { 0 };
		bmi.biSize = sizeof(bmi);
		bmi.biWidth = width;
		bmi.biHeight = height;
		bmi.biPlanes = 1;
		bmi.biBitCount = 24;
		int stride = ((width * 3 + 3) / 4) * 4;
		bmi.biSizeImage = stride * height;
		void * ppvBits = 0;
		HDC hdcDesktop = GetDC(0);
		if(hdcDesktop) {
			HDC hdcMem = CreateCompatibleDC(hdcDesktop);
			if(hdcMem) {
				HBITMAP hbm = CreateDIBSection(hdcMem, (const BITMAPINFO *)&bmi, 0, &ppvBits, 0, 0);
				if(hbm) {
					SelectObject(hdcMem, hbm);
					BitBlt(hdcMem, 0, 0, width, height, hdcDesktop, 0, 0, SRCCOPY);
					GdiFlush();
					ReleaseDC(0, hdcDesktop);
					DeleteDC(hdcMem);
					GdiFlush();
					for(int y = 0; y < height; ++y) {
						const unsigned char * p = reinterpret_cast<unsigned char *>(ppvBits) + y * stride;
						uint32_t * q = reinterpret_cast<uint32_t *>(bd.bits32) + y * bd.lineStride32;
						for(int x = 0; x < width; ++x, p += 3, ++q) {
							*q = 0xFF000000 | (p[2] << 16) | (p[1] << 8) | p[0];
						}
					}
					success = true;
					DeleteObject(hbm);
				} else {
					DeleteDC(hdcMem);
				}
			} else {
				ReleaseDC(0, hdcDesktop);
			}
		}
		FREReleaseBitmapData(argv[0]);
	}
	FREObject rv = 0;
	FRENewObjectFromBool(success ? 1 : 0, &rv);
	return rv;
}
      // Draw text to full-screen sized bitmap, cleared to <bgcolor>
      // Draw boxes for each word on EyeLink tracker display if <dotrack> set
      // Use font selected with get_new_font(), and draws it in <fgcolor>
      // RECT <margins> sets margins, and <lspace> sets pixels between lines
HBITMAP text_bitmap(char *txt, COLORREF fgcolor, COLORREF bgcolor, 
                               RECT margins, int lspace, int dotrack)
{
  HDC hdc;
  HBITMAP hbm;
  HDC mdc;
  HBRUSH oBrush;
  HBITMAP obm;

  hdc = GetDC(NULL);                 
  mdc = CreateCompatibleDC(hdc);     // create display-compatible memory context
  hbm = CreateCompatibleBitmap(hdc, SCRWIDTH, SCRHEIGHT);
  obm = SelectObject(mdc, hbm);      // create DDB bitmap, select into context
                                     
  oBrush = SelectObject(mdc, CreateSolidBrush(bgcolor | 0x02000000L));  // brush to fill with 
  PatBlt(mdc, 0, 0, SCRWIDTH, SCRHEIGHT, PATCOPY);                      // CLEAR BITMAP
  DeleteObject(SelectObject(mdc, oBrush));

  draw_text_box(mdc, txt, fgcolor, margins, lspace, dotrack);  // DRAW THE TEXT

  GdiFlush();     // ADDED for Wimdows 2000/XP: Forces drawing to be immediate      

  SelectBitmap(mdc, obm);     // Release the GDI resources
  DeleteDC(mdc);
  ReleaseDC(NULL, hdc);
  return hbm;                 // Return the new bitmap
}
Ejemplo n.º 5
0
bool Bitmap::create(int widthPixels, int heightPixels)
{
    destroy();

    width = widthPixels;
    height = heightPixels;
    pitch = ((width * 32 + 31) & ~31) >> 3;
    dc = CreateCompatibleDC(0);

    if (!dc)
        return false;

    memset(&info, 0, sizeof(info));

    info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    info.bmiHeader.biBitCount = 32;
    info.bmiHeader.biWidth = width;
    info.bmiHeader.biHeight = -height;
    info.bmiHeader.biCompression = BI_RGB;
    info.bmiHeader.biPlanes = 1;

    hBitmap = CreateDIBSection(dc, &info, DIB_RGB_COLORS,
                               reinterpret_cast<void**>(&m_pBits), 0, 0);

    if (!hBitmap)
    {
        destroy();
        return false;
    }

    GdiFlush();
    return true;
}
Ejemplo n.º 6
0
HBITMAP wf_create_dib(wfInfo* wfi, int width, int height, int bpp, uint8* data)
{
	HDC hdc;
	int negHeight;
	HBITMAP bitmap;
	BITMAPINFO bmi;
	uint8* cdata = NULL;

	/**
	 * See: http://msdn.microsoft.com/en-us/library/dd183376
	 * if biHeight is positive, the bitmap is bottom-up
	 * if biHeight is negative, the bitmap is top-down
	 * Since we get top-down bitmaps, let's keep it that way
	 */

	negHeight = (height < 0) ? height : height * (-1);

	hdc = GetDC(NULL);
	bmi.bmiHeader.biSize = sizeof(BITMAPINFO);
	bmi.bmiHeader.biWidth = width;
	bmi.bmiHeader.biHeight = negHeight;
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biBitCount = 24;
	bmi.bmiHeader.biCompression = BI_RGB;
	bitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &cdata, NULL, 0);

	if (data != NULL)
		freerdp_image_convert(data, cdata, width, height, bpp, 24, wfi->clrconv);

	ReleaseDC(NULL, hdc);
	GdiFlush();

	return bitmap;
}
Ejemplo n.º 7
0
void    plTextGenerator::FlushToHost( void )
{
#if HS_BUILD_FOR_WIN32
    // Flush the GDI first, to make sure it's done
    GdiFlush();

    // Now copy our alpha channel over. I hate the GDI
    uint32_t      i = fHost->fWidth * fHost->fHeight;
    uint32_t      *dest = fWinRGBBits;
    uint8_t       *src = fWinAlphaBits;

/*  while( i-- )
    {
        *dest &= 0x00ffffff;
        *dest |= ( *src ) << 24;
//      *dest |= ( *dest << 16 ) & 0xff000000;
        dest++;
        src++;
    }
*/
    do
    {
        i--;
        dest[ i ] &= 0x00ffffff;
        dest[ i ] |= src[ i ] << 24;
    } while( i );
#endif

    // Dirty the mipmap's deviceRef, if there is one
    if( fHost->GetDeviceRef() != nil )
        fHost->GetDeviceRef()->SetDirty( true );
}
Ejemplo n.º 8
0
static void AeroPaintControl(HWND hwnd, HDC hdc, WNDPROC OldWndProc, UINT msg = WM_PRINT, LPARAM lpFlags = PRF_CLIENT | PRF_NONCLIENT)
{
	HBITMAP hBmp, hOldBmp;
	RECT rc; GetClientRect(hwnd, &rc);
	BYTE *pBits;

	HDC tempDC = CreateCompatibleDC(hdc);

	BITMAPINFO bmi;
	bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
	bmi.bmiHeader.biWidth = rc.right;
	bmi.bmiHeader.biHeight = -rc.bottom;
	bmi.bmiHeader.biPlanes = 1;
	bmi.bmiHeader.biBitCount = 32;
	bmi.bmiHeader.biCompression = BI_RGB;
	hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);

	hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);

	//paint
	SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)TRUE);
	mir_callNextSubclass(hwnd, OldWndProc, msg, (WPARAM)tempDC, lpFlags);
	SetPropA(hwnd, "Miranda.AeroRender.Active", (HANDLE)FALSE);

	// Fix alpha channel
	GdiFlush();
	for (int i = 0; i < rc.right*rc.bottom; i++, pBits += 4)
	if (!pBits[3]) pBits[3] = 255;

	//Copy to output
	BitBlt(hdc, 0, 0, rc.right, rc.bottom, tempDC, 0, 0, SRCCOPY);
	SelectObject(tempDC, hOldBmp);
	DeleteObject(hBmp);
	DeleteDC(tempDC);
}
Ejemplo n.º 9
0
void
__glutFinishMenu(Window win, int x, int y)
{

  unmapMenu(__glutMappedMenu);

  /* XXX Put in a GdiFlush just in case.  Probably unnecessary. -mjk  */
  GdiFlush();

  if (__glutMenuStatusFunc) {
    __glutSetWindow(__glutMenuWindow);
    __glutSetMenu(__glutMappedMenu);

    /* Setting __glutMappedMenu to NULL permits operations that
       change menus or destroy the menu window again. */
    __glutMappedMenu = NULL;

    __glutMenuStatusFunc(GLUT_MENU_NOT_IN_USE, x, y);
  }
  /* Setting __glutMappedMenu to NULL permits operations that
     change menus or destroy the menu window again. */
  __glutMappedMenu = NULL;

  /* If an item is selected and it is not a submenu trigger,
     generate menu callback. */
  if (__glutItemSelected && !__glutItemSelected->isTrigger) {
    __glutSetWindow(__glutMenuWindow);
    /* When menu callback is triggered, current menu should be
       set to the callback menu. */
    __glutSetMenu(__glutItemSelected->menu);
    __glutItemSelected->menu->select(__glutItemSelected->value);
  }
  __glutMenuWindow = NULL;
}
Ejemplo n.º 10
0
static void
gdk_win32_display_sync (GdkDisplay * display)
{
  g_return_if_fail (display == _gdk_display);

  GdiFlush ();
}
Ejemplo n.º 11
0
HBITMAP g_CreateHbitmapFromGdiplusBitmapData32bpp(const Gdiplus::BitmapData & pBitmapData)
{
	pfc::array_t<t_uint8> bm_data;
	bm_data.set_size(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 0);
	bm_data.fill(0);

	BITMAPINFOHEADER bmi;
	memset(&bmi, 0, sizeof(bmi));

	bmi.biSize = sizeof(bmi);
	bmi.biWidth = pBitmapData.Width;
	bmi.biHeight = -pBitmapData.Height;
	bmi.biPlanes = 1;
	bmi.biBitCount = 32;
	bmi.biCompression = BI_RGB;
	bmi.biClrUsed = 0;
	bmi.biClrImportant = 0;

	BITMAPINFO & bi = *(BITMAPINFO*)bm_data.get_ptr();

	bi.bmiHeader = bmi;

	void * data = 0;
	HBITMAP bm = CreateDIBSection(0, &bi, DIB_RGB_COLORS, &data, 0, 0);

	if (data)
	{
		char * ptr = (char*)data;

		GdiFlush();

		memcpy(ptr, pBitmapData.Scan0, pBitmapData.Stride*pBitmapData.Height);
	}
	return bm;
}
Ejemplo n.º 12
0
static int
GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
                const SDL_Rect * rect, int markDirty, void **pixels,
                int *pitch)
{
    GDI_TextureData *data = (GDI_TextureData *) texture->driverdata;

    if (data->yuv) {
        return SDL_SW_LockYUVTexture(data->yuv, rect, markDirty, pixels,
                                     pitch);
    } else if (data->pixels) {
#ifndef _WIN32_WCE
        /* WinCE has no GdiFlush */
        GdiFlush();
#endif
        *pixels =
            (void *) ((Uint8 *) data->pixels + rect->y * data->pitch +
                      rect->x * SDL_BYTESPERPIXEL(texture->format));
        *pitch = data->pitch;
        return 0;
    } else {
        SDL_SetError("No pixels available");
        return -1;
    }
}
Ejemplo n.º 13
0
// returns TRUE if there is a problem such as ERROR_IO_PENDING.
static bool icvGetBitmapData( CvWindow* window, SIZE* size, int* channels, void** data )
{
    BITMAP bmp;
    GdiFlush();
    HGDIOBJ h = GetCurrentObject( window->dc, OBJ_BITMAP );
    if( size )
        size->cx = size->cy = 0;
    if( data )
        *data = 0;

    if (h == NULL)
        return true;
    if (GetObject(h, sizeof(bmp), &bmp) == 0)
        return true;

    if( size )
    {
        size->cx = abs(bmp.bmWidth);
        size->cy = abs(bmp.bmHeight);
    }

    if( channels )
        *channels = bmp.bmBitsPixel/8;

    if( data )
        *data = bmp.bmBits;

    return false;
}
Ejemplo n.º 14
0
void SaveAlpha(LPRECT lpRect)
{
    if (skin.colSavedBits) {
        mir_free(skin.colSavedBits);
        skin.colSavedBits = 0;
    }
    GdiFlush();

    if (lpRect->left < 0) lpRect->left = 0;
    if (lpRect->top < 0) lpRect->top = 0;
    if (lpRect->right - lpRect->left > skin.iWidth) lpRect->right = lpRect->left + skin.iWidth;
    if (lpRect->bottom - lpRect->top > skin.iHeight) lpRect->bottom = lpRect->top + skin.iHeight;

    int x = lpRect->left;
    int y = lpRect->top;
    int w = lpRect->right - lpRect->left;
    int h = lpRect->bottom - lpRect->top;

    skin.colSavedBits = (COLOR32 *)mir_alloc(sizeof(COLOR32) * w * h);
    COLOR32 *p1 = skin.colSavedBits;

    for (int i = 0; i < h; i++) {
        if (i+y < 0) continue;
        if (i+y >= skin.iHeight) break;
        COLOR32 *p2 = skin.colBits + (y+i)*skin.iWidth + x;
        for (int j = 0; j < w; j++) {
            if (j+x < 0) continue;
            if (j+x >= skin.iWidth) break;
            *p1++ = *p2++;
        }
    }
}
Ejemplo n.º 15
0
void IupGLWait(int gl)
{
  if (gl)
    glFinish();
  else
    GdiFlush();
}
Ejemplo n.º 16
0
static void
gdk_gl_pixmap_impl_win32_wait_gdk (GdkGLDrawable *gldrawable)
{
  GdiFlush ();

  /* Sync. */
  gdk_gl_pixmap_sync_gdk (GDK_GL_PIXMAP (gldrawable));
}
Ejemplo n.º 17
0
//static
void drv_win_screen_update(void)
{
    GdiFlush();

    eline = 1;
    RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE/*|RDW_NOERASE*/ );

}
Ejemplo n.º 18
0
/* 
%F cdFlush para Printer.
Termina uma pagina e inicia outra.
*/
static void cdflush(cdCtxCanvas *ctxcanvas)
{
  GdiFlush();
  EndPage(ctxcanvas->hDC);

  StartPage(ctxcanvas->hDC);
  cdwRestoreDC(ctxcanvas);
}
Ejemplo n.º 19
0
// code from Clist Modern by FYR
HRGN CreateOpaqueRgn(BYTE level, bool bOpaque)
{
    if (!skin.colBits)
        return NULL;

    GdiFlush();

    RGBQUAD *buff = (RGBQUAD *)skin.colBits;

    int x,y;
    unsigned int cRect = 64;
    PRGNDATA pRgnData = (PRGNDATA)malloc(sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
    memset(pRgnData, 0, sizeof(RGNDATAHEADER));
    pRgnData->rdh.dwSize = sizeof(RGNDATAHEADER);
    pRgnData->rdh.iType = RDH_RECTANGLES;

    for (y = 0; y < skin.iHeight; ++y) {
        bool inside = false;
        bool lastin = false;
        unsigned int entry = 0;

        for (x = 0; x < skin.iWidth; ++x) {
            inside = bOpaque ? (buff->rgbReserved > level) : (buff->rgbReserved < level);
            ++buff;

            if (inside != lastin) {
                if (inside) {
                    lastin = true;
                    entry = x;
                }
                else {
                    if (pRgnData->rdh.nCount == cRect) {
                        cRect = cRect + 64;
                        pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
                    }

                    SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, skin.iHeight - y, x, skin.iHeight - y + 1);
                    pRgnData->rdh.nCount++;
                    lastin = false;
                }
            }
        }

        if (lastin) {
            if (pRgnData->rdh.nCount == cRect) {
                cRect = cRect + 64;
                pRgnData = (PRGNDATA)realloc(pRgnData, sizeof(RGNDATAHEADER) + (cRect)*sizeof(RECT));
            }

            SetRect(((LPRECT)pRgnData->Buffer) + pRgnData->rdh.nCount, entry, skin.iHeight - y, x, skin.iHeight - y + 1);
            pRgnData->rdh.nCount++;
        }
    }

    HRGN hRgn = ExtCreateRegion(NULL, sizeof(RGNDATAHEADER) + pRgnData->rdh.nCount*sizeof(RECT), (LPRGNDATA)pRgnData);
    free(pRgnData);
    return hRgn;
}
Ejemplo n.º 20
0
// Copy data from the memory bitmap into a buffer
void
vncDesktop::CopyToBuffer(const rfb::Rect &rect, BYTE *destbuff, UINT destbuffsize)
{
	// Finish drawing anything in this thread 
	// Wish we could do this for the whole system - maybe we should
	// do something with LockWindowUpdate here.
	GdiFlush();

	// Are we being asked to blit from the DIBsection to itself?
	if (destbuff == m_DIBbits) {
		// Yes.  Ignore the request!
		return;
	}

	int y_inv;
	BYTE * destbuffpos;

	// Calculate the scanline-ordered y position to copy from
	y_inv = m_scrinfo.framebufferHeight-rect.tl.y-(rect.br.y-rect.tl.y);

	// Calculate where in the output buffer to put the data
	destbuffpos = destbuff + (m_bytesPerRow * rect.tl.y);

	// Set the number of bytes for GetDIBits to actually write
	// NOTE : GetDIBits pads the destination buffer if biSizeImage < no. of bytes required
	m_bminfo.bmi.bmiHeader.biSizeImage = (rect.br.y-rect.tl.y) * m_bytesPerRow;

	// Get the actual bits from the bitmap into the bit buffer
	// If fast (DIBsection) blits are disabled then use the old GetDIBits technique
	if (m_DIBbits == NULL) {
		if (GetDIBits(m_hmemdc, m_membitmap, y_inv,
					(rect.br.y-rect.tl.y), destbuffpos,
					&m_bminfo.bmi, DIB_RGB_COLORS) == 0)
		{
			_RPT1(_CRT_WARN, "vncDesktop : [1] GetDIBits failed! %d\n", GetLastError());
			_RPT3(_CRT_WARN, "vncDesktop : thread = %d, DC = %d, bitmap = %d\n", omni_thread::self(), m_hmemdc, m_membitmap);
			_RPT2(_CRT_WARN, "vncDesktop : y = %d, height = %d\n", y_inv, (rect.br.y-rect.tl.y));
		}
	} else {
		// Fast blits are enabled.  [I have a sneaking suspicion this will never get used, unless
		// something weird goes wrong in the code.  It's here to keep the function general, though!]

		int bytesPerPixel = m_scrinfo.format.bitsPerPixel / 8;
		BYTE *srcbuffpos = (BYTE*)m_DIBbits;

		srcbuffpos += (m_bytesPerRow * rect.tl.y) + (bytesPerPixel * rect.tl.x);
		destbuffpos += bytesPerPixel * rect.tl.x;

		int widthBytes = (rect.br.x-rect.tl.x) * bytesPerPixel;

		for(int y = rect.tl.y; y < rect.br.y; y++)
		{
			memcpy(destbuffpos, srcbuffpos, widthBytes);
			srcbuffpos += m_bytesPerRow;
			destbuffpos += m_bytesPerRow;
		}
	}
}
Ejemplo n.º 21
0
/*
 * InterfaceDrawBarBorder:  Draw border around a graph bar; the bar occupies
 *   the area "a" on hdc.
 */
void InterfaceDrawBarBorder( RawBitmap* prawbmpBackground, HDC hdc, AREA *a )
{
  int i, x, y;
  InterfaceElement *e;
  Bool vertical;

  elements[ELEMENT_BARRIGHT].x = a->cx;

  for (i = ELEMENT_BARLEFT; i <= ELEMENT_BARRIGHT; i++)
  {
    OffscreenWindowBackground(prawbmpBackground, a->x + elements[i].x, a->y + elements[i].y, 
			      elements[i].width, elements[i].height);
    
    OffscreenBitBlt(hdc, a->x + elements[i].x, a->y + elements[i].y, 
		    elements[i].width, elements[i].height,
		    elements[i].bits, 0, 0, DIBWIDTH(elements[i].width), 
		    OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
    GdiFlush();
  }

  repeaters[ELEMENT_BARBOTTOM].element.y = a->cy;

  for (i = ELEMENT_BARTOP; i <= ELEMENT_BARBOTTOM; i++)
  {
    e = &repeaters[i].element;
    x = e->x + a->x;
    y = e->y + a->y;
    vertical = repeaters[i].vertical;

    while (1)
    {
      if ((vertical && y >= a->y + a->cy) || (!vertical && x >= a->x + a->cx))
	break;

      OffscreenWindowBackground(prawbmpBackground, x, y, e->width, e->height);
      OffscreenBitBlt(hdc, x, y, e->width, e->height, e->bits, 0, 0, DIBWIDTH(e->width), 
		      OBB_COPY | OBB_FLIP | OBB_TRANSPARENT);
      if (vertical)
	y += e->height;
      else x += e->width;

      GdiFlush();
    }
  }
}
Ejemplo n.º 22
0
QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWidget *)
{
#ifndef Q_WS_WINCE
    Q_UNUSED(isTextBuffer);
#endif
    BITMAPINFO_MASK bmi;
    memset(&bmi, 0, sizeof(bmi));
    bmi.bmiHeader.biSize        = sizeof(BITMAPINFOHEADER);
    bmi.bmiHeader.biWidth       = width;
    bmi.bmiHeader.biHeight      = -height;
    bmi.bmiHeader.biPlanes      = 1;
    bmi.bmiHeader.biSizeImage   = 0;

    if (format == QImage::Format_RGB16) {
        bmi.bmiHeader.biBitCount = 16;
#ifdef Q_WS_WINCE
        if (isTextBuffer) {
            bmi.bmiHeader.biCompression = BI_RGB;
            bmi.redMask = 0;
            bmi.greenMask = 0;
            bmi.blueMask = 0;
        } else
#endif
        {
            bmi.bmiHeader.biCompression = BI_BITFIELDS;
            bmi.redMask = 0xF800;
            bmi.greenMask = 0x07E0;
            bmi.blueMask = 0x001F;
        }
    } else {
        bmi.bmiHeader.biBitCount    = 32;
        bmi.bmiHeader.biCompression = BI_RGB;
        bmi.redMask = 0;
        bmi.greenMask = 0;
        bmi.blueMask = 0;
    }

    HDC display_dc = GetDC(0);
    hdc = CreateCompatibleDC(display_dc);
    ReleaseDC(0, display_dc);
    Q_ASSERT(hdc);

    uchar *bits = 0;
    bitmap = CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO *>(&bmi), DIB_RGB_COLORS, (void**) &bits, 0, 0);
    Q_ASSERT(bitmap);
    Q_ASSERT(bits);

    null_bitmap = (HBITMAP)SelectObject(hdc, bitmap);
    image = QImage(bits, width, height, format);

    Q_ASSERT(image.paintEngine()->type() == QPaintEngine::Raster);
    static_cast<QRasterPaintEngine *>(image.paintEngine())->setDC(hdc);

#ifndef Q_WS_WINCE
    GdiFlush();
#endif
}
Ejemplo n.º 23
0
// Video initialize
int VideoRend_GDI_Init(HWND hWnd, int width, int height, int fullscreen)
{
	BITMAPINFO BitmapInfo;
	RECT fsRect;

	// Bitmap Structure
	BitmapInfo.bmiHeader.biSize = sizeof(BitmapInfo.bmiHeader);
	BitmapInfo.bmiHeader.biWidth = width;
	BitmapInfo.bmiHeader.biHeight = -height;
	BitmapInfo.bmiHeader.biPlanes = 1;
	BitmapInfo.bmiHeader.biBitCount = 32;
	BitmapInfo.bmiHeader.biCompression = BI_RGB;
	BitmapInfo.bmiHeader.biSizeImage = 0;
	BitmapInfo.bmiHeader.biXPelsPerMeter = 96;
	BitmapInfo.bmiHeader.biYPelsPerMeter = 96;
	BitmapInfo.bmiHeader.biClrUsed = 0;
	BitmapInfo.bmiHeader.biClrImportant = 0;
	RendHDC[0] = CreateCompatibleDC(NULL);
	RendHDC[1] = CreateCompatibleDC(NULL);
	if (!RendHDC[0] || !RendHDC[1]) {
		MessageBox(0, "Can't create compatible DC", "GDI Video", MB_OK | MB_ICONERROR);
		VideoRend_GDI_Terminate();
		return 0;
	}

	// Create DIB Bitmap
	RendImgWidth = width;
	RendImgHeight = height;
	RendBitmap[0] = CreateDIBSection(RendHDC[0], &BitmapInfo, DIB_RGB_COLORS, (void **)&RendVideoBuff[0], NULL, 0);
	RendBitmap[1] = CreateDIBSection(RendHDC[1], &BitmapInfo, DIB_RGB_COLORS, (void **)&RendVideoBuff[1], NULL, 0);
	if (!RendBitmap[0] || !RendBitmap[1]) {
		MessageBox(0, "Can't create bitmap", "GDI Video", MB_OK | MB_ICONERROR);
		VideoRend_GDI_Terminate();
		return 0;
	}

	// Assign DIB Bitmap into the device
	GdiFlush();
	SelectObject(RendHDC[0], RendBitmap[0]);
	SelectObject(RendHDC[1], RendBitmap[1]);

	// Fullscreen
	if (fullscreen) {
		GetWindowRect(GetDesktopWindow(), &fsRect);
		MoveWindow(hWnd, 0, 0, fsRect.right, fsRect.bottom, 0);
	}

	// Clear the image
	RendFrame = 0;
	RendWasInit = 1;
	VideoRend_GDI_ClearVideo();
	VideoRend_GDI_Flip(hWnd);
	VideoRend_GDI_ClearVideo();

	return 32;
}
Ejemplo n.º 24
0
static void
_gdk_win32_gl_window_impl_wait_gdk (GdkGLWindow *glwindow)
{
  g_return_if_fail (GDK_IS_WIN32_GL_WINDOW (glwindow));

  GdiFlush ();

  /* Get DC. */
  GDK_GL_WINDOW_IMPL_WIN32_HDC_GET (GDK_GL_WINDOW_IMPL_WIN32 (glwindow->impl));
}
Ejemplo n.º 25
0
void RWindows::Destroy()
	{
	GdiFlush();
	if (iHbitmap) DeleteObject(iHbitmap);
	if (iH90bitmap) DeleteObject(iH90bitmap);
	GlobalFree(iBitmapInfo);
	GlobalFree(i90BitmapInfo);
	if (iHwnd && iHdc) ReleaseDC(iHwnd,iHdc);
	GlobalFree(iEpocBitmapBits);
	GlobalFree(this);
	}
Ejemplo n.º 26
0
/**
 * cairo_win32_surface_get_image:
 * @surface: a #cairo_surface_t
 *
 * Returns a #cairo_surface_t image surface that refers to the same bits
 * as the DIB of the Win32 surface.  If the passed-in win32 surface
 * is not a DIB surface, %NULL is returned.
 *
 * Return value: a #cairo_surface_t (owned by the win32 #cairo_surface_t),
 * or %NULL if the win32 surface is not a DIB.
 *
 * Since: 1.4
 **/
cairo_surface_t *
cairo_win32_surface_get_image (cairo_surface_t *surface)
{

    if (! _cairo_surface_is_win32 (surface)) {
        return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
    }

    GdiFlush();
    return to_win32_display_surface(surface)->image;
}
Ejemplo n.º 27
0
void CLCDGfxBase::EndDraw(void)
{
    LCDUIASSERT(NULL != m_hPrevBitmap);
    if(NULL != m_hPrevBitmap)
    {
        GdiFlush();
        m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap);
        LCDUIASSERT(m_hPrevBitmap == m_hBitmap);
        m_hPrevBitmap = NULL;
    }
}
Ejemplo n.º 28
0
static void gui_button_cb_play (Manual me, GuiButtonEvent /* event */) {
	GuiThing_setSensitive (my recordButton,  false);
	GuiThing_setSensitive (my playButton,    false);
	GuiThing_setSensitive (my publishButton, false);
	#if defined (_WIN32)
		GdiFlush ();
	#endif
	Melder_play ();
	GuiThing_setSensitive (my recordButton,  true);
	GuiThing_setSensitive (my playButton,    true);
	GuiThing_setSensitive (my publishButton, true);
}
Ejemplo n.º 29
-1
void WINLcdFlip::updateWindow(void)
{
// フリップしているので、普通の転送は不可

	int x, y;
	unsigned char const *p;

	int realHeight;
	int realWidth;

	realHeight = cmlcd->getRealHeight240();
	realWidth  = cmlcd->getRealWidth320();

	for(y=0; y < realHeight; y++)
	{
		p = cmlcd->getCMLcdFunc()->getPixelArray(0, y);

		for(x=0; x < realWidth; x++, p++)
		{
	//			*(dibData + (realWidth - 1 - x) * byte_per_line + (realHeight - 1 - y)) = *p;
			*(dibData + x * byte_per_line + (realHeight - 1 - y)) = *p;
		}
	}

	GdiFlush();
	BitBlt(hDC_wnd, 0, 0, realHeight, realWidth, hDC, 0, 0, SRCCOPY);

}
Ejemplo n.º 30
-1
static LICE_IBitmap *hbmToBit(HBITMAP hbm, LICE_IBitmap *bmp)
{
  BITMAP bm;
  GetObject(hbm, sizeof(BITMAP), (LPSTR)&bm);

  LICE_SysBitmap sysbitmap(bm.bmWidth,bm.bmHeight);
  
#ifdef _WIN32
  HDC hdc=CreateCompatibleDC(NULL);
  HGDIOBJ oldBM=SelectObject(hdc,hbm);

  BitBlt(sysbitmap.getDC(),0,0,bm.bmWidth,bm.bmHeight,hdc,0,0,SRCCOPY);
  GdiFlush();

  if (!bmp) bmp=new LICE_MemBitmap(bm.bmWidth,bm.bmHeight);
  LICE_Copy(bmp,&sysbitmap);

  SelectObject(hdc,oldBM);
  DeleteDC(hdc);
  #else
  LICE_Clear(&sysbitmap,0);
  RECT r={0,0,bm.bmWidth,bm.bmHeight};
  DrawImageInRect(sysbitmap.getDC(),hbm,&r);
  if (!bmp) bmp=new LICE_MemBitmap(bm.bmWidth,bm.bmHeight);
  LICE_Copy(bmp,&sysbitmap);
  #endif

  LICE_FillRect(bmp,0,0,bmp->getWidth(),bmp->getHeight(),LICE_RGBA(0,0,0,255),1.0f,LICE_BLIT_MODE_ADD);

  return bmp;
}