Skip to content

Commit

Permalink
fixed compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
codewitch-honey-crisis committed Jun 11, 2024
1 parent aa8087e commit 081874f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions include/gfx_drawing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <math.h>

//#include <cmath>
#include "gfx_pixel.hpp"

#include "gfx_bitmap.hpp"
#include "gfx_core.hpp"
#include "gfx_encoding.hpp"
Expand Down Expand Up @@ -2131,10 +2131,9 @@ struct draw {
if (transparent_background == false) {
bool opaque = true;
if (PixelType::template has_channel_names<channel_name::A>::value) {
auto fca = helpers::pixel_get_alpha<PixelType,true>::valuer(forecolor);
auto bca = helpers::pixel_get_alpha<PixelType,true>::valuer(backcolor);
if (bca != 1.0f ||
fca != 1.0f) {
constexpr static const auto i = PixelType::template channel_index_by_name<channel_name::A>::value;
if (forecolor.template channelr_unchecked<i>() != 1.0 ||
backcolor.template channelr_unchecked<i>() != 1.0) {
opaque = false;
}
}
Expand Down Expand Up @@ -2175,8 +2174,11 @@ struct draw {
return r;
}
}
auto alpha_factor = helpers::pixel_get_alpha<PixelType,PixelType::template has_channel_names<channel_name::A>::value>::valuer(forecolor);

constexpr static const auto a_idx = PixelType::template channel_index_by_name<channel_name::A>::value;
auto alpha_factor = 1.0;
if (a_idx != -1) {
alpha_factor = forecolor.template channelr_unchecked<a_idx>();
}
typename Destination::pixel_type dpx, fgpx, bgpx, obgpx;
r = convert_palette_from(destination, forecolor, &fgpx);
if (r != gfx_result::success) {
Expand Down Expand Up @@ -2275,7 +2277,6 @@ struct draw {
template <typename Destination, typename Source, typename PixelType>
static inline gfx_result icon_impl(Destination& destination, spoint16 location, const Source& source, PixelType forecolor, PixelType backcolor, bool transparent_background, bool invert, const srect16* clip, bool async) {
static_assert(Source::pixel_type::template has_channel_names<channel_name::A>::value, "The source must have an alpha channel");
//gfx_result r;
// suspend if we can
helpers::suspender<Destination, Destination::caps::suspend, Destination::caps::async> stok(destination, async);
return draw_icon_helper<Destination, Source, PixelType, Destination::caps::read>::do_draw(destination, location, source, forecolor, backcolor, transparent_background, invert, clip, async);
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "htcw_gfx",
"version": "1.670.1",
"version": "1.670.2",
"description": "A device independent graphics library for embedded and IoT devices",
"keywords": ["tft", "lcd","e-paper","e-ink", "graphics", "spi", "parallel", "i2c", "drawing", "jpg", "ttf","vlw", "font", "svg","2d", "vector"],
"authors": {
Expand Down

0 comments on commit 081874f

Please sign in to comment.