Commit Graph

1286 Commits

Author SHA1 Message Date
Johannes Schickel
69220505b6 GRAPHICS: Add function to query TransparentSurface's builtin PixelFormat. 2015-12-14 05:16:12 +01:00
Johannes Schickel
f7683083e2 GRAPHICS: Use tabs for indentation. 2015-12-14 02:26:11 +01:00
Johannes Schickel
f2926412fe GRAPHICS: Fix fast ALPHA_BINARY blitting with TransparentSurface.
This is a regression from 5d0f38d747 and caused
color glitches in Wintermute.
2015-12-14 02:15:28 +01:00
Eugene Sandulenko
5d0f38d747 GRAPHICS: Fix rendering in some corner cases 2015-11-17 23:17:48 +01:00
Johannes Schickel
ac93f3512f GRAPHICS: Remove unused header include. 2015-11-16 17:01:59 +01:00
Johannes Schickel
aaca04cdfc GRAPHICS: Rewrite PixelFormat::toString to be easier to understand. 2015-11-16 16:58:23 +01:00
Johannes Schickel
1c7a5e5a01 GRAPHICS: Fix component order in PixelFormat::toString output.
Formerly components were printed from bottom to top, common notation is from
top to bottom. For reference check how we name formats, like in for example:
backends/graphics/openglsdl/openglsdl-graphics.cpp:190-230
backends/graphics/surfacesdl/surfacesdl-graphics.cpp:409-490
sherlock/scalpel/scalpel.cpp:207
2015-11-16 16:28:01 +01:00
Johannes Schickel
eee8ef9dce GRAPHICS: Make PixelFormat::toString const. 2015-11-16 16:03:44 +01:00
Eugene Sandulenko
cfc626d78d GRAPHICS: Implemented utility function to print PixelFormat 2015-11-16 07:00:09 +01:00
Matthew Hoops
75acef7566 GRAPHICS: Force a cast to int to avoid gcc warnings 2015-04-11 16:12:47 -04:00
Torbjörn Andersson
6f7b0311af GRAPHICS: Fix GCC signed/unsigned warnings. 2015-03-02 08:38:33 +01:00
Filippos Karapetis
614de0d761 GRAPHICS: Remove trailing whitespace 2014-10-28 15:38:50 +02:00
Fedor
75305f136f GRAPHICS: Remove some trailing whitespace in surface.h 2014-10-28 15:03:44 +02:00
Filippos Karapetis
d3475fe3b6 GRAPHICS: Silence an MSVC warning 2014-10-19 17:03:14 +03:00
Johannes Schickel
2a75e9f1ad Merge pull request #500 from lordhoto/ttf-improvements
Improve TTF Rendering (includes Font API changes).
2014-09-07 21:23:24 +02:00
Johannes Schickel
248ea3c1ab GRAPHICS: Allow negative xOffset in TTF.
This should improve the visual looks of many fonts. However, it might result
in the first line of the glyph to be drawn left of the position specified in
drawChar.
2014-09-03 22:55:48 +02:00
Johannes Schickel
d55cd8f3b4 GRAPHICS: Allow to query the bounding box of chars/strings drawn with Font API. 2014-09-03 22:55:48 +02:00
Einar Johan Trøan Sømåen
0593c2eab2 GRAPHICS: Fix some Doxygen comments that seem wrong. 2014-08-29 03:26:48 +02:00
Matthew Hoops
6642f6df9e GRAPHICS: Improve color bit depth conversion
Data is no longer truncated it so should be more accurate. See pull request #486 for more info.
2014-08-17 17:49:37 -04:00
Eugene Sandulenko
89d789b122 GRAPHICS: Added BE/LE to TS_ macros 2014-06-23 15:39:31 +03:00
Eugene Sandulenko
5847240234 GRAPHICS: Rename BS_ to TS_ (for TransparentSurface) 2014-06-17 14:54:53 +03:00
Eugene Sandulenko
039249d39b GRAPHICS: Fix compilation for Amiga 2014-06-15 21:50:10 +03:00
Eugene Sandulenko
1ebb8aa6de Merge pull request #466 from sev-/transparent-surface
COMMON: Move TransparentSurface to common code
2014-06-15 21:15:31 +03:00
Eugene Sandulenko
7322d905b3 COMMON: Copy TransparentSurface from Wintermute engine to common code 2014-06-15 15:43:06 +03:00
Johannes Schickel
5b03ba04d7 GRAPHICS: Allow client code to specify TTF render mode.
This allows clients to use the default FreeType2 render mode instead of light.
We really only use light as default because that's what looks best with the
font we use in our GUI right now (which is the same reason why formerly light
was always used in non-monochrome mode).
2014-06-09 01:04:47 +02:00
Johannes Schickel
63ccd85baa GRAPHICS: colour -> color in VectorRendererSpec code. 2014-05-27 02:04:08 +02:00
Johannes Schickel
e499a25a00 GRAPHICS: Manually specify function alignment in ARM assembly. 2014-03-06 20:21:48 +01:00
Matthew Hoops
740b6e8fbd IMAGE: Move all ImageDecoders to image/ 2014-02-28 00:27:28 -05:00
Johannes Schickel
53332e8066 GRAPHICS: Make GPL headers consistent in themselves. 2014-02-18 02:39:34 +01:00
D G Turner
ac4087856f ALL: Remove optimization unstable code on checking for null after new.
These issues were identified by the STACK tool.

By default, the C++ new operator will throw an exception on allocation
failure, rather than returning a null pointer.

The result is that testing the returned pointer for null is redundant
and _may_ be removed by the compiler. This is thus optimization
unstable and may result in incorrect behaviour at runtime.

