equal
deleted
inserted
replaced
76 function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
76 function NewTexture(width, height: Longword; buf: Pointer): PTexture; |
77 begin |
77 begin |
78 new(NewTexture); |
78 new(NewTexture); |
79 NewTexture^.PrevTexture:= nil; |
79 NewTexture^.PrevTexture:= nil; |
80 NewTexture^.NextTexture:= nil; |
80 NewTexture^.NextTexture:= nil; |
81 NewTexture^.Scale:= 1; |
|
82 if TextureList <> nil then |
81 if TextureList <> nil then |
83 begin |
82 begin |
84 TextureList^.PrevTexture:= NewTexture; |
83 TextureList^.PrevTexture:= NewTexture; |
85 NewTexture^.NextTexture:= TextureList |
84 NewTexture^.NextTexture:= TextureList |
86 end; |
85 end; |
87 TextureList:= NewTexture; |
86 TextureList:= NewTexture; |
88 |
87 |
|
88 NewTexture^.Scale:= 1; |
|
89 NewTexture^.Priority:= 0; |
89 NewTexture^.w:= width; |
90 NewTexture^.w:= width; |
90 NewTexture^.h:= height; |
91 NewTexture^.h:= height; |
91 NewTexture^.rx:= 1.0; |
92 NewTexture^.rx:= 1.0; |
92 NewTexture^.ry:= 1.0; |
93 NewTexture^.ry:= 1.0; |
93 |
94 |
222 TextureList^.PrevTexture:= Surface2Tex; |
223 TextureList^.PrevTexture:= Surface2Tex; |
223 Surface2Tex^.NextTexture:= TextureList |
224 Surface2Tex^.NextTexture:= TextureList |
224 end; |
225 end; |
225 TextureList:= Surface2Tex; |
226 TextureList:= Surface2Tex; |
226 |
227 |
|
228 Surface2Tex^.Scale:= 1; |
|
229 Surface2Tex^.Priority:= 0; |
227 Surface2Tex^.w:= surf^.w; |
230 Surface2Tex^.w:= surf^.w; |
228 Surface2Tex^.h:= surf^.h; |
231 Surface2Tex^.h:= surf^.h; |
229 |
232 |
230 if (surf^.format^.BytesPerPixel <> 4) then |
233 if (surf^.format^.BytesPerPixel <> 4) then |
231 begin |
234 begin |
242 if SDLCheck(SDL_LockSurface(surf) >= 0, 'Lock surface', true) then |
245 if SDLCheck(SDL_LockSurface(surf) >= 0, 'Lock surface', true) then |
243 exit(nil); |
246 exit(nil); |
244 |
247 |
245 fromP4:= Surf^.pixels; |
248 fromP4:= Surf^.pixels; |
246 |
249 |
|
250 // FIXME move out of surface2tex |
247 if GrayScale then |
251 if GrayScale then |
248 Surface2GrayScale(Surf); |
252 Surface2GrayScale(Surf); |
249 |
253 |
|
254 // FIXME move out of surface2tex |
250 PrettifySurfaceAlpha(surf, fromP4); |
255 PrettifySurfaceAlpha(surf, fromP4); |
251 |
256 |
252 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then |
257 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then |
253 begin |
258 begin |
254 tw:= toPowerOf2(Surf^.w); |
259 tw:= toPowerOf2(Surf^.w); |