summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
AgeCommit message (Collapse)AuthorFilesLines
2024-01-25Ported to SDL2Thorbjørn Lindeijer1-262/+29
2012-08-05Removed 'virtual' from methods of ImageThorbjørn Lindeijer1-7/+8
Maybe it used to be necessary for these methods to be virtual, but this is no longer the case. Hence we can avoid wasting CPU ticks searching through virtual function tables, especially for frequently used methods like getWidth, getHeight and setAlpha. MapLayer::getTile was inlined. Reviewed-by: Erik Schilling
2012-08-05Avoid copying surfaces unnecessarily for upload to textureThorbjørn Lindeijer1-25/+35
When uploading an SDL surface to an OpenGL texture, it was always making a copy that had the desired size and pixel format. Now this copy is no longer being made when the existing surface already has the target size and pixel format. In fact most images are already in 32-bit RGBA format after loading them. Reviewed-by: Erik Schilling
2012-08-05Specify a more specific image format when uploading texturesThorbjørn Lindeijer1-1/+1
While simply specifying "4 components" works, it is preferred to specify the actual image format like GL_RGBA8 in our case. http://www.opengl.org/wiki/Common_Mistakes#Image_precision Reviewed-by: Erik Schilling
2012-08-05Added support for ARB_texture_non_power_of_two extensionThorbjørn Lindeijer1-1/+2
If the graphics driver supports this, there is no need to create textures with power-of-two dimensions. It is then also preferred to use regular textures than relying on the older GL_ARB_texture_rectangle extension. Reviewed-by: Erik Schilling
2012-08-05Fixed indentation of Image::_GLloadThorbjørn Lindeijer1-75/+75
Reviewed-by: Stefan Beller
2012-07-25Revert "Leave the default values for OpenGL texture filters"Thorbjørn Lindeijer1-0/+2
This reverts commit 137ade7226af37d073a5755b90181275664dd65c. Turns out that when leaving the default values, the textures won't actually work since they are incomplete unless the mipmaps are generated (since GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR by default). For now we don't want to generate mipmaps anyway since we're going for a pixely look, so revert the filters back to GL_NEAREST. The reason this had worked for me is because on my system the texture type GL_TEXTURE_RECTANGLE_ARB is used instead of GL_TEXTURE_2D and this texture type does not support mipmaps.
2012-02-12Leave the default values for OpenGL texture filtersThorbjørn Lindeijer1-2/+0
The scaled wallpaper looks quite a bit better when linear texture smoothing is applied, and I could not measure a significant difference in framerate from setting the texture filter to GL_NEAREST. Hence it seems not necessary to me to introduce the smoothing as an option. The default value for GL_TEXTURE_MIN_FILTER is GL_NEAREST_MIPMAP_LINEAR and the default for GL_TEXTURE_MAG_FILTER is GL_LINEAR. These make sure that the texture is reasonably smoothed by using the weighted average of the nearest four pixels. Reviewed-by: Erik Schilling
2012-02-09Fixed wallpaper prescaling issuesThorbjørn Lindeijer1-14/+35
Image::SDLgetScaledImage was changed so that it tries to find an existing scaled version of the image first, and generates it when none exists. When it needs to generate one, this resource is added to the resource manager, partly to avoid duplicating the work later but mainly to keep memory management straightforward. This function also used to leak the scaled SDL_Surface since it wrongly assumed that Image::load would free it. To avoid filling up the memory with scaled wallpapers that are waiting 30 seconds until they will be deleted, the Resource::decRef function was extended with a parameter that allows telling it what to do with orphans. Calling decRef with Resource::DeleteImmediately will delete the resource immediately in case the resource is orphaned. Reviewed-by: Yohann Ferreira
2012-01-26Updated copyrights to 2012Thorbjørn Lindeijer1-1/+1
2012-01-24Removed unused function Image::SDLmergeThorbjørn Lindeijer1-78/+0
Reviewed-by: Yohann Ferreira
2012-01-24Use SDL_RWops directly on top of PhysFSThorbjørn Lindeijer1-5/+2
This avoids the creation of a temporary buffer containing a complete file for the sole purpose of wrapping it up in an SDL_RWops. The necessary wrapper is by Ryan C. Gordon and is included in the PhysFS repository under 'extras'. Reviewed-by: Yohann Ferreira
2010-10-22Turned the OpenGL and disable transparency options as static members.Yohann Ferreira1-16/+19
- Now OpenGL and the transparency disabling are set at startup and not read again for displaying graphics, preventing graphic errors before startup. - We also agreed long time ago that SDL specific functions should have a SDL prefix. The header has been rearranged a bit to do so. - Also fixed a possible discrepancy in the hasAlphaChannel() function. Reviewed-by: CodyMartin. Resolves: Mana-Mantis: #260.
2010-10-17Added Low CPU Mode toggle in video setup. Defaults to On.madcamel@gmail.com1-0/+4
This disables the Image::setAlpha() function, which uses 60% of the client's CPU cycles. When enabled, visual quality is slightly decreased, especially with the particle system. Toggling this setting On from an Off state requires a client restart or the graphics look quite funny. Bertram's addition: - Renamed 'Low CPU' to 'Disable transparency (Low CPU)' in the gui for better understanding. - Removed the sprite display with 30% opacity when disabling transparency since it made monsters and drops be drawn above all layers at full opacity. - Made the OpenGL mode disable the 'low CPU mode'. - Fixed the GUI logic as much as possible. Please note that the GUI opacity slider stays enabled when transparency is disabled even if told to be disabled in that case. Reviewed-by: CodyMartin, 4144, MadCamel.
2010-10-16Implement opacity cache for SDL surfaces.Andrei Karas1-7/+87
Enabled by default. Can be disabled in configuration option "alphaCache" if set it to 0. Reviewed-by: Bertram
2010-08-03Improve OpenGL speed.Andrei Karas1-1/+6
Use batch commands and not selecting already selected texture. Signed-off-by: Jared Adams <jaxad0127@gmail.com>
2010-02-22Modify copyright headersFreeyorp1-1/+2
2010-02-20License header update for The Mana ClientThorbjørn Lindeijer1-4/+3
2010-02-07Updated Copyright year to 2010!Bertram1-1/+1
Also added the update copyright tool from the Wormux Team. ( And not forgetting credit's due. :P )
2010-02-01Moved from SDLrescalefacility to SDL_gfx.Bertram1-4/+3
2010-01-12Standardize header orderJared Adams1-1/+1
Also remove some extra new lines and fix eAthena's PartyTab define guards.
2010-01-10Change code styleAndrei Karas1-2/+1
2009-09-17Optimized the Image::setAlpha() function for SDL.Bertram1-14/+25
2009-08-15Fix some compile errorsJared Adams1-1/+1
2009-08-15Removed unused include.Bertram1-1/+0
2009-08-15Mantis #783: Fixed window opacity breaks in software (SDL) mode.Bertram1-37/+63
2009-08-14Fixed the compilation without OpenGL Support, and remove a too young function.Bertram1-36/+5
2009-08-13Fix compile errorsJared Adams1-8/+10
2009-08-14Added a Alpha Channel copier for 32 bit SDL based images.Bertram1-5/+35
This will later be used to keep the original alpha value...
2009-08-14Minor update...Bertram1-3/+0
2009-08-14Prevented another possible segfault...Bertram1-0/+3
2009-08-14Reliability fix in Image::Image(SDL_Surface*)...Bertram1-3/+2
2009-08-14Added a new function to know if an image is using an alpha channel.Bertram1-1/+41
This all will be useful for my next patch: Repair windows opacity break in SDL mode.
2009-08-14Made the mLoaded member working again.Bertram1-2/+22
2009-08-13Changed mImage member to mSDLSurface as it is SDL specific...Bertram1-18/+18
2009-08-13Cleaned up the image code a bit...Bertram1-138/+146
2009-08-06Use fillRectangle instead of tiling a colored imageThorbjørn Lindeijer1-29/+6
2009-07-26Fixed a '+' string operation, and attempt to resolve the Mantis 427.Bertram1-12/+35
2009-07-25Fixed compile warnings about unsigned/signed integer comparisonsThorbjørn Lindeijer1-1/+1
2009-07-24Made the wallpaper be rescaled when necessary under SDL and OpenGL.Bertram1-1/+38
The SDL methods to rescale the wallpaper has been optimized to permit rescaling at load time while OpenGL draws directly rescaled. Does someone know how to smooth the rescaled image under OpenGL?
2009-03-27Fixed include structure in resource/ directoryBjørn Lindeijer1-15/+15
There is also a new rule that trivial constructors and destructors should no longer be trivially "documented", since this just takes up space with no gain.
2009-03-23Merge branch 'aethyra/master'Bjørn Lindeijer1-2/+77
Conflicts: Many files.
2009-03-17Added an image merge feature loosely based on a merge function found inIra Rice1-2/+77
the open source project Wormux. To improve SDL performance, the number of layers that are pushed out to the hardware or software buffers should be reduced, which is where this function comes into play, as it combines two surfaces together so that the number of blit operations is reduced. This function is currently not used, but will be used once a good way to link each of the target systems is determined so that it only initiates when SDL is enabled, as well as making sure that each hook that uses this function is benefiting from it sufficiently. At the moment, it's suspected that the particle engine will likely be the most likely to benefit from this function, followed by tile drawing, then sprite drawing. Signed-off-by: Ira Rice <irarice@gmail.com>
2009-02-10Fixed header files, as well as removed the unused buddy list class (notIra Rice1-2/+3
useful since buddy lists are tracked through the player relation interface instead) Signed-off-by: Ira Rice <irarice@gmail.com>
2009-01-30Some style cleanups to the image class. TODO: Find a way to fix theIra Rice1-21/+22
subimage class so that when OpenGL isn't enabled, GUI opacities can still be applied. Signed-off-by: Ira Rice <irarice@gmail.com>
2009-01-23Removed unnecessary references to The Mana World in code headersBjørn Lindeijer1-4/+4
This dates back to the old days of TMW, but the usage instructions of GPLv2 don't mention this being necessary. Since it doesn't add anything, avoid the branding in these sections.
2008-11-18Pedantic fixes to the client, where I alphabetized all of the include Ira Rice1-4/+1
statements, as well as removing the new skill dialog, which we do not, nor will we use (if we do, it'd be a new one that we'd make). WARNING!!! This, and all other previous builds have a linker error for the Gnome libraries version 4.3.2 on my setup. It's assumed that this is also the case for other users of this library as well. I'm currently assuming that there's a bug in the compiler itself, and will look into reporting this, but in the mean time, it doesn't build for these users, unfortunately. Sorry about this.
2008-07-18Import of client treeLloyd Bryant1-1/+1
2007-11-21Merged revisions 3705-3711,3714,3718,3721-3722,3729-3731,3735,3742 via ↵Bjørn Lindeijer1-1/+46
svnmerge from https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk (dynamic recoloring of sprites and related changes) ........ r3705 | gmelquio | 2007-11-03 10:58:25 +0100 (Sat, 03 Nov 2007) | 1 line Fixed double load of hair graphics. ........ r3706 | gmelquio | 2007-11-03 22:04:51 +0100 (Sat, 03 Nov 2007) | 1 line Added automatic recoloring of images. Inspired by fungos' ideas (PR #41). ........ r3707 | gmelquio | 2007-11-03 22:08:21 +0100 (Sat, 03 Nov 2007) | 1 line Experimented recoloring on scorpions. ........ r3708 | gmelquio | 2007-11-04 12:52:44 +0100 (Sun, 04 Nov 2007) | 1 line Tightened palette handling. ........ r3709 | gmelquio | 2007-11-04 12:54:31 +0100 (Sun, 04 Nov 2007) | 1 line Experimented with scorpions again. ........ r3710 | gmelquio | 2007-11-04 16:40:37 +0100 (Sun, 04 Nov 2007) | 1 line Applied recoloring to hair styles. ........ r3711 | gmelquio | 2007-11-04 17:50:37 +0100 (Sun, 04 Nov 2007) | 1 line Converted slimes to recoloring. ........ r3742 | gmelquio | 2007-11-16 14:16:00 +0100 (Fri, 16 Nov 2007) | 1 line Sped up recoloring of transparent pixels. ........
2007-11-20Merged revisions 3642,3662-3664,3667 via svnmerge from Bjørn Lindeijer1-24/+11
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk ........ r3642 | gmelquio | 2007-10-19 19:46:46 +0200 (Fri, 19 Oct 2007) | 1 line Factored code between resource handlers. Implemented failure-friendly sprite loader. ........ r3662 | gmelquio | 2007-10-21 21:01:16 +0200 (Sun, 21 Oct 2007) | 1 line Added persistent positioning. ........ r3663 | gmelquio | 2007-10-21 21:03:43 +0200 (Sun, 21 Oct 2007) | 1 line Fixed missing pixels at bottom and right. ........ r3664 | gmelquio | 2007-10-21 21:05:56 +0200 (Sun, 21 Oct 2007) | 1 line Changed to use default values when restoring missing settings. ........ r3667 | gmelquio | 2007-10-21 22:09:08 +0200 (Sun, 21 Oct 2007) | 1 line Fixed invisible text in dropboxes and shopboxes. ........