/*********************************************************************** * macdrv_surface_flush */ static void macdrv_surface_flush(struct window_surface *window_surface) { struct macdrv_window_surface *surface = get_mac_surface(window_surface); CGRect rect; HRGN region; window_surface->funcs->lock(window_surface); TRACE("flushing %p %s bounds %s bits %p\n", surface, wine_dbgstr_rect(&surface->header.rect), wine_dbgstr_rect(&surface->bounds), surface->bits); rect = cgrect_from_rect(surface->bounds); rect = CGRectOffset(rect, surface->header.rect.left, surface->header.rect.top); if (!IsRectEmpty(&surface->bounds) && (region = CreateRectRgnIndirect(&surface->bounds))) { if (surface->drawn) { CombineRgn(surface->drawn, surface->drawn, region, RGN_OR); DeleteObject(region); } else surface->drawn = region; } update_blit_data(surface); reset_bounds(&surface->bounds); window_surface->funcs->unlock(window_surface); if (!CGRectIsEmpty(rect)) macdrv_window_needs_display(surface->window, rect); }
PushN8AbsNormFeetDevice::PushN8AbsNormFeetDevice() { lastReading = 0; lastReadingSide = 'R'; reset_bounds(); }
/*********************************************************************** * create_surface */ struct window_surface *create_surface(macdrv_window window, const RECT *rect, struct window_surface *old_surface, BOOL use_alpha) { struct macdrv_window_surface *surface; struct macdrv_window_surface *old_mac_surface = get_mac_surface(old_surface); int width = rect->right - rect->left, height = rect->bottom - rect->top; DWORD *colors; pthread_mutexattr_t attr; int err; DWORD window_background; surface = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(struct macdrv_window_surface, info.bmiColors[3])); if (!surface) return NULL; err = pthread_mutexattr_init(&attr); if (!err) { err = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); if (!err) err = pthread_mutex_init(&surface->mutex, &attr); pthread_mutexattr_destroy(&attr); } if (err) { HeapFree(GetProcessHeap(), 0, surface); return NULL; } surface->info.bmiHeader.biSize = sizeof(surface->info.bmiHeader); surface->info.bmiHeader.biWidth = width; surface->info.bmiHeader.biHeight = height; /* bottom-up */ surface->info.bmiHeader.biPlanes = 1; surface->info.bmiHeader.biBitCount = 32; surface->info.bmiHeader.biSizeImage = get_dib_image_size(&surface->info); surface->info.bmiHeader.biCompression = BI_RGB; surface->info.bmiHeader.biClrUsed = 0; colors = (DWORD *)((char *)&surface->info + surface->info.bmiHeader.biSize); colors[0] = 0x00ff0000; colors[1] = 0x0000ff00; colors[2] = 0x000000ff; surface->header.funcs = &macdrv_surface_funcs; surface->header.rect = *rect; surface->header.ref = 1; surface->window = window; reset_bounds(&surface->bounds); if (old_mac_surface && old_mac_surface->drawn) { surface->drawn = CreateRectRgnIndirect(rect); OffsetRgn(surface->drawn, -rect->left, -rect->top); if (CombineRgn(surface->drawn, surface->drawn, old_mac_surface->drawn, RGN_AND) <= NULLREGION) { DeleteObject(surface->drawn); surface->drawn = 0; } } update_blit_data(surface); surface->use_alpha = use_alpha; surface->bits = HeapAlloc(GetProcessHeap(), 0, surface->info.bmiHeader.biSizeImage); if (!surface->bits) goto failed; window_background = macdrv_window_background_color(); memset_pattern4(surface->bits, &window_background, surface->info.bmiHeader.biSizeImage); TRACE("created %p for %p %s bits %p-%p\n", surface, window, wine_dbgstr_rect(rect), surface->bits, surface->bits + surface->info.bmiHeader.biSizeImage); return &surface->header; failed: macdrv_surface_destroy(&surface->header); return NULL; }
BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, void * grad_array, ULONG ngrad, ULONG mode ) { DC *dc = get_nulldrv_dc( dev ); char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; BITMAPINFO *info = (BITMAPINFO *)buffer; struct bitblt_coords src, dst; struct gdi_image_bits bits; unsigned int i; POINT *pts; BOOL ret = FALSE; DWORD err; HRGN rgn; if (!(pts = HeapAlloc( GetProcessHeap(), 0, nvert * sizeof(*pts) ))) return FALSE; for (i = 0; i < nvert; i++) { pts[i].x = vert_array[i].x; pts[i].y = vert_array[i].y; } LPtoDP( dev->hdc, pts, nvert ); /* compute bounding rect of all the rectangles/triangles */ reset_bounds( &dst.visrect ); for (i = 0; i < ngrad * (mode == GRADIENT_FILL_TRIANGLE ? 3 : 2); i++) { ULONG v = ((ULONG *)grad_array)[i]; dst.visrect.left = min( dst.visrect.left, pts[v].x ); dst.visrect.top = min( dst.visrect.top, pts[v].y ); dst.visrect.right = max( dst.visrect.right, pts[v].x ); dst.visrect.bottom = max( dst.visrect.bottom, pts[v].y ); } dst.x = dst.visrect.left; dst.y = dst.visrect.top; dst.width = dst.visrect.right - dst.visrect.left; dst.height = dst.visrect.bottom - dst.visrect.top; if (!clip_visrect( dc, &dst.visrect, &dst.visrect )) goto done; /* query the bitmap format */ info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biPlanes = 1; info->bmiHeader.biBitCount = 0; info->bmiHeader.biCompression = BI_RGB; info->bmiHeader.biXPelsPerMeter = 0; info->bmiHeader.biYPelsPerMeter = 0; info->bmiHeader.biClrUsed = 0; info->bmiHeader.biClrImportant = 0; info->bmiHeader.biWidth = dst.visrect.right - dst.visrect.left; info->bmiHeader.biHeight = dst.visrect.bottom - dst.visrect.top; info->bmiHeader.biSizeImage = 0; dev = GET_DC_PHYSDEV( dc, pPutImage ); err = dev->funcs->pPutImage( dev, 0, info, NULL, NULL, NULL, 0 ); if (err && err != ERROR_BAD_FORMAT) goto done; info->bmiHeader.biSizeImage = get_dib_image_size( info ); if (!(bits.ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, info->bmiHeader.biSizeImage ))) goto done; bits.is_copy = TRUE; bits.free = free_heap_bits; /* make src and points relative to the bitmap */ src = dst; src.x -= dst.visrect.left; src.y -= dst.visrect.top; offset_rect( &src.visrect, -dst.visrect.left, -dst.visrect.top ); for (i = 0; i < nvert; i++) { pts[i].x -= dst.visrect.left; pts[i].y -= dst.visrect.top; } rgn = CreateRectRgn( 0, 0, 0, 0 ); gradient_bitmapinfo( info, bits.ptr, vert_array, nvert, grad_array, ngrad, mode, pts, rgn ); OffsetRgn( rgn, dst.visrect.left, dst.visrect.top ); ret = !dev->funcs->pPutImage( dev, rgn, info, &bits, &src, &dst, SRCCOPY ); if (bits.free) bits.free( &bits ); DeleteObject( rgn ); done: HeapFree( GetProcessHeap(), 0, pts ); return ret; }
void PushN8AbsNormFeetDevice::start_readings() { reset_bounds(); }