X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_graphics.pas;h=c5ec8f36e94baae90f47ca21bbd20d32416a36d9;hb=4b6c50349b6b2c268faecbb7f4567cd4f5e0d835;hp=bfef6d2e7e73f0f8f4476bbdcb49dd2cfc12b951;hpb=54847412a6a0690c1f40cbbcc559b59601cedd77;p=d2df-sdl.git diff --git a/src/engine/e_graphics.pas b/src/engine/e_graphics.pas index bfef6d2..c5ec8f3 100644 --- a/src/engine/e_graphics.pas +++ b/src/engine/e_graphics.pas @@ -95,7 +95,6 @@ function e_CreateTextureEx(FileName: string; var ID: DWORD; fX, fY, fWidth, fHei function e_CreateTextureMem(pData: Pointer; dataSize: LongInt; var ID: DWORD): Boolean; function e_CreateTextureMemEx(pData: Pointer; dataSize: LongInt; var ID: DWORD; fX, fY, fWidth, fHeight: Word): Boolean; procedure e_GetTextureSize(ID: DWORD; Width, Height: PWord); -function e_GetTextureSize2(ID: DWORD): TRectWH; procedure e_DeleteTexture(ID: DWORD); procedure e_RemoveAllTextures(); @@ -370,106 +369,6 @@ begin if Height <> nil then Height^ := e_Textures[ID].tx.Height; end; -function e_GetTextureSize2(ID: DWORD): TRectWH; -var - data: PChar; - x, y: Integer; - w, h: Word; - a: Boolean; - lastline: Integer; -begin - w := e_Textures[ID].tx.Width; - h := e_Textures[ID].tx.Height; - - Result.Y := 0; - Result.X := 0; - Result.Width := w; - Result.Height := h; - -{$IFNDEF USE_NANOGL} // FIXIT: nanoGL doesn't support glGetTexImage - if e_NoGraphics then Exit; - - data := GetMemory(w*h*4); - glEnable(GL_TEXTURE_2D); - glBindTexture(GL_TEXTURE_2D, e_Textures[ID].tx.id); - glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - - for y := h-1 downto 0 do - begin - lastline := y; - a := True; - - for x := 1 to w-4 do - begin - a := Byte((data+y*w*4+x*4+3)^) <> 0; - if a then Break; - end; - - if a then - begin - Result.Y := h-lastline; - Break; - end; - end; - - for y := 0 to h-1 do - begin - lastline := y; - a := True; - - for x := 1 to w-4 do - begin - a := Byte((data+y*w*4+x*4+3)^) <> 0; - if a then Break; - end; - - if a then - begin - Result.Height := h-lastline-Result.Y; - Break; - end; - end; - - for x := 0 to w-1 do - begin - lastline := x; - a := True; - - for y := 1 to h-4 do - begin - a := Byte((data+y*w*4+x*4+3)^) <> 0; - if a then Break; - end; - - if a then - begin - Result.X := lastline+1; - Break; - end; - end; - - for x := w-1 downto 0 do - begin - lastline := x; - a := True; - - for y := 1 to h-4 do - begin - a := Byte((data+y*w*4+x*4+3)^) <> 0; - if a then Break; - end; - - if a then - begin - Result.Width := lastline-Result.X+1; - Break; - end; - end; - - FreeMemory(data); -{$ENDIF} -end; - procedure e_ResizeWindow(Width, Height: Integer); begin if Height = 0 then