Skip to content

Commit

Permalink
Merge branch 'egil/egd_render' into ccase/r13b04_dev
Browse files Browse the repository at this point in the history
* egil/egd_render:
  Fix egd_render transparent to use float constants

OTP-8425  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.
  • Loading branch information
Erlang/OTP committed Feb 10, 2010
2 parents 3241e0a + e7842b4 commit 29262ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions lib/percept/src/egd_render.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%

%%
Expand Down 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
14 changes: 9 additions & 5 deletions lib/percept/test/egd_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2007-2009. All Rights Reserved.
%%
%%
%% Copyright Ericsson AB 2007-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%%
%% %CopyrightEnd%
%%

Expand Down 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 29262ef

Please sign in to comment.