aboutsummaryrefslogtreecommitdiffstats
path: root/lib/percept
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <psyeugenic@gmail.com>2010-02-04 18:04:37 +0100
committerBjörn-Egil Dahlberg <psyeugenic@gmail.com>2010-02-04 18:04:37 +0100
commite7842b4f46ef909cac25666be43a5a6b6ca7551b (patch)
tree51e5a6857d1386e851e0b3d5215dea1ad10cb8fb /lib/percept
parent76e9c68368dfd9ec20181939511e2baf93fc73d9 (diff)
downloadotp-e7842b4f46ef909cac25666be43a5a6b6ca7551b.tar.gz
otp-e7842b4f46ef909cac25666be43a5a6b6ca7551b.tar.bz2
otp-e7842b4f46ef909cac25666be43a5a6b6ca7551b.zip
Fix egd_render transparent to use float constants
The render engine has float guards to enhance beam code generation. However, the default case used integers which caused the engine to crash. This is now fixed.
Diffstat (limited to 'lib/percept')
-rw-r--r--lib/percept/src/egd_render.erl2
-rw-r--r--lib/percept/test/egd_SUITE.erl4
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/percept/src/egd_render.erl b/lib/percept/src/egd_render.erl
index cea9d2d926..0d459f8b09 100644
--- a/lib/percept/src/egd_render.erl
+++ b/lib/percept/src/egd_render.erl
@@ -179,7 +179,7 @@ color(Trans,Layers,Type,OldC) ->
color([],_) -> {0.0,0.0,0.0,0.0};
color([{_,C}|_],opaque) -> C;
-color(Layers,alpha) -> color1({0,0,0,0},Layers).
+color(Layers,alpha) -> color1({0.0,0.0,0.0,0.0},Layers).
color1(Color,[]) -> Color;
color1(Color,[{_,C}|Layers]) -> color1(alpha_blend(Color,C),Layers).
diff --git a/lib/percept/test/egd_SUITE.erl b/lib/percept/test/egd_SUITE.erl
index a2595400dd..df78600fc7 100644
--- a/lib/percept/test/egd_SUITE.erl
+++ b/lib/percept/test/egd_SUITE.erl
@@ -143,6 +143,8 @@ image_shape(Config) when is_list(Config) ->
?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
+ ?line <<_/binary>> = egd:render(Im, raw_bitmap, [{render_engine, alpha}]),
+
?line ok = egd:destroy(Im),
erase(image_size),
ok.
@@ -177,6 +179,8 @@ image_primitives(Config) when is_list(Config) ->
?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt2, Fgc),
?line ok = bitmap_point_has_color(Bitmap, {W,H}, Pt1, Fgc),
+ ?line <<_/binary>> = egd_render:binary(Im2, alpha),
+
erase(image_size),
ok.