Lines Matching refs:This

13  * This library is free software; you can redistribute it and/or
18 * This library is distributed in the hope that it will be useful,
46 void surface_gdi_cleanup(IWineD3DSurfaceImpl *This)
48 TRACE("(%p) : Cleaning up.\n", This);
50 if (This->Flags & SFLAG_DIBSECTION)
53 SelectObject(This->hDC, This->dib.holdbitmap);
54 DeleteDC(This->hDC);
56 DeleteObject(This->dib.DIBsection);
57 This->dib.bitmap_data = NULL;
58 This->resource.allocatedMemory = NULL;
61 if (This->Flags & SFLAG_USERPTR) IWineD3DSurface_SetMem((IWineD3DSurface *)This, NULL);
62 if (This->overlay_dest) list_remove(&This->overlay_entry);
64 HeapFree(GetProcessHeap(), 0, This->palette9);
66 resource_cleanup((IWineD3DResource *)This);
77 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
78 ULONG ref = InterlockedDecrement(&This->resource.ref);
79 TRACE("(%p) : Releasing from %d\n", This, ref + 1);
83 surface_gdi_cleanup(This);
85 TRACE("(%p) Released.\n", This);
86 HeapFree(GetProcessHeap(), 0, This);
95 * This call is unsupported on GDI surfaces, if it's called something went
110 * This call is unsupported on GDI surfaces, if it's called something went
142 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
145 if(This->Flags & SFLAG_LOCKED)
147 WARN("(%p) Surface already locked\n", This);
151 This->Flags |= SFLAG_LOCKED;
153 if(!This->resource.allocatedMemory) {
154 /* This happens on gdi surfaces if the application set a user pointer and resets it.
158 This->resource.allocatedMemory = This->dib.bitmap_data;
167 * Unlocks a surface. This implementation doesn't do much, except updating
178 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
180 TRACE("(%p)\n", This);
182 if (!(This->Flags & SFLAG_LOCKED))
184 WARN("trying to Unlock an unlocked surf@%p\n", This);
196 This, This->texture_target, This->texture_level, gen);
214 x11_copy_to_screen(swapchain, &This->lockedRect);
219 This->Flags &= ~SFLAG_LOCKED;
220 memset(&This->lockedRect, 0, sizeof(RECT));
228 * the parent library. This implementation changes the data pointers of the
262 * This is mutually unsupported by GDI surfaces
278 * This method writes the surface's contents to the in tga format to the
309 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
310 const struct wined3d_format_desc *format_desc = This->resource.format_desc;
314 if (This->pow2Width > size) {
315 output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pow2Width * 3);
316 size = This->pow2Width;
325 fprintf(f, "P6\n%d %d\n255\n", This->pow2Width, This->pow2Height);
327 if (This->resource.format_desc->format == WINED3DFMT_P8_UINT)
332 if (This->palette == NULL) {
337 table[i][0] = This->palette->palents[i].peRed;
338 table[i][1] = This->palette->palents[i].peGreen;
339 table[i][2] = This->palette->palents[i].peBlue;
341 for (y = 0; y < This->pow2Height; y++) {
342 unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
343 for (x = 0; x < This->pow2Width; x++) {
351 fwrite(output, 3 * This->pow2Width, 1, f);
363 for (y = 0; y < This->pow2Height; y++) {
364 const unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
365 for (x = 0; x < This->pow2Width; x++) {
383 fwrite(output, 3 * This->pow2Width, 1, f);
391 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
396 TRACE("(%p)->(%p)\n",This,pHDC);
398 if(!(This->Flags & SFLAG_DIBSECTION))
404 if(This->Flags & SFLAG_USERPTR) {
410 if (This->Flags & SFLAG_DCINUSE)
414 if (This->Flags & SFLAG_LOCKED)
432 if (This->resource.format_desc->format == WINED3DFMT_P8_UINT
433 || This->resource.format_desc->format == WINED3DFMT_P8_UINT_A8_UNORM)
438 if(This->palette) {
439 pal = This->palette->palents;
443 swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[This->resource.device->NumberOfSwapChains-1];
456 SetDIBColorTable(This->hDC, 0, 256, col);
460 *pHDC = This->hDC;
462 This->Flags |= SFLAG_DCINUSE;
468 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
470 TRACE("(%p)->(%p)\n",This,hDC);
472 if (!(This->Flags & SFLAG_DCINUSE))
475 if (This->hDC !=hDC) {
476 WARN("Application tries to release an invalid DC(%p), surface dc is %p\n", hDC, This->hDC);
483 This->Flags &= ~SFLAG_DCINUSE;
489 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
491 IWineD3DPaletteImpl *pal = This->palette;
494 TRACE("(%p)\n", This);
498 if(This->Flags & SFLAG_DIBSECTION) {
499 TRACE("(%p): Updating the hdc's palette\n", This);
506 SetDIBColorTable(This->hDC, 0, 256, col);
544 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
547 if(This->resource.usage & WINED3DUSAGE_OVERLAY)
549 ERR("(%p) Overlays not yet supported by GDI surfaces\n", This);
559 HeapFree(GetProcessHeap(), 0, This->resource.heapMemory);
560 This->resource.heapMemory = NULL;
561 This->resource.allocatedMemory = This->dib.bitmap_data;
565 This->pow2Width = This->currentDesc.Width;
566 This->pow2Height = This->currentDesc.Height;
572 IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
575 if(This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
580 if(This->Flags & (SFLAG_LOCKED | SFLAG_DCINUSE)) {
585 if(Mem && Mem != This->resource.allocatedMemory) {
589 if(This->Flags & SFLAG_DIBSECTION) {
594 SelectObject(This->hDC, This->dib.holdbitmap);
595 DeleteDC(This->hDC);
597 DeleteObject(This->dib.DIBsection);
598 This->dib.bitmap_data = NULL;
599 This->resource.allocatedMemory = NULL;
600 This->hDC = NULL;
601 This->Flags &= ~SFLAG_DIBSECTION;
602 } else if(!(This->Flags & SFLAG_USERPTR)) {
603 release = This->resource.allocatedMemory;
605 This->resource.allocatedMemory = Mem;
606 This->Flags |= SFLAG_USERPTR | SFLAG_INSYSMEM;
610 } else if(This->Flags & SFLAG_USERPTR) {
612 This->resource.allocatedMemory = NULL;
613 This->Flags &= ~SFLAG_USERPTR;
649 /* FIXME: This vtable should not use any IWineD3DSurface* implementation functions,