diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-08 22:12:18 +0700 |
---|---|---|
committer | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-08 22:24:56 +0700 |
commit | 2fd204c35e6883d36d4c15adbe6725ffffd73c6f (patch) | |
tree | 2d1c630fe0f08014cfe8cca04fab9b1082c31aeb /core/image.cpp | |
parent | 0067982f5ece3145c00e2f4c0bc092d1ec28c8b3 (diff) |
Refactor 'treshold' to 'threshold'
Diffstat (limited to 'core/image.cpp')
-rw-r--r-- | core/image.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/core/image.cpp b/core/image.cpp index 76f21a25de..6ab8bb6d46 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1325,19 +1325,19 @@ void Image::create(const char **p_xpm) { line++; } } -#define DETECT_ALPHA_MAX_TRESHOLD 254 -#define DETECT_ALPHA_MIN_TRESHOLD 2 - -#define DETECT_ALPHA(m_value) \ - { \ - uint8_t value = m_value; \ - if (value < DETECT_ALPHA_MIN_TRESHOLD) \ - bit = true; \ - else if (value < DETECT_ALPHA_MAX_TRESHOLD) { \ - \ - detected = true; \ - break; \ - } \ +#define DETECT_ALPHA_MAX_THRESHOLD 254 +#define DETECT_ALPHA_MIN_THRESHOLD 2 + +#define DETECT_ALPHA(m_value) \ + { \ + uint8_t value = m_value; \ + if (value < DETECT_ALPHA_MIN_THRESHOLD) \ + bit = true; \ + else if (value < DETECT_ALPHA_MAX_THRESHOLD) { \ + \ + detected = true; \ + break; \ + } \ } #define DETECT_NON_ALPHA(m_value) \ @@ -1673,7 +1673,7 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co const uint8_t *src_data_ptr = rp.ptr(); int pixel_size = get_format_pixel_size(format); - + Ref<Image> msk = p_mask; msk->lock(); @@ -1683,7 +1683,7 @@ void Image::blit_rect_mask(const Ref<Image> &p_src, const Ref<Image> &p_mask, co int src_x = clipped_src_rect.position.x + j; int src_y = clipped_src_rect.position.y + i; - + if (msk->get_pixel(src_x, src_y).a != 0) { int dst_x = dest_rect.position.x + j; @@ -2434,7 +2434,7 @@ void Image::fix_alpha_edges() { unsigned char *data_ptr = wp.ptr(); const int max_radius = 4; - const int alpha_treshold = 20; + const int alpha_threshold = 20; const int max_dist = 0x7FFFFFFF; for (int i = 0; i < height; i++) { @@ -2443,7 +2443,7 @@ void Image::fix_alpha_edges() { const uint8_t *rptr = &srcptr[(i * width + j) * 4]; uint8_t *wptr = &data_ptr[(i * width + j) * 4]; - if (rptr[3] >= alpha_treshold) + if (rptr[3] >= alpha_threshold) continue; int closest_dist = max_dist; @@ -2465,7 +2465,7 @@ void Image::fix_alpha_edges() { const uint8_t *rp = &srcptr[(k * width + l) << 2]; - if (rp[3] < alpha_treshold) + if (rp[3] < alpha_threshold) continue; closest_color[0] = rp[0]; |