/********************************************************************** * pattern_brush * * Fill a number of rectangles with the pattern brush * FIXME: Should we insist l < r && t < b? Currently we assume this. */ static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects) { int i, j; const WINEREGION *clip; POINT origin; if(pdev->brush_and_bits == NULL) { switch(pdev->brush_style) { case BS_DIBPATTERN: if(!create_pattern_brush_bits(pdev)) return FALSE; break; case BS_HATCHED: if(!create_hatch_brush_bits(pdev)) return FALSE; break; default: ERR("Unexpected brush style %d\n", pdev->brush_style); return FALSE; } } GetBrushOrgEx(pdev->dev.hdc, &origin); clip = get_wine_region(pdev->clip); for(i = 0; i < num; i++) { for(j = 0; j < clip->numRects; j++) { RECT rect = rects[i]; /* Optimize unclipped case */ if(clip->rects[j].top <= rect.top && clip->rects[j].bottom >= rect.bottom && clip->rects[j].left <= rect.left && clip->rects[j].right >= rect.right) { pdev->dib.funcs->pattern_rects(&pdev->dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits); break; } if(clip->rects[j].top >= rect.bottom) break; if(clip->rects[j].bottom <= rect.top) continue; if(clip->rects[j].right > rect.left && clip->rects[j].left < rect.right) { rect.left = max(rect.left, clip->rects[j].left); rect.top = max(rect.top, clip->rects[j].top); rect.right = min(rect.right, clip->rects[j].right); rect.bottom = min(rect.bottom, clip->rects[j].bottom); pdev->dib.funcs->pattern_rects(&pdev->dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits); } } } release_wine_region(pdev->clip); return TRUE; }
BOOL FAR PASCAL MGetBrushOrg(HDC hdc, INT FAR * px, INT FAR * py) { DWORD dwLocation; dwLocation = GetBrushOrgEx(hdc); if (px != NULL) *px = (INT)LOWORD(dwLocation); if (py != NULL) *py = (INT)HIWORD(dwLocation); return(TRUE); }
void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact) { if (dat->use_avatar_service) { if (dat->avatars_show && !DBGetContactSettingByte(contact->hContact, "CList", "HideContactAvatar", 0)) { contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) { contact->avatar_data = NULL; } if (contact->avatar_data != NULL) contact->avatar_data->t_lastAccess = time(NULL); } else { contact->avatar_data = NULL; } } else { int old_pos = contact->avatar_pos; contact->avatar_pos = AVATAR_POS_DONT_HAVE; if (dat->avatars_show && !DBGetContactSettingByte(contact->hContact, "CList", "HideContactAvatar", 0)) { DBVARIANT dbv; if (!DBGetContactSetting(contact->hContact, "ContactPhoto", "File", &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)) { HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal); if (hBmp != NULL) { // Make bounds BITMAP bm; if (GetObject(hBmp,sizeof(BITMAP),&bm)) { // Create data... HDC hdc; HBITMAP hDrawBmp,oldBmp; // Make bounds -> keep aspect radio LONG width_clip; LONG height_clip; RECT rc = {0}; // Clipping width and height width_clip = dat->avatars_size; height_clip = dat->avatars_size; if (height_clip * bm.bmWidth / bm.bmHeight <= width_clip) { width_clip = height_clip * bm.bmWidth / bm.bmHeight; } else { height_clip = width_clip * bm.bmHeight / bm.bmWidth; } // Create objs hdc = CreateCompatibleDC(dat->avatar_cache.hdc); hDrawBmp = CreateBitmap32(width_clip, height_clip); oldBmp=SelectObject(hdc, hDrawBmp); SetBkMode(hdc,TRANSPARENT); { POINT org; GetBrushOrgEx(hdc, &org); SetStretchBltMode(hdc, HALFTONE); SetBrushOrgEx(hdc, org.x, org.y, NULL); } rc.right = width_clip - 1; rc.bottom = height_clip - 1; // Draw bitmap 8//8 { HDC dcMem = CreateCompatibleDC(hdc); HBITMAP obmp=SelectObject(dcMem, hBmp); StretchBlt(hdc, 0, 0, width_clip, height_clip,dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); SelectObject(dcMem,obmp); DeleteDC(dcMem); } { RECT rtr={0}; rtr.right=width_clip+1; rtr.bottom=height_clip+1; FillRect255Alpha(hdc,&rtr); } hDrawBmp = GetCurrentObject(hdc, OBJ_BITMAP); SelectObject(hdc,oldBmp); DeleteDC(hdc); // Add to list if (old_pos >= 0) { ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); contact->avatar_pos = old_pos; } else { contact->avatar_pos = ImageArray_AddImage(&dat->avatar_cache, hDrawBmp, -1); } DeleteObject(hDrawBmp); } // if (GetObject(hBmp,sizeof(BITMAP),&bm)) DeleteObject(hBmp); } //if (hBmp != NULL) } DBFreeVariant(&dbv); } // Remove avatar if needed if (old_pos >= 0 && contact->avatar_pos == AVATAR_POS_DONT_HAVE) { ImageArray_RemoveImage(&dat->avatar_cache, old_pos); // Update all itens ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); } } }
// Remove an image BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos) { int new_width, new_height; HBITMAP hNewBmp; HDC hdc_old; int i; if (pos < 0) return FALSE; if (pos >= iad->nodes_size) return FALSE; EnterCriticalSection(&iad->cs); // Get bounds if (iad->width_based) { new_width = iad->width; new_height = iad->height - iad->nodes[pos].height; } else { new_width = iad->width - iad->nodes[pos].width; new_height = iad->height; } // Alloc image hNewBmp = ImageArray_CreateBitmap(new_width, new_height); if (hNewBmp == NULL) { LeaveCriticalSection(&iad->cs); return FALSE; } // Move image... // Set some draw states SelectObject(iad->hdc, hNewBmp); hdc_old = CreateCompatibleDC(iad->hdc); SetBkMode(iad->hdc, TRANSPARENT); { POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); } { int x = 0, y = 0, w = 0, h = 0; if (pos > 0) { SelectObject(hdc_old, iad->img); if (iad->width_based) { w = iad->width; h = 0; for(i = 0; i < pos; i++) { h += iad->nodes[i].height; } } else { h = iad->height; w = 0; for(i = 0; i < pos; i++) { w += iad->nodes[i].width; } } BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY); } if (pos < iad->nodes_size - 1) { int ox, oy; SelectObject(hdc_old, iad->img); if (iad->width_based) { ox = 0; oy = h + iad->nodes[pos].height; x = 0; y = h; w = iad->width; h = iad->height - h - iad->nodes[pos].height; } else { ox = w + iad->nodes[pos].width; oy = 0; x = w; y = 0; w = iad->width - w - iad->nodes[pos].width; h = iad->height; } BitBlt(iad->hdc, x, y, w, h, hdc_old, ox, oy, SRCCOPY); } } // restore things DeleteDC(hdc_old); if (iad->img != NULL) DeleteObject(iad->img); iad->img = hNewBmp; // Move array if (pos < iad->nodes_size - 1) { memmove(&iad->nodes[pos], &iad->nodes[pos + 1], (iad->nodes_size - pos - 1) * sizeof(IMAGE_ARRAY_DATA_NODE)); } iad->nodes_size--; iad->width = new_width; iad->height = new_height; // Free array ImageArray_Alloc(iad, iad->nodes_size); // Finished it! LeaveCriticalSection(&iad->cs); return pos; }
// Change an image in the list (return TRUE on success) BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos) { BITMAP bm; int new_width, new_height; HBITMAP hNewBmp; HDC hdc_old; int i; if (hBmp == NULL) return FALSE; if (pos < 0) return FALSE; if (pos >= iad->nodes_size) return FALSE; EnterCriticalSection(&iad->cs); // Get bounds if (!GetObject(hBmp,sizeof(BITMAP),&bm)) { LeaveCriticalSection(&iad->cs); return FALSE; } if (iad->width_based) { new_width = max(bm.bmWidth, iad->width); new_height = iad->height + bm.bmHeight - iad->nodes[pos].height; } else { new_width = bm.bmWidth + iad->width - iad->nodes[pos].width; new_height = max(iad->height, bm.bmHeight); } // Alloc image hNewBmp = ImageArray_CreateBitmap(new_width, new_height); if (hNewBmp == NULL) { LeaveCriticalSection(&iad->cs); return FALSE; } // Move image... // Set some draw states SelectObject(iad->hdc, hNewBmp); hdc_old = CreateCompatibleDC(iad->hdc); SetBkMode(iad->hdc, TRANSPARENT); { POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); } { int x = 0, y = 0, w = 0, h = 0; // 1- old data if (pos > 0) { SelectObject(hdc_old, iad->img); if (iad->width_based) { w = iad->width; h = 0; for(i = 0; i < pos; i++) { h += iad->nodes[i].height; } } else { h = iad->height; w = 0; for(i = 0; i < pos; i++) { w += iad->nodes[i].width; } } BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY); } // 2- new image if (iad->width_based) { x = 0; y = h; } else { x = w; y = 0; } SelectObject(hdc_old, hBmp); BitBlt(iad->hdc, x, y, bm.bmWidth, bm.bmHeight, hdc_old, 0, 0, SRCCOPY); // 3- old data if (pos < iad->nodes_size - 1) { int ox, oy; SelectObject(hdc_old, iad->img); if (iad->width_based) { ox = 0; oy = y + iad->nodes[pos].height; x = 0; y += bm.bmHeight; w = iad->width; h = iad->height - h - iad->nodes[pos].height; } else { ox = x + iad->nodes[pos].width; oy = 0; x += bm.bmWidth; y = 0; w = iad->width - w - iad->nodes[pos].width; h = iad->height; } BitBlt(iad->hdc, x, y, w, h, hdc_old, ox, oy, SRCCOPY); } } // restore things DeleteDC(hdc_old); if (iad->img != NULL) DeleteObject(iad->img); iad->img = hNewBmp; // Move array iad->nodes[pos].width = bm.bmWidth; iad->nodes[pos].height = bm.bmHeight; iad->width = new_width; iad->height = new_height; // Finished it! LeaveCriticalSection(&iad->cs); return pos; }
void KDCAttributes::DumpDC(HDC hDC) { POINT pnt; SIZE size; m_List.DeleteAll(); Add(_T("Technology"), _T("%d"), GetDeviceCaps(hDC, TECHNOLOGY)); Add(_T("width"), _T("%d"), GetDeviceCaps(hDC, HORZRES)); Add(_T("height"), _T("%d"), GetDeviceCaps(hDC, VERTRES)); GetDCOrgEx(hDC, & pnt); Add(_T("DC Origin"), _T("{ %d, %d }"), pnt.x, pnt.y); TCHAR szTitle[MAX_PATH]; szTitle[0] = 0; GetWindowText(WindowFromDC(hDC), szTitle, MAX_PATH); Add(_T("Window"), _T("0x%X \"%s\""), WindowFromDC(hDC), szTitle); Add(_T("Bitmap"), _T("0x%X"), GetCurrentObject(hDC, OBJ_BITMAP)); Add(_T("Graphics Mode"), _T("%d"), GetGraphicsMode(hDC)); Add(_T("Mapping Mode"), _T("%d"), GetMapMode(hDC)); GetViewportExtEx(hDC, & size); Add(_T("Viewport Extent"), _T("{ %d, %d }"), size.cx, size.cy); GetViewportOrgEx(hDC, & pnt); Add(_T("Viewport Origin"), _T("{ %d, %d }"), pnt.x, pnt.y); GetWindowExtEx(hDC, & size); Add(_T("Window Extent"), _T("{ %d, %d }"), size.cx, size.cy); GetWindowOrgEx(hDC, & pnt); Add(_T("Window Origin"), _T("{ %d, %d }"), pnt.x, pnt.y); XFORM xform; GetWorldTransform(hDC, & xform); Add(_T("World transformation"), _T("{ %f, %f, %f, %f, %f, %f }"), xform.eM11, xform.eM12, xform.eM21, xform.eM22, xform.eDx, xform.eDy); // transformation Add(_T("Background Color"), _T("0x%X"), GetBkColor(hDC)); Add(_T("Text Color"), _T("0x%X"), GetTextColor(hDC)); Add(_T("Palette"), _T("0x%X"), GetCurrentObject(hDC, OBJ_PAL)); { COLORADJUSTMENT ca; GetColorAdjustment(hDC, & ca); Add(_T("Color Adjustment"), _T("{ %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d }"), ca.caSize, ca.caFlags, ca.caIlluminantIndex, ca.caRedGamma, ca.caGreenGamma, ca.caBlueGamma, ca.caReferenceBlack, ca.caReferenceWhite, ca.caContrast, ca.caBrightness, ca.caColorfulness, ca.caRedGreenTint); } Add(_T("Color Space"), _T("0x%X"), GetColorSpace(hDC)); Add(_T("ICM Mode"), _T("%d"), SetICMMode(hDC, ICM_QUERY)); { TCHAR szProfile[MAX_PATH]; DWORD dwSize = MAX_PATH; szProfile[0] = 0; GetICMProfile(hDC, & dwSize, szProfile); Add(_T("ICM Profile"), _T("%s"), szProfile); } GetCurrentPositionEx(hDC, & pnt); Add(_T("Current Position"), _T("{ %d, %d }"), pnt.x, pnt.y); Add(_T("ROP2"), _T("%d"), GetROP2(hDC)); Add(_T("Background Mode"), _T("%d"), GetBkMode(hDC)); Add(_T("Logical Pen"), _T("0x%X"), GetCurrentObject(hDC, OBJ_PEN)); Add(_T("DC Pen Color"), _T("0x%X"), GetDCPenColor(hDC)); Add(_T("Arc Direction"), _T("%d"), GetArcDirection(hDC)); FLOAT miter; GetMiterLimit(hDC, & miter); Add(_T("Miter Limit"), _T("%f"), miter); Add(_T("Logical Brush"), _T("0x%X"), GetCurrentObject(hDC, OBJ_BRUSH)); Add(_T("DC Brush Color"), _T("0x%X"), GetDCBrushColor(hDC)); GetBrushOrgEx(hDC, & pnt); Add(_T("Brush Origin"), _T("{ %d, %d }"), pnt.x, pnt.y); Add(_T("Polygon Filling Mode"), _T("%d"), GetPolyFillMode(hDC)); Add(_T("Bitmap Stretching Mode"), _T("%d"), GetStretchBltMode(hDC)); Add(_T("Logical Font"), _T("0x%X"), GetCurrentObject(hDC, OBJ_FONT)); Add(_T("Inter-character spacing"), _T("%d"), GetTextCharacterExtra(hDC)); DWORD flag = SetMapperFlags(hDC, 0); SetMapperFlags(hDC, flag); Add(_T("Font Mapper Flags"), _T("0x%X"), flag); Add(_T("Text Alignment"), _T("0x%X"), GetTextAlign(hDC)); Add(_T("Text Justification"), _T("write only"), 0); Add(_T("Layout"), _T("%d"), GetLayout(hDC)); Add(_T("Path"), _T("%d bytes"), GetPath(hDC, NULL, NULL, 0)); RECT rect; int typ = GetClipBox(hDC, & rect); HRGN hRgn = CreateRectRgn(0, 0, 1, 1); GetClipRgn(hDC, hRgn); Add(_T("Clipping"), _T("type %d clip box { %d, %d, %d, %d } size %d bytes"), typ, rect.left, rect.top, rect.right, rect.bottom, GetRegionData(hRgn, 0, NULL) ); GetMetaRgn(hDC, hRgn); GetRgnBox(hRgn, & rect); Add(_T("Meta Region"), _T("size %d bytes, rgn box { %d, %d, %d, %d }"), GetRegionData(hRgn, 0, NULL), rect.left, rect.top, rect.right, rect.bottom); for (int i=1; i<=5; i++) { int rslt = GetRandomRgn(hDC, hRgn, i); if ( rslt==1 ) { GetRgnBox(hRgn, & rect); Add(_T("Random Region"), _T("size %d bytes, rgn box { %d, %d, %d, %d }"), GetRegionData(hRgn, 0, NULL), rect.left, rect.top, rect.right, rect.bottom); } else if ( rslt==0 ) Add(_T("Random Region"), _T("NULL"), 0); else Add(_T("Random Region"), _T("FAIL"), 0); } DeleteObject(hRgn); GetBoundsRect(hDC, & rect, 0); Add(_T("Bounds Rectangle"), _T("{ %d, %d, %d, %d }"), rect.left, rect.top, rect.right, rect.bottom); }
// Add image to the list (return the index of the image or -1 on error) // If pos == -1, add to the end of the list int ImageArray_AddImage(IMAGE_ARRAY_DATA *iad, HBITMAP hBmp, int pos) { BITMAP bm; int new_width, new_height; HBITMAP hNewBmp, old_bmp; HDC hdc_old; BOOL last_one; int i; if (hBmp == NULL) return -1; EnterCriticalSection(&iad->cs); if (pos < 0) pos = iad->nodes_size; // Add to end? if (pos >= iad->nodes_size) { pos = iad->nodes_size; last_one = TRUE; } else { last_one = FALSE; } // Get bounds if (!GetObject(hBmp, sizeof(BITMAP), &bm)) { LeaveCriticalSection(&iad->cs); return -1; } if (iad->width_based) { new_width = max(bm.bmWidth, iad->width); new_height = iad->height + bm.bmHeight; } else { new_width = bm.bmWidth + iad->width; new_height = max(iad->height, bm.bmHeight); } // Alloc image hNewBmp = ImageArray_CreateBitmapPoint(new_width, new_height, &(iad->lpBits)); if (hNewBmp == NULL) { LeaveCriticalSection(&iad->cs); return -1; } // Alloc array if (!ImageArray_Alloc(iad, iad->nodes_size + 1)) { DeleteObject(hNewBmp); LeaveCriticalSection(&iad->cs); return -1; } // Move image... // Set some draw states SelectObject(iad->hdc, hNewBmp); hdc_old = CreateCompatibleDC(iad->hdc); old_bmp = (HBITMAP)GetCurrentObject(hdc_old, OBJ_BITMAP); SetBkMode(iad->hdc, TRANSPARENT); { POINT org; GetBrushOrgEx(iad->hdc, &org); SetStretchBltMode(iad->hdc, HALFTONE); SetBrushOrgEx(iad->hdc, org.x, org.y, NULL); } { int x = 0, y = 0, w = 0, h = 0; // 1- old data if (pos > 0) { SelectObject(hdc_old, iad->img); if (iad->width_based) { w = iad->width; h = 0; for (i = 0; i < pos; i++) { h += iad->nodes[i].height; } } else { h = iad->height; w = 0; for (i = 0; i < pos; i++) { w += iad->nodes[i].width; } } BitBlt(iad->hdc, 0, 0, w, h, hdc_old, 0, 0, SRCCOPY); } // 2- new image if (iad->width_based) { x = 0; y = h; } else { x = w; y = 0; } SelectObject(hdc_old, hBmp); BitBlt(iad->hdc, x, y, bm.bmWidth, bm.bmHeight, hdc_old, 0, 0, SRCCOPY); // 3- old data if (!last_one) { int ox, oy; SelectObject(hdc_old, iad->img); if (iad->width_based) { ox = 0; oy = y; x = 0; y += bm.bmHeight; w = iad->width; h = iad->height - h; } else { ox = x; oy = 0; x += bm.bmWidth; y = 0; w = iad->width - w; h = iad->height; } BitBlt(iad->hdc, x, y, w, h, hdc_old, ox, oy, SRCCOPY); } } // restore things SelectObject(hdc_old, old_bmp); DeleteDC(hdc_old); if (iad->img != NULL) DeleteObject(iad->img); iad->img = hNewBmp; // Move array if (!last_one && iad->nodes_size > 1) { memmove(&iad->nodes[pos + 1], &iad->nodes[pos], (iad->nodes_size - pos) * sizeof(IMAGE_ARRAY_DATA_NODE)); } iad->nodes[pos].width = bm.bmWidth; iad->nodes[pos].height = bm.bmHeight; iad->width = new_width; iad->height = new_height; // Finished it! LeaveCriticalSection(&iad->cs); return pos; }
void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact) { int old_pos=contact->avatar_pos; if (g_CluiData.bSTATE!=STATE_NORMAL || (dat->use_avatar_service && !ServiceExists(MS_AV_GETAVATARBITMAP)) ) // workaround for avatar service and other wich destroys service on OK_TOEXIT { contact->avatar_pos = AVATAR_POS_DONT_HAVE; contact->avatar_data = NULL; return; } if (dat->use_avatar_service && ServiceExists(MS_AV_GETAVATARBITMAP)) { if (dat->avatars_show && !ModernGetSettingByte(contact->hContact, "CList", "HideContactAvatar", 0)) { contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) { contact->avatar_data = NULL; } if (contact->avatar_data != NULL) { contact->avatar_data->t_lastAccess = (DWORD)time(NULL); } } else { contact->avatar_data = NULL; } Cache_ProceedAvatarInList(dat, contact); } else { contact->avatar_pos = AVATAR_POS_DONT_HAVE; if (dat->avatars_show && !ModernGetSettingByte(contact->hContact, "CList", "HideContactAvatar", 0)) { DBVARIANT dbv; if (!ModernGetSettingTString(contact->hContact, "ContactPhoto", "File", &dbv)) { HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal); if (hBmp != NULL) { // Make bounds BITMAP bm; if (GetObject(hBmp,sizeof(BITMAP),&bm)) { // Create data... HDC hdc; HBITMAP hDrawBmp,oldBmp; // Make bounds -> keep aspect radio LONG width_clip; LONG height_clip; RECT rc = {0}; // Clipping width and height width_clip = dat->avatars_maxheight_size; height_clip = dat->avatars_maxheight_size; if (height_clip * bm.bmWidth / bm.bmHeight <= width_clip) { width_clip = height_clip * bm.bmWidth / bm.bmHeight; } else { height_clip = width_clip * bm.bmHeight / bm.bmWidth; } // Create objs hdc = CreateCompatibleDC(dat->avatar_cache.hdc); hDrawBmp = ske_CreateDIB32(width_clip, height_clip); oldBmp=(HBITMAP)SelectObject(hdc, hDrawBmp); SetBkMode(hdc,TRANSPARENT); { POINT org; GetBrushOrgEx(hdc, &org); SetStretchBltMode(hdc, HALFTONE); SetBrushOrgEx(hdc, org.x, org.y, NULL); } rc.right = width_clip - 1; rc.bottom = height_clip - 1; // Draw bitmap 8//8 { HDC dcMem = CreateCompatibleDC(hdc); HBITMAP obmp=(HBITMAP)SelectObject(dcMem, hBmp); StretchBlt(hdc, 0, 0, width_clip, height_clip,dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); SelectObject(dcMem,obmp); mod_DeleteDC(dcMem); } { RECT rtr={0}; rtr.right=width_clip+1; rtr.bottom=height_clip+1; ske_SetRectOpaque(hdc,&rtr); } hDrawBmp = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP); SelectObject(hdc,oldBmp); mod_DeleteDC(hdc); // Add to list if (old_pos >= 0) { ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); contact->avatar_pos = old_pos; } else { contact->avatar_pos = ImageArray_AddImage(&dat->avatar_cache, hDrawBmp, -1); } DeleteObject(hDrawBmp); } // if (GetObject(hBmp,sizeof(BITMAP),&bm)) DeleteObject(hBmp); } //if (hBmp != NULL) } ModernDBFreeVariant(&dbv); } // Remove avatar if needed if (old_pos >= 0 && contact->avatar_pos == AVATAR_POS_DONT_HAVE) { ImageArray_RemoveImage(&dat->avatar_cache, old_pos); // Update all items ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); } if (old_pos==AVATAR_POS_ANIMATED && contact->avatar_pos != AVATAR_POS_ANIMATED) { AniAva_RemoveAvatar( contact->hContact ); } } }