However, we do not use exceptions as they are not supported by all
compilers and may be disabled.

To make this stable without removing the null check, you could qualify
the new operator call with std::nothrow to indicate that this should
return a null, rather than throwing an exception.

However, using (std::nothrow) was not desirable due to the Symbian
toolchain lacking a <new> header.
A global solution to this was also not easy by redefining "new" as "new
(std::nothrow)" due to custom constructors in NDS toolchain and various
common classes.

Also, this would then need explicit checks for OOM adding to all new
usages as per C malloc which is untidy.

For now to remove this optimisation unstable code is best as it is
likely to not be present anyway, and OOM will cause a system library
exception instead, even without exceptions enabled in the application
code.
2014-01-15 02:36:19 +00:00
Marcus Comstedt
4b81b1299d GRAPHICS: Fix dest alpha formula in blendPixelPtr
The original alpha computation formula had a problem:  If something was
drawn on top of a pixel that was already fully opaque, there would be
an overflow in the computed alpha, and the destination alpha would be
truncated to 0 (fully transparent).

In commit 264ba4a9 this formula was replaced with another one, which
did not have overflows but also was not correct.

This commits introduces a new formula, where the rounding errors have
been turned in another direction; drawing a fully opaque pixel on top
of a transparent one would result in a pixel which is almost, but not
fully, opaque.  However, this is no problem in practice, since drawing
fully opaque pixels can be achieved with much less code as a special
case, so add that (also improves rendering speed).
2014-01-10 20:04:10 +01:00
Marcus Comstedt
51d7405a7b GRAPHICS: Fix computation of addA in darkenFill()
The old computation had rounding issues, causing alpha to leak into
the red (usually) component.  There's a much easier way to compute it
that does not lead to such problems:  What should really happen is that
the two top bits of the A component should be set to 1 (thus adding
75% alpha).  So compute it that way for speed and precision.
2014-01-10 15:56:53 +01:00
D G Turner
094c378217 GRAPHICS: Minor readability fixes to drawBevelSquareAlg method.
No functional change.
2013-12-13 23:41:24 +00:00
Johannes Schickel
b6f32028e1 GRAPHICS: Document loadTTFFont a bit. 2013-12-08 20:11:59 +01:00
Eugene Sandulenko
3e85976877 GRAPHICS: Initialize variable. CID 1133708 2013-12-01 00:51:09 +02:00
Johannes Schickel
14d328faca GRAPHICS: Fix SharedPtrSurfaceDeleter for nullptr inputs. 2013-11-27 19:44:54 +01:00
Johannes Schickel
9da09f5846 GRAPHICS: Allow Font to accept U32String as strings. 2013-11-23 21:34:54 +01:00
Johannes Schickel
09c634dd55 GRAPHICS: Allow TTFFont to cache glyphs when required.
This should allow TTFFont to display UTF-32 characters from fonts.
2013-11-23 21:34:54 +01:00
Johannes Schickel
13d470dc61 GRAPHICS: Get rid of _glyphSlots in TTFFont. 2013-11-23 21:34:54 +01:00
Johannes Schickel
afa3f50b8a GRAPHICS: Let Font take uint32 as character codes.
This is required to support UTF-32 strings but does not make them work
automatically!
2013-11-23 21:34:54 +01:00
Alyssa Milburn
575f81da5f GRAPHICS: Set PNG alpha bits to 0 if there's no alpha present.
This fixes the color-keying checks in Wintermute for PNG images.
2013-11-12 10:57:25 +01:00
Matthew Hoops
aea224e260 ALL: Mark off common code used by ZVision 2013-10-26 10:39:36 -04:00
peres
070558c4c4 GRAPHICS: do not reset the extra parameters of IFFDecoder on destroy().
The two properties that control pixel packing and the size of the
surface need to be preserved for loadStream() to work correctly.
They are now under complete responsibility of the client.
2013-10-26 23:26:22 +09:00
peres
69be9adf52 Revert "GRAPHICS: do not clear the internal state of IFFDecoder on loadStream()."
This reverts commit 92c1ff31d6.
2013-10-26 23:26:22 +09:00
Matthew Hoops
091bcbf313 GRAPHICS: Have TGA's loadStream() call destroy() 2013-10-26 10:21:08 -04:00
Matthew Hoops
1b3eee6d78 GRAPHICS: Clarify implicit destroy() usage 2013-10-26 10:21:03 -04:00
peres
92c1ff31d6 GRAPHICS: do not clear the internal state of IFFDecoder on loadStream().
This decoder needs to keep track of client parameters that control
how the pixels are going to be packaged, so the responsibility for
clearing the state has been moved on the client (using the destroy()
method on ImageDecoder).

As no client uses the IFFDecoder for more than one image at a time,
this change does not require updates to the engines. The only effect
is on Parallaction (BRA-Amiga), which can now control the way pixels
are packaged in mask and path bitmaps.
2013-10-26 22:24:16 +09:00
Willem Jan Palenstijn
a532c7729f Merge branch 'zvision'
This merges pull request 395 for the ZVision engine developed during
GSoC2013.
2013-10-17 23:00:00 +02:00
D G Turner
480a059f83 GRAPHICS: Fix uninitialised field in PNG decoder. CID 1002280. 2013-09-30 05:01:41 +01:00
D G Turner
b6fbc3f4c6 GRAPHICS: Fix uninitialized cursor visibility variable. CID 1002283.
The default at cursor construction has been set to not visible.
This now requires an explicit call to setVisible(true) to show the
cursor, but a basic test shows that this seems to be OK and engines
which fail to do this would have been intermittently broken before.
2013-09-30 04:47:11 +01:00