Skip to content

Commit

Permalink
Fix egd_render transparent to use float constants
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
psyeugenic committed Feb 4, 2010
1 parent 76e9c68 commit e7842b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/percept/src/egd_render.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 4 additions & 0 deletions lib/percept/test/egd_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

Expand Down

0 comments on commit e7842b4

Please sign in to comment.