Commit Graph

1275 Commits

Author SHA1 Message Date
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
RichieSams
49d67caa31 Merge branch 'master' into zvision 2013-09-29 18:04:53 -05:00
RichieSams
701250efb5 GRAPHICS: Remove variable shadowing 2013-09-22 15:54:06 -05:00
Johannes Schickel
46a69c89f4 Merge pull request #376 from lordhoto/libjpeg
GRAPHICS: Implement JPEGDecoder based on libjpeg.
2013-09-16 17:10:57 -07:00
Johannes Schickel
4063de4070 GRAPHICS: Add some paranoia asserts in JPEGDecoder. 2013-09-16 19:54:19 +02:00
Johannes Schickel
4809294b43 GRAPHICS: Make JPEGDecoder request RGB output from libjpeg by default.
This fixes loading of JPEG files which contain RGB color space instead of YUV.
It is a pretty odd extension of JPEG files by Adobe which is indicated by this:
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe

To still support Groovie's need for YUV data I added some possibility to
request direct YUV output.
2013-09-16 19:54:19 +02:00
Johannes Schickel
ac66cc9219 GRAPHICS: Implement JPEGDecoder based on libjpeg. 2013-09-16 15:55:36 +02:00
RichieSams
6f4e80e36e ZVISION: Add wrapper function for copyRectToSurface
Also rename some arguments to make them more clear
2013-09-12 14:07:42 -05:00
Willem Jan Palenstijn
6417192584 Merge branch 'master' into zvision
Conflicts:
	video/avi_decoder.cpp
2013-09-24 13:55:54 +02:00
Eugene Sandulenko
8a340007ea Merge pull request #361 from rundfunk47/guiimprovements
GUI: Various GUI Improvements
2013-08-22 05:31:23 -07:00
Johannes Schickel
a2fabef87c GRAPHICS: Increase robustness of VectorRendererSpec::drawString. 2013-08-22 11:46:50 +02:00
Johannes Schickel
af13b74d02 GRAPHICS: Unify drawing paths in VectorRendererSpec::drawString.
Formerly, the behavior between when a drawable area was specified and when not
was different in a sense which is not expected. For example, when an empty
textDrawableArea was passed and the text could be drawn outside the 'area'
specified. While when a textDrawableArea covering the whole screen was passed
the text was clipped inside 'area'. Now, the code does follow the latter logic
in both cases.

I am not sure whether this will cause any issues, but a quick check of the
launcher and options menu didn't reveal anything...
2013-08-22 11:46:49 +02:00