MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / UpdateTextureViews

Method UpdateTextureViews

editor/WorldTexturesDialog.cpp:706–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704}
705
706void CWorldTexturesDialog::UpdateTextureViews(int frame) {
707 // Display texture in IDC_TEXTUREVIEW
708 int n = D3EditState.texdlg_texture;
709 int freebitmap = 0;
710
711 if (!GameTextures[n].used) {
712 n = GetNextTexture(n);
713 D3EditState.texdlg_texture = n;
714 return;
715 }
716
717 CWnd *texwnd;
718 RECT rect;
719 int x, y, bm_handle, w, h;
720 static int last_frame = 0;
721 static int last_texture = -1;
722 static int last_tex_count = -1;
723 int update_listbox = 0;
724
725 DrawSwatch(IDC_TEXTURE_SWATCH, GameTextures[n].r, GameTextures[n].g, GameTextures[n].b);
726
727 if (last_texture == n && last_tex_count == Num_textures && m_RedrawListbox == 0)
728 update_listbox = 0;
729 else {
730 m_RedrawListbox = 0;
731 update_listbox = 1;
732 last_texture = n;
733 last_tex_count = Num_textures;
734 }
735
736 if (!GameTextures[m_TexStart].used)
737 m_TexStart = GetNextTexture(m_TexStart);
738
739 frame = last_frame++;
740
741 texwnd = GetDlgItem(IDC_TEXTUREVIEW);
742 texwnd->GetWindowRect(&rect);
743 ScreenToClient(&rect);
744
745 Desktop_surf->attach_to_window((unsigned)m_hWnd);
746
747 w = rect.right - rect.left;
748 h = rect.bottom - rect.top;
749
750 // Desktop_surf->clear(rect.left,rect.top,w,h);
751
752 bm_handle = GetTextureBitmap(n, frame);
753
754 if (GameTextures[n].flags & TF_TEXTURE_256 && bm_w(bm_handle, 0) == 256) {
755 // Downsize this bitmap to make it fit on screen
756 int temp_bm = bm_AllocBitmap(128, 128, (128 * 128 * 2) / 3);
757 GameBitmaps[temp_bm].format = GameBitmaps[bm_handle].format;
758 if (GameBitmaps[bm_handle].flags & BF_MIPMAPPED)
759 GameBitmaps[temp_bm].flags |= BF_MIPMAPPED;
760 bm_ScaleBitmapToBitmap(temp_bm, bm_handle);
761 bm_handle = temp_bm;
762 freebitmap = 1;
763 }

Callers

nothing calls this directly

Calls 15

GetNextTextureFunction · 0.85
GetTextureBitmapFunction · 0.85
bm_wFunction · 0.85
bm_AllocBitmapFunction · 0.85
bm_ScaleBitmapToBitmapFunction · 0.85
bm_hFunction · 0.85
bm_bppFunction · 0.85
bm_FreeBitmapFunction · 0.85
attach_to_windowMethod · 0.80
GR_RGBFunction · 0.50
createMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected