| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fxcodec/include/fx_codec.h" | 7 #include "core/fxcodec/include/fx_codec.h" |
| 8 #include "core/fxge/dib/dib_int.h" | 8 #include "core/fxge/dib/dib_int.h" |
| 9 #include "core/fxge/include/fx_ge.h" | 9 #include "core/fxge/include/fx_ge.h" |
| 10 | 10 |
| 11 const uint8_t _color_sqrt[256] = { | 11 namespace { |
| 12 |
| 13 const uint8_t color_sqrt[256] = { |
| 12 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, | 14 0x00, 0x03, 0x07, 0x0B, 0x0F, 0x12, 0x16, 0x19, 0x1D, 0x20, 0x23, 0x26, |
| 13 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, | 15 0x29, 0x2C, 0x2F, 0x32, 0x35, 0x37, 0x3A, 0x3C, 0x3F, 0x41, 0x43, 0x46, |
| 14 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C, | 16 0x48, 0x4A, 0x4C, 0x4E, 0x50, 0x52, 0x54, 0x56, 0x57, 0x59, 0x5B, 0x5C, |
| 15 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D, | 17 0x5E, 0x60, 0x61, 0x63, 0x64, 0x65, 0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D, |
| 16 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, | 18 0x6E, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, |
| 17 0x7B, 0x7C, 0x7D, 0x7E, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, | 19 0x7B, 0x7C, 0x7D, 0x7E, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, |
| 18 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x91, | 20 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x91, |
| 19 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, | 21 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, |
| 20 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5, | 22 0x9C, 0x9D, 0x9E, 0x9F, 0xA0, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA4, 0xA5, |
| 21 0xA6, 0xA7, 0xA7, 0xA8, 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE, | 23 0xA6, 0xA7, 0xA7, 0xA8, 0xA9, 0xAA, 0xAA, 0xAB, 0xAC, 0xAD, 0xAD, 0xAE, |
| 22 0xAF, 0xB0, 0xB0, 0xB1, 0xB2, 0xB3, 0xB3, 0xB4, 0xB5, 0xB5, 0xB6, 0xB7, | 24 0xAF, 0xB0, 0xB0, 0xB1, 0xB2, 0xB3, 0xB3, 0xB4, 0xB5, 0xB5, 0xB6, 0xB7, |
| 23 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD, 0xBE, 0xBE, 0xBF, | 25 0xB7, 0xB8, 0xB9, 0xBA, 0xBA, 0xBB, 0xBC, 0xBC, 0xBD, 0xBE, 0xBE, 0xBF, |
| 24 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7, | 26 0xC0, 0xC0, 0xC1, 0xC2, 0xC2, 0xC3, 0xC4, 0xC4, 0xC5, 0xC6, 0xC6, 0xC7, |
| 25 0xC7, 0xC8, 0xC9, 0xC9, 0xCA, 0xCB, 0xCB, 0xCC, 0xCC, 0xCD, 0xCE, 0xCE, | 27 0xC7, 0xC8, 0xC9, 0xC9, 0xCA, 0xCB, 0xCB, 0xCC, 0xCC, 0xCD, 0xCE, 0xCE, |
| 26 0xCF, 0xD0, 0xD0, 0xD1, 0xD1, 0xD2, 0xD3, 0xD3, 0xD4, 0xD4, 0xD5, 0xD6, | 28 0xCF, 0xD0, 0xD0, 0xD1, 0xD1, 0xD2, 0xD3, 0xD3, 0xD4, 0xD4, 0xD5, 0xD6, |
| 27 0xD6, 0xD7, 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDA, 0xDB, 0xDC, 0xDC, 0xDD, | 29 0xD6, 0xD7, 0xD7, 0xD8, 0xD9, 0xD9, 0xDA, 0xDA, 0xDB, 0xDC, 0xDC, 0xDD, |
| 28 0xDD, 0xDE, 0xDE, 0xDF, 0xE0, 0xE0, 0xE1, 0xE1, 0xE2, 0xE2, 0xE3, 0xE4, | 30 0xDD, 0xDE, 0xDE, 0xDF, 0xE0, 0xE0, 0xE1, 0xE1, 0xE2, 0xE2, 0xE3, 0xE4, |
| 29 0xE4, 0xE5, 0xE5, 0xE6, 0xE6, 0xE7, 0xE7, 0xE8, 0xE9, 0xE9, 0xEA, 0xEA, | 31 0xE4, 0xE5, 0xE5, 0xE6, 0xE6, 0xE7, 0xE7, 0xE8, 0xE9, 0xE9, 0xEA, 0xEA, |
| 30 0xEB, 0xEB, 0xEC, 0xEC, 0xED, 0xED, 0xEE, 0xEE, 0xEF, 0xF0, 0xF0, 0xF1, | 32 0xEB, 0xEB, 0xEC, 0xEC, 0xED, 0xED, 0xEE, 0xEE, 0xEF, 0xF0, 0xF0, 0xF1, |
| 31 0xF1, 0xF2, 0xF2, 0xF3, 0xF3, 0xF4, 0xF4, 0xF5, 0xF5, 0xF6, 0xF6, 0xF7, | 33 0xF1, 0xF2, 0xF2, 0xF3, 0xF3, 0xF4, 0xF4, 0xF5, 0xF5, 0xF6, 0xF6, 0xF7, |
| 32 0xF7, 0xF8, 0xF8, 0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFC, 0xFC, 0xFD, | 34 0xF7, 0xF8, 0xF8, 0xF9, 0xF9, 0xFA, 0xFA, 0xFB, 0xFB, 0xFC, 0xFC, 0xFD, |
| 33 0xFD, 0xFE, 0xFE, 0xFF}; | 35 0xFD, 0xFE, 0xFE, 0xFF}; |
| 34 int _BLEND(int blend_mode, int back_color, int src_color) { | 36 |
| 37 int Blend(int blend_mode, int back_color, int src_color) { |
| 35 switch (blend_mode) { | 38 switch (blend_mode) { |
| 36 case FXDIB_BLEND_NORMAL: | 39 case FXDIB_BLEND_NORMAL: |
| 37 return src_color; | 40 return src_color; |
| 38 case FXDIB_BLEND_MULTIPLY: | 41 case FXDIB_BLEND_MULTIPLY: |
| 39 return src_color * back_color / 255; | 42 return src_color * back_color / 255; |
| 40 case FXDIB_BLEND_SCREEN: | 43 case FXDIB_BLEND_SCREEN: |
| 41 return src_color + back_color - src_color * back_color / 255; | 44 return src_color + back_color - src_color * back_color / 255; |
| 42 case FXDIB_BLEND_OVERLAY: | 45 case FXDIB_BLEND_OVERLAY: |
| 43 return _BLEND(FXDIB_BLEND_HARDLIGHT, src_color, back_color); | 46 return Blend(FXDIB_BLEND_HARDLIGHT, src_color, back_color); |
| 44 case FXDIB_BLEND_DARKEN: | 47 case FXDIB_BLEND_DARKEN: |
| 45 return src_color < back_color ? src_color : back_color; | 48 return src_color < back_color ? src_color : back_color; |
| 46 case FXDIB_BLEND_LIGHTEN: | 49 case FXDIB_BLEND_LIGHTEN: |
| 47 return src_color > back_color ? src_color : back_color; | 50 return src_color > back_color ? src_color : back_color; |
| 48 case FXDIB_BLEND_COLORDODGE: { | 51 case FXDIB_BLEND_COLORDODGE: { |
| 49 if (src_color == 255) { | 52 if (src_color == 255) { |
| 50 return src_color; | 53 return src_color; |
| 51 } | 54 } |
| 52 int result = back_color * 255 / (255 - src_color); | 55 int result = back_color * 255 / (255 - src_color); |
| 53 if (result > 255) { | 56 if (result > 255) { |
| 54 return 255; | 57 return 255; |
| 55 } | 58 } |
| 56 return result; | 59 return result; |
| 57 } | 60 } |
| 58 case FXDIB_BLEND_COLORBURN: { | 61 case FXDIB_BLEND_COLORBURN: { |
| 59 if (src_color == 0) { | 62 if (src_color == 0) { |
| 60 return src_color; | 63 return src_color; |
| 61 } | 64 } |
| 62 int result = (255 - back_color) * 255 / src_color; | 65 int result = (255 - back_color) * 255 / src_color; |
| 63 if (result > 255) { | 66 if (result > 255) { |
| 64 result = 255; | 67 result = 255; |
| 65 } | 68 } |
| 66 return 255 - result; | 69 return 255 - result; |
| 67 } | 70 } |
| 68 case FXDIB_BLEND_HARDLIGHT: | 71 case FXDIB_BLEND_HARDLIGHT: |
| 69 if (src_color < 128) { | 72 if (src_color < 128) { |
| 70 return (src_color * back_color * 2) / 255; | 73 return (src_color * back_color * 2) / 255; |
| 71 } | 74 } |
| 72 return _BLEND(FXDIB_BLEND_SCREEN, back_color, 2 * src_color - 255); | 75 return Blend(FXDIB_BLEND_SCREEN, back_color, 2 * src_color - 255); |
| 73 case FXDIB_BLEND_SOFTLIGHT: { | 76 case FXDIB_BLEND_SOFTLIGHT: { |
| 74 if (src_color < 128) { | 77 if (src_color < 128) { |
| 75 return back_color - | 78 return back_color - |
| 76 (255 - 2 * src_color) * back_color * (255 - back_color) / 255 / | 79 (255 - 2 * src_color) * back_color * (255 - back_color) / 255 / |
| 77 255; | 80 255; |
| 78 } | 81 } |
| 79 return back_color + | 82 return back_color + |
| 80 (2 * src_color - 255) * (_color_sqrt[back_color] - back_color) / | 83 (2 * src_color - 255) * (color_sqrt[back_color] - back_color) / |
| 81 255; | 84 255; |
| 82 } | 85 } |
| 83 case FXDIB_BLEND_DIFFERENCE: | 86 case FXDIB_BLEND_DIFFERENCE: |
| 84 return back_color < src_color ? src_color - back_color | 87 return back_color < src_color ? src_color - back_color |
| 85 : back_color - src_color; | 88 : back_color - src_color; |
| 86 case FXDIB_BLEND_EXCLUSION: | 89 case FXDIB_BLEND_EXCLUSION: |
| 87 return back_color + src_color - 2 * back_color * src_color / 255; | 90 return back_color + src_color - 2 * back_color * src_color / 255; |
| 88 } | 91 } |
| 89 return src_color; | 92 return src_color; |
| 90 } | 93 } |
| 91 struct _RGB { | 94 |
| 95 struct RGB { |
| 92 int red; | 96 int red; |
| 93 int green; | 97 int green; |
| 94 int blue; | 98 int blue; |
| 95 }; | 99 }; |
| 96 static inline int _Lum(_RGB color) { | 100 |
| 101 int Lum(RGB color) { |
| 97 return (color.red * 30 + color.green * 59 + color.blue * 11) / 100; | 102 return (color.red * 30 + color.green * 59 + color.blue * 11) / 100; |
| 98 } | 103 } |
| 99 static _RGB _ClipColor(_RGB color) { | 104 |
| 100 int l = _Lum(color); | 105 RGB ClipColor(RGB color) { |
| 106 int l = Lum(color); |
| 101 int n = color.red; | 107 int n = color.red; |
| 102 if (color.green < n) { | 108 if (color.green < n) { |
| 103 n = color.green; | 109 n = color.green; |
| 104 } | 110 } |
| 105 if (color.blue < n) { | 111 if (color.blue < n) { |
| 106 n = color.blue; | 112 n = color.blue; |
| 107 } | 113 } |
| 108 int x = color.red; | 114 int x = color.red; |
| 109 if (color.green > x) { | 115 if (color.green > x) { |
| 110 x = color.green; | 116 x = color.green; |
| 111 } | 117 } |
| 112 if (color.blue > x) { | 118 if (color.blue > x) { |
| 113 x = color.blue; | 119 x = color.blue; |
| 114 } | 120 } |
| 115 if (n < 0) { | 121 if (n < 0) { |
| 116 color.red = l + ((color.red - l) * l / (l - n)); | 122 color.red = l + ((color.red - l) * l / (l - n)); |
| 117 color.green = l + ((color.green - l) * l / (l - n)); | 123 color.green = l + ((color.green - l) * l / (l - n)); |
| 118 color.blue = l + ((color.blue - l) * l / (l - n)); | 124 color.blue = l + ((color.blue - l) * l / (l - n)); |
| 119 } | 125 } |
| 120 if (x > 255) { | 126 if (x > 255) { |
| 121 color.red = l + ((color.red - l) * (255 - l) / (x - l)); | 127 color.red = l + ((color.red - l) * (255 - l) / (x - l)); |
| 122 color.green = l + ((color.green - l) * (255 - l) / (x - l)); | 128 color.green = l + ((color.green - l) * (255 - l) / (x - l)); |
| 123 color.blue = l + ((color.blue - l) * (255 - l) / (x - l)); | 129 color.blue = l + ((color.blue - l) * (255 - l) / (x - l)); |
| 124 } | 130 } |
| 125 return color; | 131 return color; |
| 126 } | 132 } |
| 127 static _RGB _SetLum(_RGB color, int l) { | 133 |
| 128 int d = l - _Lum(color); | 134 RGB SetLum(RGB color, int l) { |
| 135 int d = l - Lum(color); |
| 129 color.red += d; | 136 color.red += d; |
| 130 color.green += d; | 137 color.green += d; |
| 131 color.blue += d; | 138 color.blue += d; |
| 132 return _ClipColor(color); | 139 return ClipColor(color); |
| 133 } | 140 } |
| 134 static int _Sat(_RGB color) { | 141 |
| 142 int Sat(RGB color) { |
| 135 int n = color.red; | 143 int n = color.red; |
| 136 if (color.green < n) { | 144 if (color.green < n) { |
| 137 n = color.green; | 145 n = color.green; |
| 138 } | 146 } |
| 139 if (color.blue < n) { | 147 if (color.blue < n) { |
| 140 n = color.blue; | 148 n = color.blue; |
| 141 } | 149 } |
| 142 int x = color.red; | 150 int x = color.red; |
| 143 if (color.green > x) { | 151 if (color.green > x) { |
| 144 x = color.green; | 152 x = color.green; |
| 145 } | 153 } |
| 146 if (color.blue > x) { | 154 if (color.blue > x) { |
| 147 x = color.blue; | 155 x = color.blue; |
| 148 } | 156 } |
| 149 return x - n; | 157 return x - n; |
| 150 } | 158 } |
| 151 static _RGB _SetSat(_RGB color, int s) { | 159 |
| 160 RGB SetSat(RGB color, int s) { |
| 152 int* max = &color.red; | 161 int* max = &color.red; |
| 153 int* mid = &color.red; | 162 int* mid = &color.red; |
| 154 int* min = &color.red; | 163 int* min = &color.red; |
| 155 if (color.green > *max) { | 164 if (color.green > *max) { |
| 156 max = &color.green; | 165 max = &color.green; |
| 157 } | 166 } |
| 158 if (color.blue > *max) { | 167 if (color.blue > *max) { |
| 159 max = &color.blue; | 168 max = &color.blue; |
| 160 } | 169 } |
| 161 if (color.green < *min) { | 170 if (color.green < *min) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 189 mid = &color.green; | 198 mid = &color.green; |
| 190 } | 199 } |
| 191 } | 200 } |
| 192 if (*max > *min) { | 201 if (*max > *min) { |
| 193 *mid = (*mid - *min) * s / (*max - *min); | 202 *mid = (*mid - *min) * s / (*max - *min); |
| 194 *max = s; | 203 *max = s; |
| 195 *min = 0; | 204 *min = 0; |
| 196 } | 205 } |
| 197 return color; | 206 return color; |
| 198 } | 207 } |
| 199 void _RGB_Blend(int blend_mode, | 208 |
| 200 const uint8_t* src_scan, | 209 void RGB_Blend(int blend_mode, |
| 201 uint8_t* dest_scan, | 210 const uint8_t* src_scan, |
| 202 int results[3]) { | 211 uint8_t* dest_scan, |
| 203 _RGB src; | 212 int results[3]) { |
| 204 _RGB back; | 213 RGB src; |
| 205 _RGB result = {0, 0, 0}; | 214 RGB back; |
| 215 RGB result = {0, 0, 0}; |
| 206 src.red = src_scan[2]; | 216 src.red = src_scan[2]; |
| 207 src.green = src_scan[1]; | 217 src.green = src_scan[1]; |
| 208 src.blue = src_scan[0]; | 218 src.blue = src_scan[0]; |
| 209 back.red = dest_scan[2]; | 219 back.red = dest_scan[2]; |
| 210 back.green = dest_scan[1]; | 220 back.green = dest_scan[1]; |
| 211 back.blue = dest_scan[0]; | 221 back.blue = dest_scan[0]; |
| 212 switch (blend_mode) { | 222 switch (blend_mode) { |
| 213 case FXDIB_BLEND_HUE: | 223 case FXDIB_BLEND_HUE: |
| 214 result = _SetLum(_SetSat(src, _Sat(back)), _Lum(back)); | 224 result = SetLum(SetSat(src, Sat(back)), Lum(back)); |
| 215 break; | 225 break; |
| 216 case FXDIB_BLEND_SATURATION: | 226 case FXDIB_BLEND_SATURATION: |
| 217 result = _SetLum(_SetSat(back, _Sat(src)), _Lum(back)); | 227 result = SetLum(SetSat(back, Sat(src)), Lum(back)); |
| 218 break; | 228 break; |
| 219 case FXDIB_BLEND_COLOR: | 229 case FXDIB_BLEND_COLOR: |
| 220 result = _SetLum(src, _Lum(back)); | 230 result = SetLum(src, Lum(back)); |
| 221 break; | 231 break; |
| 222 case FXDIB_BLEND_LUMINOSITY: | 232 case FXDIB_BLEND_LUMINOSITY: |
| 223 result = _SetLum(back, _Lum(src)); | 233 result = SetLum(back, Lum(src)); |
| 224 break; | 234 break; |
| 225 } | 235 } |
| 226 results[0] = result.blue; | 236 results[0] = result.blue; |
| 227 results[1] = result.green; | 237 results[1] = result.green; |
| 228 results[2] = result.red; | 238 results[2] = result.red; |
| 229 } | 239 } |
| 230 inline void _CompositeRow_Argb2Mask(uint8_t* dest_scan, | 240 |
| 231 const uint8_t* src_scan, | 241 void CompositeRow_Argb2Mask(uint8_t* dest_scan, |
| 232 int pixel_count, | 242 const uint8_t* src_scan, |
| 233 const uint8_t* clip_scan) { | 243 int pixel_count, |
| 244 const uint8_t* clip_scan) { |
| 234 src_scan += 3; | 245 src_scan += 3; |
| 235 for (int col = 0; col < pixel_count; col++) { | 246 for (int col = 0; col < pixel_count; col++) { |
| 236 int src_alpha = *src_scan; | 247 int src_alpha = *src_scan; |
| 237 if (clip_scan) { | 248 if (clip_scan) { |
| 238 src_alpha = clip_scan[col] * src_alpha / 255; | 249 src_alpha = clip_scan[col] * src_alpha / 255; |
| 239 } | 250 } |
| 240 uint8_t back_alpha = *dest_scan; | 251 uint8_t back_alpha = *dest_scan; |
| 241 if (!back_alpha) { | 252 if (!back_alpha) { |
| 242 *dest_scan = src_alpha; | 253 *dest_scan = src_alpha; |
| 243 } else if (src_alpha) { | 254 } else if (src_alpha) { |
| 244 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 255 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 245 } | 256 } |
| 246 dest_scan++; | 257 dest_scan++; |
| 247 src_scan += 4; | 258 src_scan += 4; |
| 248 } | 259 } |
| 249 } | 260 } |
| 250 void _CompositeRow_Rgba2Mask(uint8_t* dest_scan, | 261 |
| 251 const uint8_t* src_alpha_scan, | 262 void CompositeRow_Rgba2Mask(uint8_t* dest_scan, |
| 252 int pixel_count, | 263 const uint8_t* src_alpha_scan, |
| 253 const uint8_t* clip_scan) { | 264 int pixel_count, |
| 265 const uint8_t* clip_scan) { |
| 254 for (int col = 0; col < pixel_count; col++) { | 266 for (int col = 0; col < pixel_count; col++) { |
| 255 int src_alpha = *src_alpha_scan++; | 267 int src_alpha = *src_alpha_scan++; |
| 256 if (clip_scan) { | 268 if (clip_scan) { |
| 257 src_alpha = clip_scan[col] * src_alpha / 255; | 269 src_alpha = clip_scan[col] * src_alpha / 255; |
| 258 } | 270 } |
| 259 uint8_t back_alpha = *dest_scan; | 271 uint8_t back_alpha = *dest_scan; |
| 260 if (!back_alpha) { | 272 if (!back_alpha) { |
| 261 *dest_scan = src_alpha; | 273 *dest_scan = src_alpha; |
| 262 } else if (src_alpha) { | 274 } else if (src_alpha) { |
| 263 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 275 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 264 } | 276 } |
| 265 dest_scan++; | 277 dest_scan++; |
| 266 } | 278 } |
| 267 } | 279 } |
| 268 void _CompositeRow_Rgb2Mask(uint8_t* dest_scan, | 280 |
| 269 const uint8_t* src_scan, | 281 void CompositeRow_Rgb2Mask(uint8_t* dest_scan, |
| 270 int width, | 282 const uint8_t* src_scan, |
| 271 const uint8_t* clip_scan) { | 283 int width, |
| 284 const uint8_t* clip_scan) { |
| 272 if (clip_scan) { | 285 if (clip_scan) { |
| 273 for (int i = 0; i < width; i++) { | 286 for (int i = 0; i < width; i++) { |
| 274 *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan); | 287 *dest_scan = FXDIB_ALPHA_UNION(*dest_scan, *clip_scan); |
| 275 dest_scan++; | 288 dest_scan++; |
| 276 clip_scan++; | 289 clip_scan++; |
| 277 } | 290 } |
| 278 } else { | 291 } else { |
| 279 FXSYS_memset(dest_scan, 0xff, width); | 292 FXSYS_memset(dest_scan, 0xff, width); |
| 280 } | 293 } |
| 281 } | 294 } |
| 282 void _CompositeRow_Argb2Graya(uint8_t* dest_scan, | 295 |
| 283 const uint8_t* src_scan, | 296 void CompositeRow_Argb2Graya(uint8_t* dest_scan, |
| 284 int pixel_count, | 297 const uint8_t* src_scan, |
| 285 int blend_type, | 298 int pixel_count, |
| 286 const uint8_t* clip_scan, | 299 int blend_type, |
| 287 const uint8_t* src_alpha_scan, | 300 const uint8_t* clip_scan, |
| 288 uint8_t* dst_alpha_scan, | 301 const uint8_t* src_alpha_scan, |
| 289 void* pIccTransform) { | 302 uint8_t* dst_alpha_scan, |
| 303 void* pIccTransform) { |
| 290 CCodec_IccModule* pIccModule = nullptr; | 304 CCodec_IccModule* pIccModule = nullptr; |
| 291 if (pIccTransform) | 305 if (pIccTransform) |
| 292 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 306 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 293 | 307 |
| 294 if (blend_type) { | 308 if (blend_type) { |
| 295 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 309 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 296 if (src_alpha_scan) { | 310 if (src_alpha_scan) { |
| 297 for (int col = 0; col < pixel_count; col++) { | 311 for (int col = 0; col < pixel_count; col++) { |
| 298 uint8_t back_alpha = *dst_alpha_scan; | 312 uint8_t back_alpha = *dst_alpha_scan; |
| 299 if (back_alpha == 0) { | 313 if (back_alpha == 0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 329 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); | 343 int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan); |
| 330 uint8_t gray; | 344 uint8_t gray; |
| 331 if (pIccTransform) { | 345 if (pIccTransform) { |
| 332 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 346 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 333 } else { | 347 } else { |
| 334 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 348 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 335 } | 349 } |
| 336 if (bNonseparableBlend) | 350 if (bNonseparableBlend) |
| 337 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 351 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 338 else | 352 else |
| 339 gray = _BLEND(blend_type, *dest_scan, gray); | 353 gray = Blend(blend_type, *dest_scan, gray); |
| 340 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 354 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 341 dest_scan++; | 355 dest_scan++; |
| 342 dst_alpha_scan++; | 356 dst_alpha_scan++; |
| 343 src_scan += 3; | 357 src_scan += 3; |
| 344 } | 358 } |
| 345 } else { | 359 } else { |
| 346 for (int col = 0; col < pixel_count; col++) { | 360 for (int col = 0; col < pixel_count; col++) { |
| 347 uint8_t back_alpha = *dst_alpha_scan; | 361 uint8_t back_alpha = *dst_alpha_scan; |
| 348 if (back_alpha == 0) { | 362 if (back_alpha == 0) { |
| 349 int src_alpha = src_scan[3]; | 363 int src_alpha = src_scan[3]; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 490 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 477 | 491 |
| 478 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 492 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 479 dest_scan++; | 493 dest_scan++; |
| 480 dst_alpha_scan++; | 494 dst_alpha_scan++; |
| 481 src_scan += 4; | 495 src_scan += 4; |
| 482 } | 496 } |
| 483 } | 497 } |
| 484 } | 498 } |
| 485 | 499 |
| 486 inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan, | 500 void CompositeRow_Argb2Gray(uint8_t* dest_scan, |
| 487 const uint8_t* src_scan, | 501 const uint8_t* src_scan, |
| 488 int pixel_count, | 502 int pixel_count, |
| 489 int blend_type, | 503 int blend_type, |
| 490 const uint8_t* clip_scan, | 504 const uint8_t* clip_scan, |
| 491 const uint8_t* src_alpha_scan, | 505 const uint8_t* src_alpha_scan, |
| 492 void* pIccTransform) { | 506 void* pIccTransform) { |
| 493 CCodec_IccModule* pIccModule = nullptr; | 507 CCodec_IccModule* pIccModule = nullptr; |
| 494 uint8_t gray; | 508 uint8_t gray; |
| 495 if (pIccTransform) | 509 if (pIccTransform) |
| 496 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 510 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 497 | 511 |
| 498 if (blend_type) { | 512 if (blend_type) { |
| 499 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 513 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 500 if (src_alpha_scan) { | 514 if (src_alpha_scan) { |
| 501 for (int col = 0; col < pixel_count; col++) { | 515 for (int col = 0; col < pixel_count; col++) { |
| 502 int src_alpha = *src_alpha_scan++; | 516 int src_alpha = *src_alpha_scan++; |
| 503 if (clip_scan) | 517 if (clip_scan) |
| 504 src_alpha = clip_scan[col] * src_alpha / 255; | 518 src_alpha = clip_scan[col] * src_alpha / 255; |
| 505 | 519 |
| 506 if (src_alpha) { | 520 if (src_alpha) { |
| 507 if (pIccTransform) | 521 if (pIccTransform) |
| 508 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 522 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 509 else | 523 else |
| 510 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 524 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 511 | 525 |
| 512 if (bNonseparableBlend) | 526 if (bNonseparableBlend) |
| 513 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 527 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 514 else | 528 else |
| 515 gray = _BLEND(blend_type, *dest_scan, gray); | 529 gray = Blend(blend_type, *dest_scan, gray); |
| 516 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 530 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 517 } | 531 } |
| 518 dest_scan++; | 532 dest_scan++; |
| 519 src_scan += 3; | 533 src_scan += 3; |
| 520 } | 534 } |
| 521 } else { | 535 } else { |
| 522 for (int col = 0; col < pixel_count; col++) { | 536 for (int col = 0; col < pixel_count; col++) { |
| 523 int src_alpha = src_scan[3]; | 537 int src_alpha = src_scan[3]; |
| 524 if (clip_scan) | 538 if (clip_scan) |
| 525 src_alpha = clip_scan[col] * src_alpha / 255; | 539 src_alpha = clip_scan[col] * src_alpha / 255; |
| 526 | 540 |
| 527 if (src_alpha) { | 541 if (src_alpha) { |
| 528 if (pIccTransform) | 542 if (pIccTransform) |
| 529 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 543 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 530 else | 544 else |
| 531 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 545 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 532 | 546 |
| 533 if (bNonseparableBlend) | 547 if (bNonseparableBlend) |
| 534 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 548 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 535 else | 549 else |
| 536 gray = _BLEND(blend_type, *dest_scan, gray); | 550 gray = Blend(blend_type, *dest_scan, gray); |
| 537 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 551 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 538 } | 552 } |
| 539 dest_scan++; | 553 dest_scan++; |
| 540 src_scan += 4; | 554 src_scan += 4; |
| 541 } | 555 } |
| 542 } | 556 } |
| 543 return; | 557 return; |
| 544 } | 558 } |
| 545 if (src_alpha_scan) { | 559 if (src_alpha_scan) { |
| 546 for (int col = 0; col < pixel_count; col++) { | 560 for (int col = 0; col < pixel_count; col++) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 572 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 586 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 573 | 587 |
| 574 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 588 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 575 } | 589 } |
| 576 dest_scan++; | 590 dest_scan++; |
| 577 src_scan += 4; | 591 src_scan += 4; |
| 578 } | 592 } |
| 579 } | 593 } |
| 580 } | 594 } |
| 581 | 595 |
| 582 inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan, | 596 void CompositeRow_Rgb2Gray(uint8_t* dest_scan, |
| 583 const uint8_t* src_scan, | 597 const uint8_t* src_scan, |
| 584 int src_Bpp, | 598 int src_Bpp, |
| 585 int pixel_count, | 599 int pixel_count, |
| 586 int blend_type, | 600 int blend_type, |
| 587 const uint8_t* clip_scan, | 601 const uint8_t* clip_scan, |
| 588 void* pIccTransform) { | 602 void* pIccTransform) { |
| 589 CCodec_IccModule* pIccModule = nullptr; | 603 CCodec_IccModule* pIccModule = nullptr; |
| 590 uint8_t gray; | 604 uint8_t gray; |
| 591 if (pIccTransform) { | 605 if (pIccTransform) { |
| 592 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 606 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 593 } | 607 } |
| 594 if (blend_type) { | 608 if (blend_type) { |
| 595 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 609 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 596 for (int col = 0; col < pixel_count; col++) { | 610 for (int col = 0; col < pixel_count; col++) { |
| 597 if (pIccTransform) { | 611 if (pIccTransform) { |
| 598 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 612 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 599 } else { | 613 } else { |
| 600 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 614 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 601 } | 615 } |
| 602 if (bNonseparableBlend) | 616 if (bNonseparableBlend) |
| 603 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 617 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 604 else | 618 else |
| 605 gray = _BLEND(blend_type, *dest_scan, gray); | 619 gray = Blend(blend_type, *dest_scan, gray); |
| 606 if (clip_scan && clip_scan[col] < 255) { | 620 if (clip_scan && clip_scan[col] < 255) { |
| 607 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 621 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 608 } else { | 622 } else { |
| 609 *dest_scan = gray; | 623 *dest_scan = gray; |
| 610 } | 624 } |
| 611 dest_scan++; | 625 dest_scan++; |
| 612 src_scan += src_Bpp; | 626 src_scan += src_Bpp; |
| 613 } | 627 } |
| 614 return; | 628 return; |
| 615 } | 629 } |
| 616 for (int col = 0; col < pixel_count; col++) { | 630 for (int col = 0; col < pixel_count; col++) { |
| 617 if (pIccTransform) { | 631 if (pIccTransform) { |
| 618 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 632 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 619 } else { | 633 } else { |
| 620 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 634 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 621 } | 635 } |
| 622 if (clip_scan && clip_scan[col] < 255) { | 636 if (clip_scan && clip_scan[col] < 255) { |
| 623 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 637 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 624 } else { | 638 } else { |
| 625 *dest_scan = gray; | 639 *dest_scan = gray; |
| 626 } | 640 } |
| 627 dest_scan++; | 641 dest_scan++; |
| 628 src_scan += src_Bpp; | 642 src_scan += src_Bpp; |
| 629 } | 643 } |
| 630 } | 644 } |
| 631 void _CompositeRow_Rgb2Graya(uint8_t* dest_scan, | 645 |
| 632 const uint8_t* src_scan, | 646 void CompositeRow_Rgb2Graya(uint8_t* dest_scan, |
| 633 int src_Bpp, | 647 const uint8_t* src_scan, |
| 634 int pixel_count, | 648 int src_Bpp, |
| 635 int blend_type, | 649 int pixel_count, |
| 636 const uint8_t* clip_scan, | 650 int blend_type, |
| 637 uint8_t* dest_alpha_scan, | 651 const uint8_t* clip_scan, |
| 638 void* pIccTransform) { | 652 uint8_t* dest_alpha_scan, |
| 653 void* pIccTransform) { |
| 639 CCodec_IccModule* pIccModule = nullptr; | 654 CCodec_IccModule* pIccModule = nullptr; |
| 640 if (pIccTransform) { | 655 if (pIccTransform) { |
| 641 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 656 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 642 } | 657 } |
| 643 if (blend_type) { | 658 if (blend_type) { |
| 644 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 659 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 645 for (int col = 0; col < pixel_count; col++) { | 660 for (int col = 0; col < pixel_count; col++) { |
| 646 int back_alpha = *dest_alpha_scan; | 661 int back_alpha = *dest_alpha_scan; |
| 647 if (back_alpha == 0) { | 662 if (back_alpha == 0) { |
| 648 if (pIccTransform) { | 663 if (pIccTransform) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 671 int alpha_ratio = src_alpha * 255 / dest_alpha; | 686 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 672 uint8_t gray; | 687 uint8_t gray; |
| 673 if (pIccTransform) { | 688 if (pIccTransform) { |
| 674 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 689 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 675 } else { | 690 } else { |
| 676 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 691 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 677 } | 692 } |
| 678 if (bNonseparableBlend) | 693 if (bNonseparableBlend) |
| 679 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 694 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 680 else | 695 else |
| 681 gray = _BLEND(blend_type, *dest_scan, gray); | 696 gray = Blend(blend_type, *dest_scan, gray); |
| 682 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 697 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 683 dest_scan++; | 698 dest_scan++; |
| 684 src_scan += src_Bpp; | 699 src_scan += src_Bpp; |
| 685 } | 700 } |
| 686 return; | 701 return; |
| 687 } | 702 } |
| 688 for (int col = 0; col < pixel_count; col++) { | 703 for (int col = 0; col < pixel_count; col++) { |
| 689 int src_alpha = 255; | 704 int src_alpha = 255; |
| 690 if (clip_scan) { | 705 if (clip_scan) { |
| 691 src_alpha = clip_scan[col]; | 706 src_alpha = clip_scan[col]; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 715 if (pIccTransform) { | 730 if (pIccTransform) { |
| 716 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); | 731 pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); |
| 717 } else { | 732 } else { |
| 718 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); | 733 gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan); |
| 719 } | 734 } |
| 720 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 735 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 721 dest_scan++; | 736 dest_scan++; |
| 722 src_scan += src_Bpp; | 737 src_scan += src_Bpp; |
| 723 } | 738 } |
| 724 } | 739 } |
| 725 void _CompositeRow_Argb2Argb(uint8_t* dest_scan, | 740 |
| 726 const uint8_t* src_scan, | 741 void CompositeRow_Argb2Argb(uint8_t* dest_scan, |
| 727 int pixel_count, | 742 const uint8_t* src_scan, |
| 728 int blend_type, | 743 int pixel_count, |
| 729 const uint8_t* clip_scan, | 744 int blend_type, |
| 730 uint8_t* dest_alpha_scan, | 745 const uint8_t* clip_scan, |
| 731 const uint8_t* src_alpha_scan) { | 746 uint8_t* dest_alpha_scan, |
| 747 const uint8_t* src_alpha_scan) { |
| 732 int blended_colors[3]; | 748 int blended_colors[3]; |
| 733 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 749 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 734 if (!dest_alpha_scan) { | 750 if (!dest_alpha_scan) { |
| 735 if (!src_alpha_scan) { | 751 if (!src_alpha_scan) { |
| 736 uint8_t back_alpha = 0; | 752 uint8_t back_alpha = 0; |
| 737 for (int col = 0; col < pixel_count; col++) { | 753 for (int col = 0; col < pixel_count; col++) { |
| 738 back_alpha = dest_scan[3]; | 754 back_alpha = dest_scan[3]; |
| 739 if (back_alpha == 0) { | 755 if (back_alpha == 0) { |
| 740 if (clip_scan) { | 756 if (clip_scan) { |
| 741 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 757 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 757 if (src_alpha == 0) { | 773 if (src_alpha == 0) { |
| 758 dest_scan += 4; | 774 dest_scan += 4; |
| 759 src_scan += 4; | 775 src_scan += 4; |
| 760 continue; | 776 continue; |
| 761 } | 777 } |
| 762 uint8_t dest_alpha = | 778 uint8_t dest_alpha = |
| 763 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 779 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 764 dest_scan[3] = dest_alpha; | 780 dest_scan[3] = dest_alpha; |
| 765 int alpha_ratio = src_alpha * 255 / dest_alpha; | 781 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 766 if (bNonseparableBlend) { | 782 if (bNonseparableBlend) { |
| 767 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 783 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 768 } | 784 } |
| 769 for (int color = 0; color < 3; color++) { | 785 for (int color = 0; color < 3; color++) { |
| 770 if (blend_type) { | 786 if (blend_type) { |
| 771 int blended = bNonseparableBlend | 787 int blended = bNonseparableBlend |
| 772 ? blended_colors[color] | 788 ? blended_colors[color] |
| 773 : _BLEND(blend_type, *dest_scan, *src_scan); | 789 : Blend(blend_type, *dest_scan, *src_scan); |
| 774 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); | 790 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); |
| 775 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 791 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 776 } else { | 792 } else { |
| 777 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); | 793 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); |
| 778 } | 794 } |
| 779 dest_scan++; | 795 dest_scan++; |
| 780 src_scan++; | 796 src_scan++; |
| 781 } | 797 } |
| 782 dest_scan++; | 798 dest_scan++; |
| 783 src_scan++; | 799 src_scan++; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 809 if (src_alpha == 0) { | 825 if (src_alpha == 0) { |
| 810 dest_scan += 4; | 826 dest_scan += 4; |
| 811 src_scan += 3; | 827 src_scan += 3; |
| 812 continue; | 828 continue; |
| 813 } | 829 } |
| 814 uint8_t dest_alpha = | 830 uint8_t dest_alpha = |
| 815 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 831 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 816 dest_scan[3] = dest_alpha; | 832 dest_scan[3] = dest_alpha; |
| 817 int alpha_ratio = src_alpha * 255 / dest_alpha; | 833 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 818 if (bNonseparableBlend) { | 834 if (bNonseparableBlend) { |
| 819 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 835 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 820 } | 836 } |
| 821 for (int color = 0; color < 3; color++) { | 837 for (int color = 0; color < 3; color++) { |
| 822 if (blend_type) { | 838 if (blend_type) { |
| 823 int blended = bNonseparableBlend | 839 int blended = bNonseparableBlend |
| 824 ? blended_colors[color] | 840 ? blended_colors[color] |
| 825 : _BLEND(blend_type, *dest_scan, *src_scan); | 841 : Blend(blend_type, *dest_scan, *src_scan); |
| 826 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); | 842 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); |
| 827 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 843 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 828 } else { | 844 } else { |
| 829 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); | 845 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); |
| 830 } | 846 } |
| 831 dest_scan++; | 847 dest_scan++; |
| 832 src_scan++; | 848 src_scan++; |
| 833 } | 849 } |
| 834 dest_scan++; | 850 dest_scan++; |
| 835 } | 851 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 865 dest_scan += 3; | 881 dest_scan += 3; |
| 866 src_scan += 3; | 882 src_scan += 3; |
| 867 dest_alpha_scan++; | 883 dest_alpha_scan++; |
| 868 continue; | 884 continue; |
| 869 } | 885 } |
| 870 uint8_t dest_alpha = | 886 uint8_t dest_alpha = |
| 871 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 887 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 872 *dest_alpha_scan++ = dest_alpha; | 888 *dest_alpha_scan++ = dest_alpha; |
| 873 int alpha_ratio = src_alpha * 255 / dest_alpha; | 889 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 874 if (bNonseparableBlend) { | 890 if (bNonseparableBlend) { |
| 875 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 891 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 876 } | 892 } |
| 877 for (int color = 0; color < 3; color++) { | 893 for (int color = 0; color < 3; color++) { |
| 878 if (blend_type) { | 894 if (blend_type) { |
| 879 int blended = bNonseparableBlend | 895 int blended = bNonseparableBlend |
| 880 ? blended_colors[color] | 896 ? blended_colors[color] |
| 881 : _BLEND(blend_type, *dest_scan, *src_scan); | 897 : Blend(blend_type, *dest_scan, *src_scan); |
| 882 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); | 898 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); |
| 883 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 899 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 884 } else { | 900 } else { |
| 885 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); | 901 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); |
| 886 } | 902 } |
| 887 dest_scan++; | 903 dest_scan++; |
| 888 src_scan++; | 904 src_scan++; |
| 889 } | 905 } |
| 890 } | 906 } |
| 891 } else { | 907 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 918 dest_scan += 3; | 934 dest_scan += 3; |
| 919 src_scan += 4; | 935 src_scan += 4; |
| 920 dest_alpha_scan++; | 936 dest_alpha_scan++; |
| 921 continue; | 937 continue; |
| 922 } | 938 } |
| 923 uint8_t dest_alpha = | 939 uint8_t dest_alpha = |
| 924 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 940 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 925 *dest_alpha_scan++ = dest_alpha; | 941 *dest_alpha_scan++ = dest_alpha; |
| 926 int alpha_ratio = src_alpha * 255 / dest_alpha; | 942 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 927 if (bNonseparableBlend) { | 943 if (bNonseparableBlend) { |
| 928 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 944 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 929 } | 945 } |
| 930 for (int color = 0; color < 3; color++) { | 946 for (int color = 0; color < 3; color++) { |
| 931 if (blend_type) { | 947 if (blend_type) { |
| 932 int blended = bNonseparableBlend | 948 int blended = bNonseparableBlend |
| 933 ? blended_colors[color] | 949 ? blended_colors[color] |
| 934 : _BLEND(blend_type, *dest_scan, *src_scan); | 950 : Blend(blend_type, *dest_scan, *src_scan); |
| 935 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); | 951 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); |
| 936 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 952 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 937 } else { | 953 } else { |
| 938 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); | 954 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); |
| 939 } | 955 } |
| 940 dest_scan++; | 956 dest_scan++; |
| 941 src_scan++; | 957 src_scan++; |
| 942 } | 958 } |
| 943 src_scan++; | 959 src_scan++; |
| 944 } | 960 } |
| 945 } | 961 } |
| 946 } | 962 } |
| 947 } | 963 } |
| 948 void _CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, | 964 |
| 949 const uint8_t* src_scan, | 965 void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, |
| 950 int width, | 966 const uint8_t* src_scan, |
| 951 int blend_type, | 967 int width, |
| 952 int src_Bpp, | 968 int blend_type, |
| 953 uint8_t* dest_alpha_scan) { | 969 int src_Bpp, |
| 970 uint8_t* dest_alpha_scan) { |
| 954 int blended_colors[3]; | 971 int blended_colors[3]; |
| 955 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 972 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 956 int src_gap = src_Bpp - 3; | 973 int src_gap = src_Bpp - 3; |
| 957 if (dest_alpha_scan) { | 974 if (dest_alpha_scan) { |
| 958 for (int col = 0; col < width; col++) { | 975 for (int col = 0; col < width; col++) { |
| 959 uint8_t back_alpha = *dest_alpha_scan; | 976 uint8_t back_alpha = *dest_alpha_scan; |
| 960 if (back_alpha == 0) { | 977 if (back_alpha == 0) { |
| 961 *dest_scan++ = *src_scan++; | 978 *dest_scan++ = *src_scan++; |
| 962 *dest_scan++ = *src_scan++; | 979 *dest_scan++ = *src_scan++; |
| 963 *dest_scan++ = *src_scan++; | 980 *dest_scan++ = *src_scan++; |
| 964 *dest_alpha_scan++ = 0xff; | 981 *dest_alpha_scan++ = 0xff; |
| 965 src_scan += src_gap; | 982 src_scan += src_gap; |
| 966 continue; | 983 continue; |
| 967 } | 984 } |
| 968 *dest_alpha_scan++ = 0xff; | 985 *dest_alpha_scan++ = 0xff; |
| 969 if (bNonseparableBlend) { | 986 if (bNonseparableBlend) { |
| 970 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 987 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 971 } | 988 } |
| 972 for (int color = 0; color < 3; color++) { | 989 for (int color = 0; color < 3; color++) { |
| 973 int src_color = *src_scan; | 990 int src_color = *src_scan; |
| 974 int blended = bNonseparableBlend | 991 int blended = bNonseparableBlend |
| 975 ? blended_colors[color] | 992 ? blended_colors[color] |
| 976 : _BLEND(blend_type, *dest_scan, src_color); | 993 : Blend(blend_type, *dest_scan, src_color); |
| 977 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 994 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 978 dest_scan++; | 995 dest_scan++; |
| 979 src_scan++; | 996 src_scan++; |
| 980 } | 997 } |
| 981 src_scan += src_gap; | 998 src_scan += src_gap; |
| 982 } | 999 } |
| 983 } else { | 1000 } else { |
| 984 for (int col = 0; col < width; col++) { | 1001 for (int col = 0; col < width; col++) { |
| 985 uint8_t back_alpha = dest_scan[3]; | 1002 uint8_t back_alpha = dest_scan[3]; |
| 986 if (back_alpha == 0) { | 1003 if (back_alpha == 0) { |
| 987 if (src_Bpp == 4) { | 1004 if (src_Bpp == 4) { |
| 988 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 1005 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
| 989 } else { | 1006 } else { |
| 990 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], | 1007 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], |
| 991 src_scan[0])); | 1008 src_scan[0])); |
| 992 } | 1009 } |
| 993 dest_scan += 4; | 1010 dest_scan += 4; |
| 994 src_scan += src_Bpp; | 1011 src_scan += src_Bpp; |
| 995 continue; | 1012 continue; |
| 996 } | 1013 } |
| 997 dest_scan[3] = 0xff; | 1014 dest_scan[3] = 0xff; |
| 998 if (bNonseparableBlend) { | 1015 if (bNonseparableBlend) { |
| 999 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1016 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1000 } | 1017 } |
| 1001 for (int color = 0; color < 3; color++) { | 1018 for (int color = 0; color < 3; color++) { |
| 1002 int src_color = *src_scan; | 1019 int src_color = *src_scan; |
| 1003 int blended = bNonseparableBlend | 1020 int blended = bNonseparableBlend |
| 1004 ? blended_colors[color] | 1021 ? blended_colors[color] |
| 1005 : _BLEND(blend_type, *dest_scan, src_color); | 1022 : Blend(blend_type, *dest_scan, src_color); |
| 1006 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 1023 *dest_scan = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 1007 dest_scan++; | 1024 dest_scan++; |
| 1008 src_scan++; | 1025 src_scan++; |
| 1009 } | 1026 } |
| 1010 dest_scan++; | 1027 dest_scan++; |
| 1011 src_scan += src_gap; | 1028 src_scan += src_gap; |
| 1012 } | 1029 } |
| 1013 } | 1030 } |
| 1014 } | 1031 } |
| 1015 inline void _CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, | 1032 |
| 1016 const uint8_t* src_scan, | 1033 void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, |
| 1017 int width, | 1034 const uint8_t* src_scan, |
| 1018 int blend_type, | 1035 int width, |
| 1019 int src_Bpp, | 1036 int blend_type, |
| 1020 const uint8_t* clip_scan, | 1037 int src_Bpp, |
| 1021 uint8_t* dest_alpha_scan) { | 1038 const uint8_t* clip_scan, |
| 1039 uint8_t* dest_alpha_scan) { |
| 1022 int blended_colors[3]; | 1040 int blended_colors[3]; |
| 1023 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1041 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1024 int src_gap = src_Bpp - 3; | 1042 int src_gap = src_Bpp - 3; |
| 1025 if (dest_alpha_scan) { | 1043 if (dest_alpha_scan) { |
| 1026 for (int col = 0; col < width; col++) { | 1044 for (int col = 0; col < width; col++) { |
| 1027 int src_alpha = *clip_scan++; | 1045 int src_alpha = *clip_scan++; |
| 1028 uint8_t back_alpha = *dest_alpha_scan; | 1046 uint8_t back_alpha = *dest_alpha_scan; |
| 1029 if (back_alpha == 0) { | 1047 if (back_alpha == 0) { |
| 1030 *dest_scan++ = *src_scan++; | 1048 *dest_scan++ = *src_scan++; |
| 1031 *dest_scan++ = *src_scan++; | 1049 *dest_scan++ = *src_scan++; |
| 1032 *dest_scan++ = *src_scan++; | 1050 *dest_scan++ = *src_scan++; |
| 1033 src_scan += src_gap; | 1051 src_scan += src_gap; |
| 1034 dest_alpha_scan++; | 1052 dest_alpha_scan++; |
| 1035 continue; | 1053 continue; |
| 1036 } | 1054 } |
| 1037 if (src_alpha == 0) { | 1055 if (src_alpha == 0) { |
| 1038 dest_scan += 3; | 1056 dest_scan += 3; |
| 1039 dest_alpha_scan++; | 1057 dest_alpha_scan++; |
| 1040 src_scan += src_Bpp; | 1058 src_scan += src_Bpp; |
| 1041 continue; | 1059 continue; |
| 1042 } | 1060 } |
| 1043 uint8_t dest_alpha = | 1061 uint8_t dest_alpha = |
| 1044 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 1062 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 1045 *dest_alpha_scan++ = dest_alpha; | 1063 *dest_alpha_scan++ = dest_alpha; |
| 1046 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1064 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 1047 if (bNonseparableBlend) { | 1065 if (bNonseparableBlend) { |
| 1048 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1066 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1049 } | 1067 } |
| 1050 for (int color = 0; color < 3; color++) { | 1068 for (int color = 0; color < 3; color++) { |
| 1051 int src_color = *src_scan; | 1069 int src_color = *src_scan; |
| 1052 int blended = bNonseparableBlend | 1070 int blended = bNonseparableBlend |
| 1053 ? blended_colors[color] | 1071 ? blended_colors[color] |
| 1054 : _BLEND(blend_type, *dest_scan, src_color); | 1072 : Blend(blend_type, *dest_scan, src_color); |
| 1055 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 1073 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 1056 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 1074 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 1057 dest_scan++; | 1075 dest_scan++; |
| 1058 src_scan++; | 1076 src_scan++; |
| 1059 } | 1077 } |
| 1060 src_scan += src_gap; | 1078 src_scan += src_gap; |
| 1061 } | 1079 } |
| 1062 } else { | 1080 } else { |
| 1063 for (int col = 0; col < width; col++) { | 1081 for (int col = 0; col < width; col++) { |
| 1064 int src_alpha = *clip_scan++; | 1082 int src_alpha = *clip_scan++; |
| 1065 uint8_t back_alpha = dest_scan[3]; | 1083 uint8_t back_alpha = dest_scan[3]; |
| 1066 if (back_alpha == 0) { | 1084 if (back_alpha == 0) { |
| 1067 *dest_scan++ = *src_scan++; | 1085 *dest_scan++ = *src_scan++; |
| 1068 *dest_scan++ = *src_scan++; | 1086 *dest_scan++ = *src_scan++; |
| 1069 *dest_scan++ = *src_scan++; | 1087 *dest_scan++ = *src_scan++; |
| 1070 src_scan += src_gap; | 1088 src_scan += src_gap; |
| 1071 dest_scan++; | 1089 dest_scan++; |
| 1072 continue; | 1090 continue; |
| 1073 } | 1091 } |
| 1074 if (src_alpha == 0) { | 1092 if (src_alpha == 0) { |
| 1075 dest_scan += 4; | 1093 dest_scan += 4; |
| 1076 src_scan += src_Bpp; | 1094 src_scan += src_Bpp; |
| 1077 continue; | 1095 continue; |
| 1078 } | 1096 } |
| 1079 uint8_t dest_alpha = | 1097 uint8_t dest_alpha = |
| 1080 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 1098 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 1081 dest_scan[3] = dest_alpha; | 1099 dest_scan[3] = dest_alpha; |
| 1082 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1100 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 1083 if (bNonseparableBlend) { | 1101 if (bNonseparableBlend) { |
| 1084 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1102 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1085 } | 1103 } |
| 1086 for (int color = 0; color < 3; color++) { | 1104 for (int color = 0; color < 3; color++) { |
| 1087 int src_color = *src_scan; | 1105 int src_color = *src_scan; |
| 1088 int blended = bNonseparableBlend | 1106 int blended = bNonseparableBlend |
| 1089 ? blended_colors[color] | 1107 ? blended_colors[color] |
| 1090 : _BLEND(blend_type, *dest_scan, src_color); | 1108 : Blend(blend_type, *dest_scan, src_color); |
| 1091 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 1109 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 1092 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 1110 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 1093 dest_scan++; | 1111 dest_scan++; |
| 1094 src_scan++; | 1112 src_scan++; |
| 1095 } | 1113 } |
| 1096 dest_scan++; | 1114 dest_scan++; |
| 1097 src_scan += src_gap; | 1115 src_scan += src_gap; |
| 1098 } | 1116 } |
| 1099 } | 1117 } |
| 1100 } | 1118 } |
| 1101 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan, | 1119 |
| 1102 const uint8_t* src_scan, | 1120 void CompositeRow_Rgb2Argb_NoBlend_Clip(uint8_t* dest_scan, |
| 1103 int width, | 1121 const uint8_t* src_scan, |
| 1104 int src_Bpp, | 1122 int width, |
| 1105 const uint8_t* clip_scan, | 1123 int src_Bpp, |
| 1106 uint8_t* dest_alpha_scan) { | 1124 const uint8_t* clip_scan, |
| 1125 uint8_t* dest_alpha_scan) { |
| 1107 int src_gap = src_Bpp - 3; | 1126 int src_gap = src_Bpp - 3; |
| 1108 if (dest_alpha_scan) { | 1127 if (dest_alpha_scan) { |
| 1109 for (int col = 0; col < width; col++) { | 1128 for (int col = 0; col < width; col++) { |
| 1110 int src_alpha = clip_scan[col]; | 1129 int src_alpha = clip_scan[col]; |
| 1111 if (src_alpha == 255) { | 1130 if (src_alpha == 255) { |
| 1112 *dest_scan++ = *src_scan++; | 1131 *dest_scan++ = *src_scan++; |
| 1113 *dest_scan++ = *src_scan++; | 1132 *dest_scan++ = *src_scan++; |
| 1114 *dest_scan++ = *src_scan++; | 1133 *dest_scan++ = *src_scan++; |
| 1115 *dest_alpha_scan++ = 255; | 1134 *dest_alpha_scan++ = 255; |
| 1116 src_scan += src_gap; | 1135 src_scan += src_gap; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 for (int color = 0; color < 3; color++) { | 1177 for (int color = 0; color < 3; color++) { |
| 1159 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); | 1178 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, alpha_ratio); |
| 1160 dest_scan++; | 1179 dest_scan++; |
| 1161 src_scan++; | 1180 src_scan++; |
| 1162 } | 1181 } |
| 1163 dest_scan++; | 1182 dest_scan++; |
| 1164 src_scan += src_gap; | 1183 src_scan += src_gap; |
| 1165 } | 1184 } |
| 1166 } | 1185 } |
| 1167 } | 1186 } |
| 1168 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, | 1187 |
| 1169 const uint8_t* src_scan, | 1188 void CompositeRow_Rgb2Argb_NoBlend_NoClip(uint8_t* dest_scan, |
| 1170 int width, | 1189 const uint8_t* src_scan, |
| 1171 int src_Bpp, | 1190 int width, |
| 1172 uint8_t* dest_alpha_scan) { | 1191 int src_Bpp, |
| 1192 uint8_t* dest_alpha_scan) { |
| 1173 if (dest_alpha_scan) { | 1193 if (dest_alpha_scan) { |
| 1174 int src_gap = src_Bpp - 3; | 1194 int src_gap = src_Bpp - 3; |
| 1175 for (int col = 0; col < width; col++) { | 1195 for (int col = 0; col < width; col++) { |
| 1176 *dest_scan++ = *src_scan++; | 1196 *dest_scan++ = *src_scan++; |
| 1177 *dest_scan++ = *src_scan++; | 1197 *dest_scan++ = *src_scan++; |
| 1178 *dest_scan++ = *src_scan++; | 1198 *dest_scan++ = *src_scan++; |
| 1179 *dest_alpha_scan++ = 0xff; | 1199 *dest_alpha_scan++ = 0xff; |
| 1180 src_scan += src_gap; | 1200 src_scan += src_gap; |
| 1181 } | 1201 } |
| 1182 } else { | 1202 } else { |
| 1183 for (int col = 0; col < width; col++) { | 1203 for (int col = 0; col < width; col++) { |
| 1184 if (src_Bpp == 4) { | 1204 if (src_Bpp == 4) { |
| 1185 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 1205 FXARGB_SETDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
| 1186 } else { | 1206 } else { |
| 1187 FXARGB_SETDIB(dest_scan, | 1207 FXARGB_SETDIB(dest_scan, |
| 1188 FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); | 1208 FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); |
| 1189 } | 1209 } |
| 1190 dest_scan += 4; | 1210 dest_scan += 4; |
| 1191 src_scan += src_Bpp; | 1211 src_scan += src_Bpp; |
| 1192 } | 1212 } |
| 1193 } | 1213 } |
| 1194 } | 1214 } |
| 1195 inline void _CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, | 1215 |
| 1196 const uint8_t* src_scan, | 1216 void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, |
| 1197 int width, | 1217 const uint8_t* src_scan, |
| 1198 int blend_type, | 1218 int width, |
| 1199 int dest_Bpp, | 1219 int blend_type, |
| 1200 const uint8_t* clip_scan, | 1220 int dest_Bpp, |
| 1201 const uint8_t* src_alpha_scan) { | 1221 const uint8_t* clip_scan, |
| 1222 const uint8_t* src_alpha_scan) { |
| 1202 int blended_colors[3]; | 1223 int blended_colors[3]; |
| 1203 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1224 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1204 int dest_gap = dest_Bpp - 3; | 1225 int dest_gap = dest_Bpp - 3; |
| 1205 if (src_alpha_scan) { | 1226 if (src_alpha_scan) { |
| 1206 for (int col = 0; col < width; col++) { | 1227 for (int col = 0; col < width; col++) { |
| 1207 uint8_t src_alpha; | 1228 uint8_t src_alpha; |
| 1208 if (clip_scan) { | 1229 if (clip_scan) { |
| 1209 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; | 1230 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; |
| 1210 } else { | 1231 } else { |
| 1211 src_alpha = *src_alpha_scan++; | 1232 src_alpha = *src_alpha_scan++; |
| 1212 } | 1233 } |
| 1213 if (src_alpha == 0) { | 1234 if (src_alpha == 0) { |
| 1214 dest_scan += dest_Bpp; | 1235 dest_scan += dest_Bpp; |
| 1215 src_scan += 3; | 1236 src_scan += 3; |
| 1216 continue; | 1237 continue; |
| 1217 } | 1238 } |
| 1218 if (bNonseparableBlend) { | 1239 if (bNonseparableBlend) { |
| 1219 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1240 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1220 } | 1241 } |
| 1221 for (int color = 0; color < 3; color++) { | 1242 for (int color = 0; color < 3; color++) { |
| 1222 int back_color = *dest_scan; | 1243 int back_color = *dest_scan; |
| 1223 int blended = bNonseparableBlend | 1244 int blended = bNonseparableBlend |
| 1224 ? blended_colors[color] | 1245 ? blended_colors[color] |
| 1225 : _BLEND(blend_type, back_color, *src_scan); | 1246 : Blend(blend_type, back_color, *src_scan); |
| 1226 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1247 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 1227 dest_scan++; | 1248 dest_scan++; |
| 1228 src_scan++; | 1249 src_scan++; |
| 1229 } | 1250 } |
| 1230 dest_scan += dest_gap; | 1251 dest_scan += dest_gap; |
| 1231 } | 1252 } |
| 1232 } else { | 1253 } else { |
| 1233 for (int col = 0; col < width; col++) { | 1254 for (int col = 0; col < width; col++) { |
| 1234 uint8_t src_alpha; | 1255 uint8_t src_alpha; |
| 1235 if (clip_scan) { | 1256 if (clip_scan) { |
| 1236 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1257 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 1237 } else { | 1258 } else { |
| 1238 src_alpha = src_scan[3]; | 1259 src_alpha = src_scan[3]; |
| 1239 } | 1260 } |
| 1240 if (src_alpha == 0) { | 1261 if (src_alpha == 0) { |
| 1241 dest_scan += dest_Bpp; | 1262 dest_scan += dest_Bpp; |
| 1242 src_scan += 4; | 1263 src_scan += 4; |
| 1243 continue; | 1264 continue; |
| 1244 } | 1265 } |
| 1245 if (bNonseparableBlend) { | 1266 if (bNonseparableBlend) { |
| 1246 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1267 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1247 } | 1268 } |
| 1248 for (int color = 0; color < 3; color++) { | 1269 for (int color = 0; color < 3; color++) { |
| 1249 int back_color = *dest_scan; | 1270 int back_color = *dest_scan; |
| 1250 int blended = bNonseparableBlend | 1271 int blended = bNonseparableBlend |
| 1251 ? blended_colors[color] | 1272 ? blended_colors[color] |
| 1252 : _BLEND(blend_type, back_color, *src_scan); | 1273 : Blend(blend_type, back_color, *src_scan); |
| 1253 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1274 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 1254 dest_scan++; | 1275 dest_scan++; |
| 1255 src_scan++; | 1276 src_scan++; |
| 1256 } | 1277 } |
| 1257 dest_scan += dest_gap; | 1278 dest_scan += dest_gap; |
| 1258 src_scan++; | 1279 src_scan++; |
| 1259 } | 1280 } |
| 1260 } | 1281 } |
| 1261 } | 1282 } |
| 1262 inline void _CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, | 1283 |
| 1263 const uint8_t* src_scan, | 1284 void CompositeRow_Argb2Rgb_NoBlend(uint8_t* dest_scan, |
| 1264 int width, | 1285 const uint8_t* src_scan, |
| 1265 int dest_Bpp, | 1286 int width, |
| 1266 const uint8_t* clip_scan, | 1287 int dest_Bpp, |
| 1267 const uint8_t* src_alpha_scan) { | 1288 const uint8_t* clip_scan, |
| 1289 const uint8_t* src_alpha_scan) { |
| 1268 int dest_gap = dest_Bpp - 3; | 1290 int dest_gap = dest_Bpp - 3; |
| 1269 if (src_alpha_scan) { | 1291 if (src_alpha_scan) { |
| 1270 for (int col = 0; col < width; col++) { | 1292 for (int col = 0; col < width; col++) { |
| 1271 uint8_t src_alpha; | 1293 uint8_t src_alpha; |
| 1272 if (clip_scan) { | 1294 if (clip_scan) { |
| 1273 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; | 1295 src_alpha = (*src_alpha_scan++) * (*clip_scan++) / 255; |
| 1274 } else { | 1296 } else { |
| 1275 src_alpha = *src_alpha_scan++; | 1297 src_alpha = *src_alpha_scan++; |
| 1276 } | 1298 } |
| 1277 if (src_alpha == 255) { | 1299 if (src_alpha == 255) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 for (int color = 0; color < 3; color++) { | 1339 for (int color = 0; color < 3; color++) { |
| 1318 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1340 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
| 1319 dest_scan++; | 1341 dest_scan++; |
| 1320 src_scan++; | 1342 src_scan++; |
| 1321 } | 1343 } |
| 1322 dest_scan += dest_gap; | 1344 dest_scan += dest_gap; |
| 1323 src_scan++; | 1345 src_scan++; |
| 1324 } | 1346 } |
| 1325 } | 1347 } |
| 1326 } | 1348 } |
| 1327 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, | 1349 |
| 1328 const uint8_t* src_scan, | 1350 void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, |
| 1329 int width, | 1351 const uint8_t* src_scan, |
| 1330 int blend_type, | 1352 int width, |
| 1331 int dest_Bpp, | 1353 int blend_type, |
| 1332 int src_Bpp) { | 1354 int dest_Bpp, |
| 1355 int src_Bpp) { |
| 1333 int blended_colors[3]; | 1356 int blended_colors[3]; |
| 1334 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1357 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1335 int dest_gap = dest_Bpp - 3; | 1358 int dest_gap = dest_Bpp - 3; |
| 1336 int src_gap = src_Bpp - 3; | 1359 int src_gap = src_Bpp - 3; |
| 1337 for (int col = 0; col < width; col++) { | 1360 for (int col = 0; col < width; col++) { |
| 1338 if (bNonseparableBlend) { | 1361 if (bNonseparableBlend) { |
| 1339 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1362 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1340 } | 1363 } |
| 1341 for (int color = 0; color < 3; color++) { | 1364 for (int color = 0; color < 3; color++) { |
| 1342 int back_color = *dest_scan; | 1365 int back_color = *dest_scan; |
| 1343 int src_color = *src_scan; | 1366 int src_color = *src_scan; |
| 1344 int blended = bNonseparableBlend | 1367 int blended = bNonseparableBlend |
| 1345 ? blended_colors[color] | 1368 ? blended_colors[color] |
| 1346 : _BLEND(blend_type, back_color, src_color); | 1369 : Blend(blend_type, back_color, src_color); |
| 1347 *dest_scan = blended; | 1370 *dest_scan = blended; |
| 1348 dest_scan++; | 1371 dest_scan++; |
| 1349 src_scan++; | 1372 src_scan++; |
| 1350 } | 1373 } |
| 1351 dest_scan += dest_gap; | 1374 dest_scan += dest_gap; |
| 1352 src_scan += src_gap; | 1375 src_scan += src_gap; |
| 1353 } | 1376 } |
| 1354 } | 1377 } |
| 1355 inline void _CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, | 1378 |
| 1356 const uint8_t* src_scan, | 1379 void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, |
| 1357 int width, | 1380 const uint8_t* src_scan, |
| 1358 int blend_type, | 1381 int width, |
| 1359 int dest_Bpp, | 1382 int blend_type, |
| 1360 int src_Bpp, | 1383 int dest_Bpp, |
| 1361 const uint8_t* clip_scan) { | 1384 int src_Bpp, |
| 1385 const uint8_t* clip_scan) { |
| 1362 int blended_colors[3]; | 1386 int blended_colors[3]; |
| 1363 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1387 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1364 int dest_gap = dest_Bpp - 3; | 1388 int dest_gap = dest_Bpp - 3; |
| 1365 int src_gap = src_Bpp - 3; | 1389 int src_gap = src_Bpp - 3; |
| 1366 for (int col = 0; col < width; col++) { | 1390 for (int col = 0; col < width; col++) { |
| 1367 uint8_t src_alpha = *clip_scan++; | 1391 uint8_t src_alpha = *clip_scan++; |
| 1368 if (src_alpha == 0) { | 1392 if (src_alpha == 0) { |
| 1369 dest_scan += dest_Bpp; | 1393 dest_scan += dest_Bpp; |
| 1370 src_scan += src_Bpp; | 1394 src_scan += src_Bpp; |
| 1371 continue; | 1395 continue; |
| 1372 } | 1396 } |
| 1373 if (bNonseparableBlend) { | 1397 if (bNonseparableBlend) { |
| 1374 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 1398 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 1375 } | 1399 } |
| 1376 for (int color = 0; color < 3; color++) { | 1400 for (int color = 0; color < 3; color++) { |
| 1377 int src_color = *src_scan; | 1401 int src_color = *src_scan; |
| 1378 int back_color = *dest_scan; | 1402 int back_color = *dest_scan; |
| 1379 int blended = bNonseparableBlend | 1403 int blended = bNonseparableBlend |
| 1380 ? blended_colors[color] | 1404 ? blended_colors[color] |
| 1381 : _BLEND(blend_type, back_color, src_color); | 1405 : Blend(blend_type, back_color, src_color); |
| 1382 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1406 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 1383 dest_scan++; | 1407 dest_scan++; |
| 1384 src_scan++; | 1408 src_scan++; |
| 1385 } | 1409 } |
| 1386 dest_scan += dest_gap; | 1410 dest_scan += dest_gap; |
| 1387 src_scan += src_gap; | 1411 src_scan += src_gap; |
| 1388 } | 1412 } |
| 1389 } | 1413 } |
| 1390 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, | 1414 |
| 1391 const uint8_t* src_scan, | 1415 void CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, |
| 1392 int width, | 1416 const uint8_t* src_scan, |
| 1393 int dest_Bpp, | 1417 int width, |
| 1394 int src_Bpp) { | 1418 int dest_Bpp, |
| 1419 int src_Bpp) { |
| 1395 if (dest_Bpp == src_Bpp) { | 1420 if (dest_Bpp == src_Bpp) { |
| 1396 FXSYS_memcpy(dest_scan, src_scan, width * dest_Bpp); | 1421 FXSYS_memcpy(dest_scan, src_scan, width * dest_Bpp); |
| 1397 return; | 1422 return; |
| 1398 } | 1423 } |
| 1399 for (int col = 0; col < width; col++) { | 1424 for (int col = 0; col < width; col++) { |
| 1400 dest_scan[0] = src_scan[0]; | 1425 dest_scan[0] = src_scan[0]; |
| 1401 dest_scan[1] = src_scan[1]; | 1426 dest_scan[1] = src_scan[1]; |
| 1402 dest_scan[2] = src_scan[2]; | 1427 dest_scan[2] = src_scan[2]; |
| 1403 dest_scan += dest_Bpp; | 1428 dest_scan += dest_Bpp; |
| 1404 src_scan += src_Bpp; | 1429 src_scan += src_Bpp; |
| 1405 } | 1430 } |
| 1406 } | 1431 } |
| 1407 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan, | 1432 |
| 1408 const uint8_t* src_scan, | 1433 void CompositeRow_Rgb2Rgb_NoBlend_Clip(uint8_t* dest_scan, |
| 1409 int width, | 1434 const uint8_t* src_scan, |
| 1410 int dest_Bpp, | 1435 int width, |
| 1411 int src_Bpp, | 1436 int dest_Bpp, |
| 1412 const uint8_t* clip_scan) { | 1437 int src_Bpp, |
| 1438 const uint8_t* clip_scan) { |
| 1413 for (int col = 0; col < width; col++) { | 1439 for (int col = 0; col < width; col++) { |
| 1414 int src_alpha = clip_scan[col]; | 1440 int src_alpha = clip_scan[col]; |
| 1415 if (src_alpha == 255) { | 1441 if (src_alpha == 255) { |
| 1416 dest_scan[0] = src_scan[0]; | 1442 dest_scan[0] = src_scan[0]; |
| 1417 dest_scan[1] = src_scan[1]; | 1443 dest_scan[1] = src_scan[1]; |
| 1418 dest_scan[2] = src_scan[2]; | 1444 dest_scan[2] = src_scan[2]; |
| 1419 } else if (src_alpha) { | 1445 } else if (src_alpha) { |
| 1420 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1446 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
| 1421 dest_scan++; | 1447 dest_scan++; |
| 1422 src_scan++; | 1448 src_scan++; |
| 1423 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1449 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
| 1424 dest_scan++; | 1450 dest_scan++; |
| 1425 src_scan++; | 1451 src_scan++; |
| 1426 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); | 1452 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_scan, src_alpha); |
| 1427 dest_scan += dest_Bpp - 2; | 1453 dest_scan += dest_Bpp - 2; |
| 1428 src_scan += src_Bpp - 2; | 1454 src_scan += src_Bpp - 2; |
| 1429 continue; | 1455 continue; |
| 1430 } | 1456 } |
| 1431 dest_scan += dest_Bpp; | 1457 dest_scan += dest_Bpp; |
| 1432 src_scan += src_Bpp; | 1458 src_scan += src_Bpp; |
| 1433 } | 1459 } |
| 1434 } | 1460 } |
| 1435 void _CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, | 1461 |
| 1436 const uint8_t* src_scan, | 1462 void CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, |
| 1437 int pixel_count, | 1463 const uint8_t* src_scan, |
| 1438 int blend_type, | 1464 int pixel_count, |
| 1439 const uint8_t* clip_scan, | 1465 int blend_type, |
| 1440 uint8_t* dest_alpha_scan, | 1466 const uint8_t* clip_scan, |
| 1441 const uint8_t* src_alpha_scan, | 1467 uint8_t* dest_alpha_scan, |
| 1442 uint8_t* src_cache_scan, | 1468 const uint8_t* src_alpha_scan, |
| 1443 void* pIccTransform) { | 1469 uint8_t* src_cache_scan, |
| 1470 void* pIccTransform) { |
| 1444 uint8_t* dp = src_cache_scan; | 1471 uint8_t* dp = src_cache_scan; |
| 1445 CCodec_IccModule* pIccModule = | 1472 CCodec_IccModule* pIccModule = |
| 1446 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1473 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1447 if (src_alpha_scan) { | 1474 if (src_alpha_scan) { |
| 1448 if (dest_alpha_scan) { | 1475 if (dest_alpha_scan) { |
| 1449 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, pixel_count); | 1476 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, pixel_count); |
| 1450 } else { | 1477 } else { |
| 1451 for (int col = 0; col < pixel_count; col++) { | 1478 for (int col = 0; col < pixel_count; col++) { |
| 1452 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1479 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1453 dp[3] = *src_alpha_scan++; | 1480 dp[3] = *src_alpha_scan++; |
| 1454 src_scan += 3; | 1481 src_scan += 3; |
| 1455 dp += 4; | 1482 dp += 4; |
| 1456 } | 1483 } |
| 1457 src_alpha_scan = NULL; | 1484 src_alpha_scan = nullptr; |
| 1458 } | 1485 } |
| 1459 } else { | 1486 } else { |
| 1460 if (dest_alpha_scan) { | 1487 if (dest_alpha_scan) { |
| 1461 int blended_colors[3]; | 1488 int blended_colors[3]; |
| 1462 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1489 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1463 for (int col = 0; col < pixel_count; col++) { | 1490 for (int col = 0; col < pixel_count; col++) { |
| 1464 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1491 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1465 1); | 1492 1); |
| 1466 uint8_t back_alpha = *dest_alpha_scan; | 1493 uint8_t back_alpha = *dest_alpha_scan; |
| 1467 if (back_alpha == 0) { | 1494 if (back_alpha == 0) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1492 dest_scan += 3; | 1519 dest_scan += 3; |
| 1493 src_cache_scan += 3; | 1520 src_cache_scan += 3; |
| 1494 dest_alpha_scan++; | 1521 dest_alpha_scan++; |
| 1495 continue; | 1522 continue; |
| 1496 } | 1523 } |
| 1497 uint8_t dest_alpha = | 1524 uint8_t dest_alpha = |
| 1498 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 1525 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 1499 *dest_alpha_scan++ = dest_alpha; | 1526 *dest_alpha_scan++ = dest_alpha; |
| 1500 int alpha_ratio = src_alpha * 255 / dest_alpha; | 1527 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 1501 if (bNonseparableBlend) { | 1528 if (bNonseparableBlend) { |
| 1502 _RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors); | 1529 RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors); |
| 1503 } | 1530 } |
| 1504 for (int color = 0; color < 3; color++) { | 1531 for (int color = 0; color < 3; color++) { |
| 1505 if (blend_type) { | 1532 if (blend_type) { |
| 1506 int blended = bNonseparableBlend | 1533 int blended = bNonseparableBlend |
| 1507 ? blended_colors[color] | 1534 ? blended_colors[color] |
| 1508 : _BLEND(blend_type, *dest_scan, *src_cache_scan); | 1535 : Blend(blend_type, *dest_scan, *src_cache_scan); |
| 1509 blended = FXDIB_ALPHA_MERGE(*src_cache_scan, blended, back_alpha); | 1536 blended = FXDIB_ALPHA_MERGE(*src_cache_scan, blended, back_alpha); |
| 1510 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 1537 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 1511 } else { | 1538 } else { |
| 1512 *dest_scan = | 1539 *dest_scan = |
| 1513 FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, alpha_ratio); | 1540 FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, alpha_ratio); |
| 1514 } | 1541 } |
| 1515 dest_scan++; | 1542 dest_scan++; |
| 1516 src_cache_scan++; | 1543 src_cache_scan++; |
| 1517 } | 1544 } |
| 1518 } | 1545 } |
| 1519 return; | 1546 return; |
| 1520 } | 1547 } |
| 1521 for (int col = 0; col < pixel_count; col++) { | 1548 for (int col = 0; col < pixel_count; col++) { |
| 1522 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1549 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1523 dp[3] = src_scan[3]; | 1550 dp[3] = src_scan[3]; |
| 1524 src_scan += 4; | 1551 src_scan += 4; |
| 1525 dp += 4; | 1552 dp += 4; |
| 1526 } | 1553 } |
| 1527 } | 1554 } |
| 1528 _CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type, | 1555 CompositeRow_Argb2Argb(dest_scan, src_cache_scan, pixel_count, blend_type, |
| 1529 clip_scan, dest_alpha_scan, src_alpha_scan); | 1556 clip_scan, dest_alpha_scan, src_alpha_scan); |
| 1530 } | 1557 } |
| 1531 void _CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, | 1558 |
| 1532 const uint8_t* src_scan, | 1559 void CompositeRow_Rgb2Argb_Blend_NoClip_Transform(uint8_t* dest_scan, |
| 1533 int width, | 1560 const uint8_t* src_scan, |
| 1534 int blend_type, | 1561 int width, |
| 1535 int src_Bpp, | 1562 int blend_type, |
| 1536 uint8_t* dest_alpha_scan, | 1563 int src_Bpp, |
| 1537 uint8_t* src_cache_scan, | 1564 uint8_t* dest_alpha_scan, |
| 1538 void* pIccTransform) { | 1565 uint8_t* src_cache_scan, |
| 1566 void* pIccTransform) { |
| 1539 CCodec_IccModule* pIccModule = | 1567 CCodec_IccModule* pIccModule = |
| 1540 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1568 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1541 if (src_Bpp == 3) { | 1569 if (src_Bpp == 3) { |
| 1542 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1570 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1543 width); | 1571 width); |
| 1544 } else { | 1572 } else { |
| 1545 uint8_t* dp = src_cache_scan; | 1573 uint8_t* dp = src_cache_scan; |
| 1546 for (int col = 0; col < width; col++) { | 1574 for (int col = 0; col < width; col++) { |
| 1547 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1575 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1548 src_scan += 4; | 1576 src_scan += 4; |
| 1549 dp += 3; | 1577 dp += 3; |
| 1550 } | 1578 } |
| 1551 } | 1579 } |
| 1552 _CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, | 1580 CompositeRow_Rgb2Argb_Blend_NoClip(dest_scan, src_cache_scan, width, |
| 1553 blend_type, 3, dest_alpha_scan); | 1581 blend_type, 3, dest_alpha_scan); |
| 1554 } | 1582 } |
| 1555 inline void _CompositeRow_Rgb2Argb_Blend_Clip_Transform( | 1583 |
| 1556 uint8_t* dest_scan, | 1584 void CompositeRow_Rgb2Argb_Blend_Clip_Transform(uint8_t* dest_scan, |
| 1557 const uint8_t* src_scan, | 1585 const uint8_t* src_scan, |
| 1558 int width, | 1586 int width, |
| 1559 int blend_type, | 1587 int blend_type, |
| 1560 int src_Bpp, | 1588 int src_Bpp, |
| 1561 const uint8_t* clip_scan, | 1589 const uint8_t* clip_scan, |
| 1562 uint8_t* dest_alpha_scan, | 1590 uint8_t* dest_alpha_scan, |
| 1563 uint8_t* src_cache_scan, | 1591 uint8_t* src_cache_scan, |
| 1564 void* pIccTransform) { | 1592 void* pIccTransform) { |
| 1565 CCodec_IccModule* pIccModule = | 1593 CCodec_IccModule* pIccModule = |
| 1566 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1594 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1567 if (src_Bpp == 3) { | 1595 if (src_Bpp == 3) { |
| 1568 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1596 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1569 width); | 1597 width); |
| 1570 } else { | 1598 } else { |
| 1571 uint8_t* dp = src_cache_scan; | 1599 uint8_t* dp = src_cache_scan; |
| 1572 for (int col = 0; col < width; col++) { | 1600 for (int col = 0; col < width; col++) { |
| 1573 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1601 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1574 src_scan += 4; | 1602 src_scan += 4; |
| 1575 dp += 3; | 1603 dp += 3; |
| 1576 } | 1604 } |
| 1577 } | 1605 } |
| 1578 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, | 1606 CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, |
| 1579 blend_type, 3, clip_scan, dest_alpha_scan); | 1607 3, clip_scan, dest_alpha_scan); |
| 1580 } | 1608 } |
| 1581 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform( | 1609 |
| 1582 uint8_t* dest_scan, | 1610 void CompositeRow_Rgb2Argb_NoBlend_Clip_Transform(uint8_t* dest_scan, |
| 1583 const uint8_t* src_scan, | 1611 const uint8_t* src_scan, |
| 1584 int width, | 1612 int width, |
| 1585 int src_Bpp, | 1613 int src_Bpp, |
| 1586 const uint8_t* clip_scan, | 1614 const uint8_t* clip_scan, |
| 1587 uint8_t* dest_alpha_scan, | 1615 uint8_t* dest_alpha_scan, |
| 1588 uint8_t* src_cache_scan, | 1616 uint8_t* src_cache_scan, |
| 1589 void* pIccTransform) { | 1617 void* pIccTransform) { |
| 1590 CCodec_IccModule* pIccModule = | 1618 CCodec_IccModule* pIccModule = |
| 1591 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1619 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1592 if (src_Bpp == 3) { | 1620 if (src_Bpp == 3) { |
| 1593 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1621 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1594 width); | 1622 width); |
| 1595 } else { | 1623 } else { |
| 1596 uint8_t* dp = src_cache_scan; | 1624 uint8_t* dp = src_cache_scan; |
| 1597 for (int col = 0; col < width; col++) { | 1625 for (int col = 0; col < width; col++) { |
| 1598 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1626 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1599 src_scan += 4; | 1627 src_scan += 4; |
| 1600 dp += 3; | 1628 dp += 3; |
| 1601 } | 1629 } |
| 1602 } | 1630 } |
| 1603 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, | 1631 CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_cache_scan, width, 3, |
| 1604 clip_scan, dest_alpha_scan); | 1632 clip_scan, dest_alpha_scan); |
| 1605 } | 1633 } |
| 1606 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform( | 1634 |
| 1607 uint8_t* dest_scan, | 1635 void CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform(uint8_t* dest_scan, |
| 1608 const uint8_t* src_scan, | 1636 const uint8_t* src_scan, |
| 1609 int width, | 1637 int width, |
| 1610 int src_Bpp, | 1638 int src_Bpp, |
| 1611 uint8_t* dest_alpha_scan, | 1639 uint8_t* dest_alpha_scan, |
| 1612 uint8_t* src_cache_scan, | 1640 uint8_t* src_cache_scan, |
| 1613 void* pIccTransform) { | 1641 void* pIccTransform) { |
| 1614 CCodec_IccModule* pIccModule = | 1642 CCodec_IccModule* pIccModule = |
| 1615 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1643 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1616 if (src_Bpp == 3) { | 1644 if (src_Bpp == 3) { |
| 1617 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1645 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1618 width); | 1646 width); |
| 1619 } else { | 1647 } else { |
| 1620 uint8_t* dp = src_cache_scan; | 1648 uint8_t* dp = src_cache_scan; |
| 1621 for (int col = 0; col < width; col++) { | 1649 for (int col = 0; col < width; col++) { |
| 1622 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1650 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1623 src_scan += 4; | 1651 src_scan += 4; |
| 1624 dp += 3; | 1652 dp += 3; |
| 1625 } | 1653 } |
| 1626 } | 1654 } |
| 1627 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, | 1655 CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_cache_scan, width, 3, |
| 1628 dest_alpha_scan); | 1656 dest_alpha_scan); |
| 1629 } | 1657 } |
| 1630 inline void _CompositeRow_Argb2Rgb_Blend_Transform( | 1658 |
| 1631 uint8_t* dest_scan, | 1659 void CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, |
| 1632 const uint8_t* src_scan, | 1660 const uint8_t* src_scan, |
| 1633 int width, | 1661 int width, |
| 1634 int blend_type, | 1662 int blend_type, |
| 1635 int dest_Bpp, | 1663 int dest_Bpp, |
| 1636 const uint8_t* clip_scan, | 1664 const uint8_t* clip_scan, |
| 1637 const uint8_t* src_alpha_scan, | 1665 const uint8_t* src_alpha_scan, |
| 1638 uint8_t* src_cache_scan, | 1666 uint8_t* src_cache_scan, |
| 1639 void* pIccTransform) { | 1667 void* pIccTransform) { |
| 1640 CCodec_IccModule* pIccModule = | 1668 CCodec_IccModule* pIccModule = |
| 1641 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1669 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1642 if (src_alpha_scan) { | 1670 if (src_alpha_scan) { |
| 1643 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1671 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1644 width); | 1672 width); |
| 1645 } else { | 1673 } else { |
| 1646 int blended_colors[3]; | 1674 int blended_colors[3]; |
| 1647 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1675 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1648 int dest_gap = dest_Bpp - 3; | 1676 int dest_gap = dest_Bpp - 3; |
| 1649 for (int col = 0; col < width; col++) { | 1677 for (int col = 0; col < width; col++) { |
| 1650 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); | 1678 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); |
| 1651 uint8_t src_alpha; | 1679 uint8_t src_alpha; |
| 1652 if (clip_scan) { | 1680 if (clip_scan) { |
| 1653 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 1681 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 1654 } else { | 1682 } else { |
| 1655 src_alpha = src_scan[3]; | 1683 src_alpha = src_scan[3]; |
| 1656 } | 1684 } |
| 1657 src_scan += 4; | 1685 src_scan += 4; |
| 1658 if (src_alpha == 0) { | 1686 if (src_alpha == 0) { |
| 1659 dest_scan += dest_Bpp; | 1687 dest_scan += dest_Bpp; |
| 1660 src_cache_scan += 3; | 1688 src_cache_scan += 3; |
| 1661 continue; | 1689 continue; |
| 1662 } | 1690 } |
| 1663 if (bNonseparableBlend) { | 1691 if (bNonseparableBlend) { |
| 1664 _RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors); | 1692 RGB_Blend(blend_type, src_cache_scan, dest_scan, blended_colors); |
| 1665 } | 1693 } |
| 1666 for (int color = 0; color < 3; color++) { | 1694 for (int color = 0; color < 3; color++) { |
| 1667 int back_color = *dest_scan; | 1695 int back_color = *dest_scan; |
| 1668 int blended = bNonseparableBlend | 1696 int blended = bNonseparableBlend |
| 1669 ? blended_colors[color] | 1697 ? blended_colors[color] |
| 1670 : _BLEND(blend_type, back_color, *src_cache_scan); | 1698 : Blend(blend_type, back_color, *src_cache_scan); |
| 1671 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); | 1699 *dest_scan = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 1672 dest_scan++; | 1700 dest_scan++; |
| 1673 src_cache_scan++; | 1701 src_cache_scan++; |
| 1674 } | 1702 } |
| 1675 dest_scan += dest_gap; | 1703 dest_scan += dest_gap; |
| 1676 } | 1704 } |
| 1677 return; | 1705 return; |
| 1678 } | 1706 } |
| 1679 _CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, | 1707 CompositeRow_Argb2Rgb_Blend(dest_scan, src_cache_scan, width, blend_type, |
| 1680 dest_Bpp, clip_scan, src_alpha_scan); | 1708 dest_Bpp, clip_scan, src_alpha_scan); |
| 1681 } | 1709 } |
| 1682 inline void _CompositeRow_Argb2Rgb_NoBlend_Transform( | 1710 |
| 1683 uint8_t* dest_scan, | 1711 void CompositeRow_Argb2Rgb_NoBlend_Transform(uint8_t* dest_scan, |
| 1684 const uint8_t* src_scan, | 1712 const uint8_t* src_scan, |
| 1685 int width, | 1713 int width, |
| 1686 int dest_Bpp, | 1714 int dest_Bpp, |
| 1687 const uint8_t* clip_scan, | 1715 const uint8_t* clip_scan, |
| 1688 const uint8_t* src_alpha_scan, | 1716 const uint8_t* src_alpha_scan, |
| 1689 uint8_t* src_cache_scan, | 1717 uint8_t* src_cache_scan, |
| 1690 void* pIccTransform) { | 1718 void* pIccTransform) { |
| 1691 CCodec_IccModule* pIccModule = | 1719 CCodec_IccModule* pIccModule = |
| 1692 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1720 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1693 if (src_alpha_scan) { | 1721 if (src_alpha_scan) { |
| 1694 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1722 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1695 width); | 1723 width); |
| 1696 } else { | 1724 } else { |
| 1697 int dest_gap = dest_Bpp - 3; | 1725 int dest_gap = dest_Bpp - 3; |
| 1698 for (int col = 0; col < width; col++) { | 1726 for (int col = 0; col < width; col++) { |
| 1699 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); | 1727 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); |
| 1700 uint8_t src_alpha; | 1728 uint8_t src_alpha; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1718 } | 1746 } |
| 1719 for (int color = 0; color < 3; color++) { | 1747 for (int color = 0; color < 3; color++) { |
| 1720 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, src_alpha); | 1748 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, *src_cache_scan, src_alpha); |
| 1721 dest_scan++; | 1749 dest_scan++; |
| 1722 src_cache_scan++; | 1750 src_cache_scan++; |
| 1723 } | 1751 } |
| 1724 dest_scan += dest_gap; | 1752 dest_scan += dest_gap; |
| 1725 } | 1753 } |
| 1726 return; | 1754 return; |
| 1727 } | 1755 } |
| 1728 _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, | 1756 CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_cache_scan, width, dest_Bpp, |
| 1729 clip_scan, src_alpha_scan); | 1757 clip_scan, src_alpha_scan); |
| 1730 } | 1758 } |
| 1731 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform( | 1759 |
| 1732 uint8_t* dest_scan, | 1760 void CompositeRow_Rgb2Rgb_Blend_NoClip_Transform(uint8_t* dest_scan, |
| 1733 const uint8_t* src_scan, | 1761 const uint8_t* src_scan, |
| 1734 int width, | 1762 int width, |
| 1735 int blend_type, | 1763 int blend_type, |
| 1736 int dest_Bpp, | 1764 int dest_Bpp, |
| 1737 int src_Bpp, | 1765 int src_Bpp, |
| 1738 uint8_t* src_cache_scan, | 1766 uint8_t* src_cache_scan, |
| 1739 void* pIccTransform) { | 1767 void* pIccTransform) { |
| 1740 CCodec_IccModule* pIccModule = | 1768 CCodec_IccModule* pIccModule = |
| 1741 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1769 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1742 if (src_Bpp == 3) { | 1770 if (src_Bpp == 3) { |
| 1743 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1771 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1744 width); | 1772 width); |
| 1745 } else { | 1773 } else { |
| 1746 uint8_t* dp = src_cache_scan; | 1774 uint8_t* dp = src_cache_scan; |
| 1747 for (int col = 0; col < width; col++) { | 1775 for (int col = 0; col < width; col++) { |
| 1748 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1776 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1749 src_scan += 4; | 1777 src_scan += 4; |
| 1750 dp += 3; | 1778 dp += 3; |
| 1751 } | 1779 } |
| 1752 } | 1780 } |
| 1753 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, | 1781 CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_cache_scan, width, |
| 1754 blend_type, dest_Bpp, 3); | 1782 blend_type, dest_Bpp, 3); |
| 1755 } | 1783 } |
| 1756 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, | 1784 |
| 1757 const uint8_t* src_scan, | 1785 void CompositeRow_Rgb2Rgb_Blend_Clip_Transform(uint8_t* dest_scan, |
| 1758 int width, | 1786 const uint8_t* src_scan, |
| 1759 int blend_type, | 1787 int width, |
| 1760 int dest_Bpp, | 1788 int blend_type, |
| 1761 int src_Bpp, | 1789 int dest_Bpp, |
| 1762 const uint8_t* clip_scan, | 1790 int src_Bpp, |
| 1763 uint8_t* src_cache_scan, | 1791 const uint8_t* clip_scan, |
| 1764 void* pIccTransform) { | 1792 uint8_t* src_cache_scan, |
| 1793 void* pIccTransform) { |
| 1765 CCodec_IccModule* pIccModule = | 1794 CCodec_IccModule* pIccModule = |
| 1766 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1795 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1767 if (src_Bpp == 3) { | 1796 if (src_Bpp == 3) { |
| 1768 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1797 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1769 width); | 1798 width); |
| 1770 } else { | 1799 } else { |
| 1771 uint8_t* dp = src_cache_scan; | 1800 uint8_t* dp = src_cache_scan; |
| 1772 for (int col = 0; col < width; col++) { | 1801 for (int col = 0; col < width; col++) { |
| 1773 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1802 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1774 src_scan += 4; | 1803 src_scan += 4; |
| 1775 dp += 3; | 1804 dp += 3; |
| 1776 } | 1805 } |
| 1777 } | 1806 } |
| 1778 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, | 1807 CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_cache_scan, width, blend_type, |
| 1779 dest_Bpp, 3, clip_scan); | 1808 dest_Bpp, 3, clip_scan); |
| 1780 } | 1809 } |
| 1781 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform( | 1810 |
| 1782 uint8_t* dest_scan, | 1811 void CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform(uint8_t* dest_scan, |
| 1783 const uint8_t* src_scan, | 1812 const uint8_t* src_scan, |
| 1784 int width, | 1813 int width, |
| 1785 int dest_Bpp, | 1814 int dest_Bpp, |
| 1786 int src_Bpp, | 1815 int src_Bpp, |
| 1787 uint8_t* src_cache_scan, | 1816 uint8_t* src_cache_scan, |
| 1788 void* pIccTransform) { | 1817 void* pIccTransform) { |
| 1789 CCodec_IccModule* pIccModule = | 1818 CCodec_IccModule* pIccModule = |
| 1790 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1819 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1791 if (src_Bpp == 3) { | 1820 if (src_Bpp == 3) { |
| 1792 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1821 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1793 width); | 1822 width); |
| 1794 } else { | 1823 } else { |
| 1795 uint8_t* dp = src_cache_scan; | 1824 uint8_t* dp = src_cache_scan; |
| 1796 for (int col = 0; col < width; col++) { | 1825 for (int col = 0; col < width; col++) { |
| 1797 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1826 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1798 src_scan += 4; | 1827 src_scan += 4; |
| 1799 dp += 3; | 1828 dp += 3; |
| 1800 } | 1829 } |
| 1801 } | 1830 } |
| 1802 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, | 1831 CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_cache_scan, width, |
| 1803 dest_Bpp, 3); | 1832 dest_Bpp, 3); |
| 1804 } | 1833 } |
| 1805 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform( | 1834 |
| 1806 uint8_t* dest_scan, | 1835 void CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform(uint8_t* dest_scan, |
| 1807 const uint8_t* src_scan, | 1836 const uint8_t* src_scan, |
| 1808 int width, | 1837 int width, |
| 1809 int dest_Bpp, | 1838 int dest_Bpp, |
| 1810 int src_Bpp, | 1839 int src_Bpp, |
| 1811 const uint8_t* clip_scan, | 1840 const uint8_t* clip_scan, |
| 1812 uint8_t* src_cache_scan, | 1841 uint8_t* src_cache_scan, |
| 1813 void* pIccTransform) { | 1842 void* pIccTransform) { |
| 1814 CCodec_IccModule* pIccModule = | 1843 CCodec_IccModule* pIccModule = |
| 1815 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 1844 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 1816 if (src_Bpp == 3) { | 1845 if (src_Bpp == 3) { |
| 1817 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, | 1846 pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, |
| 1818 width); | 1847 width); |
| 1819 } else { | 1848 } else { |
| 1820 uint8_t* dp = src_cache_scan; | 1849 uint8_t* dp = src_cache_scan; |
| 1821 for (int col = 0; col < width; col++) { | 1850 for (int col = 0; col < width; col++) { |
| 1822 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); | 1851 pIccModule->TranslateScanline(pIccTransform, dp, src_scan, 1); |
| 1823 src_scan += 4; | 1852 src_scan += 4; |
| 1824 dp += 3; | 1853 dp += 3; |
| 1825 } | 1854 } |
| 1826 } | 1855 } |
| 1827 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bpp, | 1856 CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_cache_scan, width, dest_Bpp, |
| 1828 3, clip_scan); | 1857 3, clip_scan); |
| 1829 } | 1858 } |
| 1830 inline void _CompositeRow_8bppPal2Gray(uint8_t* dest_scan, | 1859 |
| 1831 const uint8_t* src_scan, | 1860 void CompositeRow_8bppPal2Gray(uint8_t* dest_scan, |
| 1832 const uint8_t* pPalette, | 1861 const uint8_t* src_scan, |
| 1833 int pixel_count, | 1862 const uint8_t* pPalette, |
| 1834 int blend_type, | 1863 int pixel_count, |
| 1835 const uint8_t* clip_scan, | 1864 int blend_type, |
| 1836 const uint8_t* src_alpha_scan) { | 1865 const uint8_t* clip_scan, |
| 1866 const uint8_t* src_alpha_scan) { |
| 1837 if (src_alpha_scan) { | 1867 if (src_alpha_scan) { |
| 1838 if (blend_type) { | 1868 if (blend_type) { |
| 1839 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1869 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1840 for (int col = 0; col < pixel_count; col++) { | 1870 for (int col = 0; col < pixel_count; col++) { |
| 1841 uint8_t gray = pPalette[*src_scan]; | 1871 uint8_t gray = pPalette[*src_scan]; |
| 1842 int src_alpha = *src_alpha_scan++; | 1872 int src_alpha = *src_alpha_scan++; |
| 1843 if (clip_scan) { | 1873 if (clip_scan) { |
| 1844 src_alpha = clip_scan[col] * src_alpha / 255; | 1874 src_alpha = clip_scan[col] * src_alpha / 255; |
| 1845 } | 1875 } |
| 1846 if (bNonseparableBlend) | 1876 if (bNonseparableBlend) |
| 1847 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 1877 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 1848 else | 1878 else |
| 1849 gray = _BLEND(blend_type, *dest_scan, gray); | 1879 gray = Blend(blend_type, *dest_scan, gray); |
| 1850 if (src_alpha) { | 1880 if (src_alpha) { |
| 1851 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); | 1881 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); |
| 1852 } else { | 1882 } else { |
| 1853 *dest_scan = gray; | 1883 *dest_scan = gray; |
| 1854 } | 1884 } |
| 1855 dest_scan++; | 1885 dest_scan++; |
| 1856 src_scan++; | 1886 src_scan++; |
| 1857 } | 1887 } |
| 1858 return; | 1888 return; |
| 1859 } | 1889 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1872 src_scan++; | 1902 src_scan++; |
| 1873 } | 1903 } |
| 1874 } else { | 1904 } else { |
| 1875 if (blend_type) { | 1905 if (blend_type) { |
| 1876 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1906 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1877 for (int col = 0; col < pixel_count; col++) { | 1907 for (int col = 0; col < pixel_count; col++) { |
| 1878 uint8_t gray = pPalette[*src_scan]; | 1908 uint8_t gray = pPalette[*src_scan]; |
| 1879 if (bNonseparableBlend) | 1909 if (bNonseparableBlend) |
| 1880 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 1910 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 1881 else | 1911 else |
| 1882 gray = _BLEND(blend_type, *dest_scan, gray); | 1912 gray = Blend(blend_type, *dest_scan, gray); |
| 1883 if (clip_scan && clip_scan[col] < 255) { | 1913 if (clip_scan && clip_scan[col] < 255) { |
| 1884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 1914 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 1885 } else { | 1915 } else { |
| 1886 *dest_scan = gray; | 1916 *dest_scan = gray; |
| 1887 } | 1917 } |
| 1888 dest_scan++; | 1918 dest_scan++; |
| 1889 src_scan++; | 1919 src_scan++; |
| 1890 } | 1920 } |
| 1891 return; | 1921 return; |
| 1892 } | 1922 } |
| 1893 for (int col = 0; col < pixel_count; col++) { | 1923 for (int col = 0; col < pixel_count; col++) { |
| 1894 uint8_t gray = pPalette[*src_scan]; | 1924 uint8_t gray = pPalette[*src_scan]; |
| 1895 if (clip_scan && clip_scan[col] < 255) { | 1925 if (clip_scan && clip_scan[col] < 255) { |
| 1896 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 1926 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 1897 } else { | 1927 } else { |
| 1898 *dest_scan = gray; | 1928 *dest_scan = gray; |
| 1899 } | 1929 } |
| 1900 dest_scan++; | 1930 dest_scan++; |
| 1901 src_scan++; | 1931 src_scan++; |
| 1902 } | 1932 } |
| 1903 } | 1933 } |
| 1904 } | 1934 } |
| 1905 inline void _CompositeRow_8bppPal2Graya(uint8_t* dest_scan, | 1935 |
| 1906 const uint8_t* src_scan, | 1936 void CompositeRow_8bppPal2Graya(uint8_t* dest_scan, |
| 1907 const uint8_t* pPalette, | 1937 const uint8_t* src_scan, |
| 1908 int pixel_count, | 1938 const uint8_t* pPalette, |
| 1909 int blend_type, | 1939 int pixel_count, |
| 1910 const uint8_t* clip_scan, | 1940 int blend_type, |
| 1911 uint8_t* dest_alpha_scan, | 1941 const uint8_t* clip_scan, |
| 1912 const uint8_t* src_alpha_scan) { | 1942 uint8_t* dest_alpha_scan, |
| 1943 const uint8_t* src_alpha_scan) { |
| 1913 if (src_alpha_scan) { | 1944 if (src_alpha_scan) { |
| 1914 if (blend_type) { | 1945 if (blend_type) { |
| 1915 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 1946 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 1916 for (int col = 0; col < pixel_count; col++) { | 1947 for (int col = 0; col < pixel_count; col++) { |
| 1917 uint8_t gray = pPalette[*src_scan]; | 1948 uint8_t gray = pPalette[*src_scan]; |
| 1918 src_scan++; | 1949 src_scan++; |
| 1919 uint8_t back_alpha = *dest_alpha_scan; | 1950 uint8_t back_alpha = *dest_alpha_scan; |
| 1920 if (back_alpha == 0) { | 1951 if (back_alpha == 0) { |
| 1921 int src_alpha = *src_alpha_scan++; | 1952 int src_alpha = *src_alpha_scan++; |
| 1922 if (clip_scan) { | 1953 if (clip_scan) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1938 dest_scan++; | 1969 dest_scan++; |
| 1939 dest_alpha_scan++; | 1970 dest_alpha_scan++; |
| 1940 continue; | 1971 continue; |
| 1941 } | 1972 } |
| 1942 *dest_alpha_scan = | 1973 *dest_alpha_scan = |
| 1943 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 1974 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 1944 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); | 1975 int alpha_ratio = src_alpha * 255 / (*dest_alpha_scan); |
| 1945 if (bNonseparableBlend) | 1976 if (bNonseparableBlend) |
| 1946 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 1977 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 1947 else | 1978 else |
| 1948 gray = _BLEND(blend_type, *dest_scan, gray); | 1979 gray = Blend(blend_type, *dest_scan, gray); |
| 1949 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 1980 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 1950 dest_alpha_scan++; | 1981 dest_alpha_scan++; |
| 1951 dest_scan++; | 1982 dest_scan++; |
| 1952 } | 1983 } |
| 1953 return; | 1984 return; |
| 1954 } | 1985 } |
| 1955 for (int col = 0; col < pixel_count; col++) { | 1986 for (int col = 0; col < pixel_count; col++) { |
| 1956 uint8_t gray = pPalette[*src_scan]; | 1987 uint8_t gray = pPalette[*src_scan]; |
| 1957 src_scan++; | 1988 src_scan++; |
| 1958 uint8_t back_alpha = *dest_alpha_scan; | 1989 uint8_t back_alpha = *dest_alpha_scan; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2002 continue; | 2033 continue; |
| 2003 } | 2034 } |
| 2004 int back_alpha = *dest_alpha_scan; | 2035 int back_alpha = *dest_alpha_scan; |
| 2005 uint8_t dest_alpha = | 2036 uint8_t dest_alpha = |
| 2006 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2037 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2007 *dest_alpha_scan++ = dest_alpha; | 2038 *dest_alpha_scan++ = dest_alpha; |
| 2008 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2039 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2009 if (bNonseparableBlend) | 2040 if (bNonseparableBlend) |
| 2010 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 2041 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 2011 else | 2042 else |
| 2012 gray = _BLEND(blend_type, *dest_scan, gray); | 2043 gray = Blend(blend_type, *dest_scan, gray); |
| 2013 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 2044 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 2014 dest_scan++; | 2045 dest_scan++; |
| 2015 } | 2046 } |
| 2016 return; | 2047 return; |
| 2017 } | 2048 } |
| 2018 for (int col = 0; col < pixel_count; col++) { | 2049 for (int col = 0; col < pixel_count; col++) { |
| 2019 uint8_t gray = pPalette[*src_scan]; | 2050 uint8_t gray = pPalette[*src_scan]; |
| 2020 src_scan++; | 2051 src_scan++; |
| 2021 if (!clip_scan || clip_scan[col] == 255) { | 2052 if (!clip_scan || clip_scan[col] == 255) { |
| 2022 *dest_scan++ = gray; | 2053 *dest_scan++ = gray; |
| 2023 *dest_alpha_scan++ = 255; | 2054 *dest_alpha_scan++ = 255; |
| 2024 continue; | 2055 continue; |
| 2025 } | 2056 } |
| 2026 int src_alpha = clip_scan[col]; | 2057 int src_alpha = clip_scan[col]; |
| 2027 if (src_alpha == 0) { | 2058 if (src_alpha == 0) { |
| 2028 dest_scan++; | 2059 dest_scan++; |
| 2029 dest_alpha_scan++; | 2060 dest_alpha_scan++; |
| 2030 continue; | 2061 continue; |
| 2031 } | 2062 } |
| 2032 int back_alpha = *dest_alpha_scan; | 2063 int back_alpha = *dest_alpha_scan; |
| 2033 uint8_t dest_alpha = | 2064 uint8_t dest_alpha = |
| 2034 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2065 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2035 *dest_alpha_scan++ = dest_alpha; | 2066 *dest_alpha_scan++ = dest_alpha; |
| 2036 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2067 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2037 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 2068 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 2038 dest_scan++; | 2069 dest_scan++; |
| 2039 } | 2070 } |
| 2040 } | 2071 } |
| 2041 } | 2072 } |
| 2042 inline void _CompositeRow_1bppPal2Gray(uint8_t* dest_scan, | 2073 |
| 2043 const uint8_t* src_scan, | 2074 void CompositeRow_1bppPal2Gray(uint8_t* dest_scan, |
| 2044 int src_left, | 2075 const uint8_t* src_scan, |
| 2045 const uint8_t* pPalette, | 2076 int src_left, |
| 2046 int pixel_count, | 2077 const uint8_t* pPalette, |
| 2047 int blend_type, | 2078 int pixel_count, |
| 2048 const uint8_t* clip_scan) { | 2079 int blend_type, |
| 2080 const uint8_t* clip_scan) { |
| 2049 int reset_gray = pPalette[0]; | 2081 int reset_gray = pPalette[0]; |
| 2050 int set_gray = pPalette[1]; | 2082 int set_gray = pPalette[1]; |
| 2051 if (blend_type) { | 2083 if (blend_type) { |
| 2052 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2084 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2053 for (int col = 0; col < pixel_count; col++) { | 2085 for (int col = 0; col < pixel_count; col++) { |
| 2054 uint8_t gray = | 2086 uint8_t gray = |
| 2055 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2087 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2056 ? set_gray | 2088 ? set_gray |
| 2057 : reset_gray; | 2089 : reset_gray; |
| 2058 if (bNonseparableBlend) | 2090 if (bNonseparableBlend) |
| 2059 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 2091 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 2060 else | 2092 else |
| 2061 gray = _BLEND(blend_type, *dest_scan, gray); | 2093 gray = Blend(blend_type, *dest_scan, gray); |
| 2062 if (clip_scan && clip_scan[col] < 255) { | 2094 if (clip_scan && clip_scan[col] < 255) { |
| 2063 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 2095 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 2064 } else { | 2096 } else { |
| 2065 *dest_scan = gray; | 2097 *dest_scan = gray; |
| 2066 } | 2098 } |
| 2067 dest_scan++; | 2099 dest_scan++; |
| 2068 } | 2100 } |
| 2069 return; | 2101 return; |
| 2070 } | 2102 } |
| 2071 for (int col = 0; col < pixel_count; col++) { | 2103 for (int col = 0; col < pixel_count; col++) { |
| 2072 uint8_t gray = | 2104 uint8_t gray = |
| 2073 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2105 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2074 ? set_gray | 2106 ? set_gray |
| 2075 : reset_gray; | 2107 : reset_gray; |
| 2076 if (clip_scan && clip_scan[col] < 255) { | 2108 if (clip_scan && clip_scan[col] < 255) { |
| 2077 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); | 2109 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, clip_scan[col]); |
| 2078 } else { | 2110 } else { |
| 2079 *dest_scan = gray; | 2111 *dest_scan = gray; |
| 2080 } | 2112 } |
| 2081 dest_scan++; | 2113 dest_scan++; |
| 2082 } | 2114 } |
| 2083 } | 2115 } |
| 2084 inline void _CompositeRow_1bppPal2Graya(uint8_t* dest_scan, | 2116 |
| 2085 const uint8_t* src_scan, | 2117 void CompositeRow_1bppPal2Graya(uint8_t* dest_scan, |
| 2086 int src_left, | 2118 const uint8_t* src_scan, |
| 2087 const uint8_t* pPalette, | 2119 int src_left, |
| 2088 int pixel_count, | 2120 const uint8_t* pPalette, |
| 2089 int blend_type, | 2121 int pixel_count, |
| 2090 const uint8_t* clip_scan, | 2122 int blend_type, |
| 2091 uint8_t* dest_alpha_scan) { | 2123 const uint8_t* clip_scan, |
| 2124 uint8_t* dest_alpha_scan) { |
| 2092 int reset_gray = pPalette[0]; | 2125 int reset_gray = pPalette[0]; |
| 2093 int set_gray = pPalette[1]; | 2126 int set_gray = pPalette[1]; |
| 2094 if (blend_type) { | 2127 if (blend_type) { |
| 2095 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2128 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 2096 for (int col = 0; col < pixel_count; col++) { | 2129 for (int col = 0; col < pixel_count; col++) { |
| 2097 uint8_t gray = | 2130 uint8_t gray = |
| 2098 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2131 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2099 ? set_gray | 2132 ? set_gray |
| 2100 : reset_gray; | 2133 : reset_gray; |
| 2101 if (!clip_scan || clip_scan[col] == 255) { | 2134 if (!clip_scan || clip_scan[col] == 255) { |
| 2102 *dest_scan++ = gray; | 2135 *dest_scan++ = gray; |
| 2103 *dest_alpha_scan++ = 255; | 2136 *dest_alpha_scan++ = 255; |
| 2104 continue; | 2137 continue; |
| 2105 } | 2138 } |
| 2106 int src_alpha = clip_scan[col]; | 2139 int src_alpha = clip_scan[col]; |
| 2107 if (src_alpha == 0) { | 2140 if (src_alpha == 0) { |
| 2108 dest_scan++; | 2141 dest_scan++; |
| 2109 dest_alpha_scan++; | 2142 dest_alpha_scan++; |
| 2110 continue; | 2143 continue; |
| 2111 } | 2144 } |
| 2112 int back_alpha = *dest_alpha_scan; | 2145 int back_alpha = *dest_alpha_scan; |
| 2113 uint8_t dest_alpha = | 2146 uint8_t dest_alpha = |
| 2114 back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2147 back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2115 *dest_alpha_scan++ = dest_alpha; | 2148 *dest_alpha_scan++ = dest_alpha; |
| 2116 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2149 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2117 if (bNonseparableBlend) | 2150 if (bNonseparableBlend) |
| 2118 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; | 2151 gray = blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan; |
| 2119 else | 2152 else |
| 2120 gray = _BLEND(blend_type, *dest_scan, gray); | 2153 gray = Blend(blend_type, *dest_scan, gray); |
| 2121 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 2154 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 2122 dest_scan++; | 2155 dest_scan++; |
| 2123 } | 2156 } |
| 2124 return; | 2157 return; |
| 2125 } | 2158 } |
| 2126 for (int col = 0; col < pixel_count; col++) { | 2159 for (int col = 0; col < pixel_count; col++) { |
| 2127 uint8_t gray = | 2160 uint8_t gray = |
| 2128 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) | 2161 (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) |
| 2129 ? set_gray | 2162 ? set_gray |
| 2130 : reset_gray; | 2163 : reset_gray; |
| 2131 if (!clip_scan || clip_scan[col] == 255) { | 2164 if (!clip_scan || clip_scan[col] == 255) { |
| 2132 *dest_scan++ = gray; | 2165 *dest_scan++ = gray; |
| 2133 *dest_alpha_scan++ = 255; | 2166 *dest_alpha_scan++ = 255; |
| 2134 continue; | 2167 continue; |
| 2135 } | 2168 } |
| 2136 int src_alpha = clip_scan[col]; | 2169 int src_alpha = clip_scan[col]; |
| 2137 if (src_alpha == 0) { | 2170 if (src_alpha == 0) { |
| 2138 dest_scan++; | 2171 dest_scan++; |
| 2139 dest_alpha_scan++; | 2172 dest_alpha_scan++; |
| 2140 continue; | 2173 continue; |
| 2141 } | 2174 } |
| 2142 int back_alpha = *dest_alpha_scan; | 2175 int back_alpha = *dest_alpha_scan; |
| 2143 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2176 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2144 *dest_alpha_scan++ = dest_alpha; | 2177 *dest_alpha_scan++ = dest_alpha; |
| 2145 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2178 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2146 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); | 2179 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio); |
| 2147 dest_scan++; | 2180 dest_scan++; |
| 2148 } | 2181 } |
| 2149 } | 2182 } |
| 2150 inline void _CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, | 2183 |
| 2151 const uint8_t* src_scan, | 2184 void CompositeRow_8bppRgb2Rgb_NoBlend(uint8_t* dest_scan, |
| 2152 uint32_t* pPalette, | 2185 const uint8_t* src_scan, |
| 2153 int pixel_count, | 2186 uint32_t* pPalette, |
| 2154 int DestBpp, | 2187 int pixel_count, |
| 2155 const uint8_t* clip_scan, | 2188 int DestBpp, |
| 2156 const uint8_t* src_alpha_scan) { | 2189 const uint8_t* clip_scan, |
| 2190 const uint8_t* src_alpha_scan) { |
| 2157 if (src_alpha_scan) { | 2191 if (src_alpha_scan) { |
| 2158 int dest_gap = DestBpp - 3; | 2192 int dest_gap = DestBpp - 3; |
| 2159 FX_ARGB argb = 0; | 2193 FX_ARGB argb = 0; |
| 2160 for (int col = 0; col < pixel_count; col++) { | 2194 for (int col = 0; col < pixel_count; col++) { |
| 2161 argb = pPalette[*src_scan]; | 2195 argb = pPalette[*src_scan]; |
| 2162 int src_r = FXARGB_R(argb); | 2196 int src_r = FXARGB_R(argb); |
| 2163 int src_g = FXARGB_G(argb); | 2197 int src_g = FXARGB_G(argb); |
| 2164 int src_b = FXARGB_B(argb); | 2198 int src_b = FXARGB_B(argb); |
| 2165 src_scan++; | 2199 src_scan++; |
| 2166 uint8_t src_alpha = 0; | 2200 uint8_t src_alpha = 0; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2207 *dest_scan++ = src_g; | 2241 *dest_scan++ = src_g; |
| 2208 *dest_scan++ = src_r; | 2242 *dest_scan++ = src_r; |
| 2209 } | 2243 } |
| 2210 if (DestBpp == 4) { | 2244 if (DestBpp == 4) { |
| 2211 dest_scan++; | 2245 dest_scan++; |
| 2212 } | 2246 } |
| 2213 src_scan++; | 2247 src_scan++; |
| 2214 } | 2248 } |
| 2215 } | 2249 } |
| 2216 } | 2250 } |
| 2217 inline void _CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, | 2251 |
| 2218 const uint8_t* src_scan, | 2252 void CompositeRow_1bppRgb2Rgb_NoBlend(uint8_t* dest_scan, |
| 2219 int src_left, | 2253 const uint8_t* src_scan, |
| 2220 uint32_t* pPalette, | 2254 int src_left, |
| 2221 int pixel_count, | 2255 uint32_t* pPalette, |
| 2222 int DestBpp, | 2256 int pixel_count, |
| 2223 const uint8_t* clip_scan) { | 2257 int DestBpp, |
| 2258 const uint8_t* clip_scan) { |
| 2224 int reset_r, reset_g, reset_b; | 2259 int reset_r, reset_g, reset_b; |
| 2225 int set_r, set_g, set_b; | 2260 int set_r, set_g, set_b; |
| 2226 reset_r = FXARGB_R(pPalette[0]); | 2261 reset_r = FXARGB_R(pPalette[0]); |
| 2227 reset_g = FXARGB_G(pPalette[0]); | 2262 reset_g = FXARGB_G(pPalette[0]); |
| 2228 reset_b = FXARGB_B(pPalette[0]); | 2263 reset_b = FXARGB_B(pPalette[0]); |
| 2229 set_r = FXARGB_R(pPalette[1]); | 2264 set_r = FXARGB_R(pPalette[1]); |
| 2230 set_g = FXARGB_G(pPalette[1]); | 2265 set_g = FXARGB_G(pPalette[1]); |
| 2231 set_b = FXARGB_B(pPalette[1]); | 2266 set_b = FXARGB_B(pPalette[1]); |
| 2232 for (int col = 0; col < pixel_count; col++) { | 2267 for (int col = 0; col < pixel_count; col++) { |
| 2233 int src_r, src_g, src_b; | 2268 int src_r, src_g, src_b; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2250 } else { | 2285 } else { |
| 2251 *dest_scan++ = src_b; | 2286 *dest_scan++ = src_b; |
| 2252 *dest_scan++ = src_g; | 2287 *dest_scan++ = src_g; |
| 2253 *dest_scan++ = src_r; | 2288 *dest_scan++ = src_r; |
| 2254 } | 2289 } |
| 2255 if (DestBpp == 4) { | 2290 if (DestBpp == 4) { |
| 2256 dest_scan++; | 2291 dest_scan++; |
| 2257 } | 2292 } |
| 2258 } | 2293 } |
| 2259 } | 2294 } |
| 2260 inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, | 2295 |
| 2261 const uint8_t* src_scan, | 2296 void CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan, |
| 2262 int width, | 2297 const uint8_t* src_scan, |
| 2263 uint32_t* pPalette, | 2298 int width, |
| 2264 const uint8_t* clip_scan, | 2299 uint32_t* pPalette, |
| 2265 const uint8_t* src_alpha_scan) { | 2300 const uint8_t* clip_scan, |
| 2301 const uint8_t* src_alpha_scan) { |
| 2266 if (src_alpha_scan) { | 2302 if (src_alpha_scan) { |
| 2267 for (int col = 0; col < width; col++) { | 2303 for (int col = 0; col < width; col++) { |
| 2268 FX_ARGB argb = pPalette[*src_scan]; | 2304 FX_ARGB argb = pPalette[*src_scan]; |
| 2269 src_scan++; | 2305 src_scan++; |
| 2270 int src_r = FXARGB_R(argb); | 2306 int src_r = FXARGB_R(argb); |
| 2271 int src_g = FXARGB_G(argb); | 2307 int src_g = FXARGB_G(argb); |
| 2272 int src_b = FXARGB_B(argb); | 2308 int src_b = FXARGB_B(argb); |
| 2273 uint8_t back_alpha = dest_scan[3]; | 2309 uint8_t back_alpha = dest_scan[3]; |
| 2274 if (back_alpha == 0) { | 2310 if (back_alpha == 0) { |
| 2275 if (clip_scan) { | 2311 if (clip_scan) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2335 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2371 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2336 dest_scan++; | 2372 dest_scan++; |
| 2337 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2373 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2338 dest_scan++; | 2374 dest_scan++; |
| 2339 dest_scan++; | 2375 dest_scan++; |
| 2340 src_scan++; | 2376 src_scan++; |
| 2341 } | 2377 } |
| 2342 } | 2378 } |
| 2343 } | 2379 } |
| 2344 | 2380 |
| 2345 void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan, | 2381 void CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, |
| 2346 const uint8_t* src_scan, | 2382 const uint8_t* src_scan, |
| 2347 int width, | 2383 int src_left, |
| 2348 uint32_t* pPalette, | 2384 int width, |
| 2349 const uint8_t* clip_scan, | 2385 uint32_t* pPalette, |
| 2350 uint8_t* dest_alpha_scan, | 2386 const uint8_t* clip_scan) { |
| 2351 const uint8_t* src_alpha_scan) { | |
| 2352 if (src_alpha_scan) { | |
| 2353 for (int col = 0; col < width; col++) { | |
| 2354 FX_ARGB argb = pPalette[*src_scan]; | |
| 2355 src_scan++; | |
| 2356 int src_r = FXARGB_R(argb); | |
| 2357 int src_g = FXARGB_G(argb); | |
| 2358 int src_b = FXARGB_B(argb); | |
| 2359 uint8_t back_alpha = *dest_alpha_scan; | |
| 2360 if (back_alpha == 0) { | |
| 2361 if (clip_scan) { | |
| 2362 int src_alpha = clip_scan[col] * (*src_alpha_scan) / 255; | |
| 2363 *dest_alpha_scan++ = src_alpha; | |
| 2364 } else { | |
| 2365 *dest_alpha_scan++ = *src_alpha_scan; | |
| 2366 } | |
| 2367 *dest_scan++ = src_b; | |
| 2368 *dest_scan++ = src_g; | |
| 2369 *dest_scan++ = src_r; | |
| 2370 src_alpha_scan++; | |
| 2371 continue; | |
| 2372 } | |
| 2373 uint8_t src_alpha; | |
| 2374 if (clip_scan) { | |
| 2375 src_alpha = clip_scan[col] * (*src_alpha_scan++) / 255; | |
| 2376 } else { | |
| 2377 src_alpha = *src_alpha_scan++; | |
| 2378 } | |
| 2379 if (src_alpha == 0) { | |
| 2380 dest_scan += 3; | |
| 2381 dest_alpha_scan++; | |
| 2382 continue; | |
| 2383 } | |
| 2384 uint8_t dest_alpha = | |
| 2385 back_alpha + src_alpha - back_alpha * src_alpha / 255; | |
| 2386 *dest_alpha_scan++ = dest_alpha; | |
| 2387 int alpha_ratio = src_alpha * 255 / dest_alpha; | |
| 2388 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | |
| 2389 dest_scan++; | |
| 2390 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | |
| 2391 dest_scan++; | |
| 2392 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | |
| 2393 dest_scan++; | |
| 2394 } | |
| 2395 } else { | |
| 2396 for (int col = 0; col < width; col++) { | |
| 2397 FX_ARGB argb = pPalette[*src_scan]; | |
| 2398 int src_r = FXARGB_R(argb); | |
| 2399 int src_g = FXARGB_G(argb); | |
| 2400 int src_b = FXARGB_B(argb); | |
| 2401 if (!clip_scan || clip_scan[col] == 255) { | |
| 2402 *dest_scan++ = src_b; | |
| 2403 *dest_scan++ = src_g; | |
| 2404 *dest_scan++ = src_r; | |
| 2405 *dest_alpha_scan++ = 255; | |
| 2406 src_scan++; | |
| 2407 continue; | |
| 2408 } | |
| 2409 int src_alpha = clip_scan[col]; | |
| 2410 if (src_alpha == 0) { | |
| 2411 dest_scan += 3; | |
| 2412 dest_alpha_scan++; | |
| 2413 src_scan++; | |
| 2414 continue; | |
| 2415 } | |
| 2416 int back_alpha = *dest_alpha_scan; | |
| 2417 uint8_t dest_alpha = | |
| 2418 back_alpha + src_alpha - back_alpha * src_alpha / 255; | |
| 2419 *dest_alpha_scan++ = dest_alpha; | |
| 2420 int alpha_ratio = src_alpha * 255 / dest_alpha; | |
| 2421 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | |
| 2422 dest_scan++; | |
| 2423 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | |
| 2424 dest_scan++; | |
| 2425 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | |
| 2426 dest_scan++; | |
| 2427 src_scan++; | |
| 2428 } | |
| 2429 } | |
| 2430 } | |
| 2431 | |
| 2432 inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan, | |
| 2433 const uint8_t* src_scan, | |
| 2434 int src_left, | |
| 2435 int width, | |
| 2436 uint32_t* pPalette, | |
| 2437 const uint8_t* clip_scan) { | |
| 2438 int reset_r, reset_g, reset_b; | 2387 int reset_r, reset_g, reset_b; |
| 2439 int set_r, set_g, set_b; | 2388 int set_r, set_g, set_b; |
| 2440 reset_r = FXARGB_R(pPalette[0]); | 2389 reset_r = FXARGB_R(pPalette[0]); |
| 2441 reset_g = FXARGB_G(pPalette[0]); | 2390 reset_g = FXARGB_G(pPalette[0]); |
| 2442 reset_b = FXARGB_B(pPalette[0]); | 2391 reset_b = FXARGB_B(pPalette[0]); |
| 2443 set_r = FXARGB_R(pPalette[1]); | 2392 set_r = FXARGB_R(pPalette[1]); |
| 2444 set_g = FXARGB_G(pPalette[1]); | 2393 set_g = FXARGB_G(pPalette[1]); |
| 2445 set_b = FXARGB_B(pPalette[1]); | 2394 set_b = FXARGB_B(pPalette[1]); |
| 2446 for (int col = 0; col < width; col++) { | 2395 for (int col = 0; col < width; col++) { |
| 2447 int src_r, src_g, src_b; | 2396 int src_r, src_g, src_b; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2472 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2421 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2473 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2422 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
| 2474 dest_scan++; | 2423 dest_scan++; |
| 2475 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2424 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2476 dest_scan++; | 2425 dest_scan++; |
| 2477 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2426 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2478 dest_scan++; | 2427 dest_scan++; |
| 2479 dest_scan++; | 2428 dest_scan++; |
| 2480 } | 2429 } |
| 2481 } | 2430 } |
| 2482 void _CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, | 2431 |
| 2483 const uint8_t* src_scan, | 2432 void CompositeRow_1bppRgb2Rgba_NoBlend(uint8_t* dest_scan, |
| 2484 int src_left, | 2433 const uint8_t* src_scan, |
| 2485 int width, | 2434 int src_left, |
| 2486 uint32_t* pPalette, | 2435 int width, |
| 2487 const uint8_t* clip_scan, | 2436 uint32_t* pPalette, |
| 2488 uint8_t* dest_alpha_scan) { | 2437 const uint8_t* clip_scan, |
| 2438 uint8_t* dest_alpha_scan) { |
| 2489 int reset_r, reset_g, reset_b; | 2439 int reset_r, reset_g, reset_b; |
| 2490 int set_r, set_g, set_b; | 2440 int set_r, set_g, set_b; |
| 2491 reset_r = FXARGB_R(pPalette[0]); | 2441 reset_r = FXARGB_R(pPalette[0]); |
| 2492 reset_g = FXARGB_G(pPalette[0]); | 2442 reset_g = FXARGB_G(pPalette[0]); |
| 2493 reset_b = FXARGB_B(pPalette[0]); | 2443 reset_b = FXARGB_B(pPalette[0]); |
| 2494 set_r = FXARGB_R(pPalette[1]); | 2444 set_r = FXARGB_R(pPalette[1]); |
| 2495 set_g = FXARGB_G(pPalette[1]); | 2445 set_g = FXARGB_G(pPalette[1]); |
| 2496 set_b = FXARGB_B(pPalette[1]); | 2446 set_b = FXARGB_B(pPalette[1]); |
| 2497 for (int col = 0; col < width; col++) { | 2447 for (int col = 0; col < width; col++) { |
| 2498 int src_r, src_g, src_b; | 2448 int src_r, src_g, src_b; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2523 *dest_alpha_scan++ = dest_alpha; | 2473 *dest_alpha_scan++ = dest_alpha; |
| 2524 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2474 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2525 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2475 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
| 2526 dest_scan++; | 2476 dest_scan++; |
| 2527 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2477 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2528 dest_scan++; | 2478 dest_scan++; |
| 2529 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2479 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2530 dest_scan++; | 2480 dest_scan++; |
| 2531 } | 2481 } |
| 2532 } | 2482 } |
| 2533 void _CompositeRow_ByteMask2Argb(uint8_t* dest_scan, | 2483 |
| 2534 const uint8_t* src_scan, | 2484 void CompositeRow_ByteMask2Argb(uint8_t* dest_scan, |
| 2535 int mask_alpha, | 2485 const uint8_t* src_scan, |
| 2536 int src_r, | 2486 int mask_alpha, |
| 2537 int src_g, | 2487 int src_r, |
| 2538 int src_b, | 2488 int src_g, |
| 2539 int pixel_count, | 2489 int src_b, |
| 2540 int blend_type, | 2490 int pixel_count, |
| 2541 const uint8_t* clip_scan) { | 2491 int blend_type, |
| 2492 const uint8_t* clip_scan) { |
| 2542 for (int col = 0; col < pixel_count; col++) { | 2493 for (int col = 0; col < pixel_count; col++) { |
| 2543 int src_alpha; | 2494 int src_alpha; |
| 2544 if (clip_scan) { | 2495 if (clip_scan) { |
| 2545 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2496 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2546 } else { | 2497 } else { |
| 2547 src_alpha = mask_alpha * src_scan[col] / 255; | 2498 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2548 } | 2499 } |
| 2549 uint8_t back_alpha = dest_scan[3]; | 2500 uint8_t back_alpha = dest_scan[3]; |
| 2550 if (back_alpha == 0) { | 2501 if (back_alpha == 0) { |
| 2551 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | 2502 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |
| 2552 dest_scan += 4; | 2503 dest_scan += 4; |
| 2553 continue; | 2504 continue; |
| 2554 } | 2505 } |
| 2555 if (src_alpha == 0) { | 2506 if (src_alpha == 0) { |
| 2556 dest_scan += 4; | 2507 dest_scan += 4; |
| 2557 continue; | 2508 continue; |
| 2558 } | 2509 } |
| 2559 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2510 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2560 dest_scan[3] = dest_alpha; | 2511 dest_scan[3] = dest_alpha; |
| 2561 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2512 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2562 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2513 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2563 int blended_colors[3]; | 2514 int blended_colors[3]; |
| 2564 uint8_t src_scan[3]; | 2515 uint8_t src_scan[3]; |
| 2565 src_scan[0] = src_b; | 2516 src_scan[0] = src_b; |
| 2566 src_scan[1] = src_g; | 2517 src_scan[1] = src_g; |
| 2567 src_scan[2] = src_r; | 2518 src_scan[2] = src_r; |
| 2568 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2519 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 2569 *dest_scan = | 2520 *dest_scan = |
| 2570 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2521 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2571 dest_scan++; | 2522 dest_scan++; |
| 2572 *dest_scan = | 2523 *dest_scan = |
| 2573 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2524 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2574 dest_scan++; | 2525 dest_scan++; |
| 2575 *dest_scan = | 2526 *dest_scan = |
| 2576 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2527 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2577 } else if (blend_type) { | 2528 } else if (blend_type) { |
| 2578 int blended = _BLEND(blend_type, *dest_scan, src_b); | 2529 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2579 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 2530 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 2580 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2531 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2581 dest_scan++; | 2532 dest_scan++; |
| 2582 blended = _BLEND(blend_type, *dest_scan, src_g); | 2533 blended = Blend(blend_type, *dest_scan, src_g); |
| 2583 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | 2534 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); |
| 2584 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2535 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2585 dest_scan++; | 2536 dest_scan++; |
| 2586 blended = _BLEND(blend_type, *dest_scan, src_r); | 2537 blended = Blend(blend_type, *dest_scan, src_r); |
| 2587 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 2538 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
| 2588 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2539 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2589 } else { | 2540 } else { |
| 2590 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2541 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
| 2591 dest_scan++; | 2542 dest_scan++; |
| 2592 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2543 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2593 dest_scan++; | 2544 dest_scan++; |
| 2594 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2545 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2595 } | 2546 } |
| 2596 dest_scan += 2; | 2547 dest_scan += 2; |
| 2597 } | 2548 } |
| 2598 } | 2549 } |
| 2599 void _CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, | 2550 |
| 2600 const uint8_t* src_scan, | 2551 void CompositeRow_ByteMask2Rgba(uint8_t* dest_scan, |
| 2601 int mask_alpha, | 2552 const uint8_t* src_scan, |
| 2602 int src_r, | 2553 int mask_alpha, |
| 2603 int src_g, | 2554 int src_r, |
| 2604 int src_b, | 2555 int src_g, |
| 2605 int pixel_count, | 2556 int src_b, |
| 2606 int blend_type, | 2557 int pixel_count, |
| 2607 const uint8_t* clip_scan, | 2558 int blend_type, |
| 2608 uint8_t* dest_alpha_scan) { | 2559 const uint8_t* clip_scan, |
| 2560 uint8_t* dest_alpha_scan) { |
| 2609 for (int col = 0; col < pixel_count; col++) { | 2561 for (int col = 0; col < pixel_count; col++) { |
| 2610 int src_alpha; | 2562 int src_alpha; |
| 2611 if (clip_scan) { | 2563 if (clip_scan) { |
| 2612 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2564 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2613 } else { | 2565 } else { |
| 2614 src_alpha = mask_alpha * src_scan[col] / 255; | 2566 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2615 } | 2567 } |
| 2616 uint8_t back_alpha = *dest_alpha_scan; | 2568 uint8_t back_alpha = *dest_alpha_scan; |
| 2617 if (back_alpha == 0) { | 2569 if (back_alpha == 0) { |
| 2618 *dest_scan++ = src_b; | 2570 *dest_scan++ = src_b; |
| 2619 *dest_scan++ = src_g; | 2571 *dest_scan++ = src_g; |
| 2620 *dest_scan++ = src_r; | 2572 *dest_scan++ = src_r; |
| 2621 *dest_alpha_scan++ = src_alpha; | 2573 *dest_alpha_scan++ = src_alpha; |
| 2622 continue; | 2574 continue; |
| 2623 } | 2575 } |
| 2624 if (src_alpha == 0) { | 2576 if (src_alpha == 0) { |
| 2625 dest_scan += 3; | 2577 dest_scan += 3; |
| 2626 dest_alpha_scan++; | 2578 dest_alpha_scan++; |
| 2627 continue; | 2579 continue; |
| 2628 } | 2580 } |
| 2629 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2581 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2630 *dest_alpha_scan++ = dest_alpha; | 2582 *dest_alpha_scan++ = dest_alpha; |
| 2631 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2583 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2632 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2584 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2633 int blended_colors[3]; | 2585 int blended_colors[3]; |
| 2634 uint8_t src_scan[3]; | 2586 uint8_t src_scan[3]; |
| 2635 src_scan[0] = src_b; | 2587 src_scan[0] = src_b; |
| 2636 src_scan[1] = src_g; | 2588 src_scan[1] = src_g; |
| 2637 src_scan[2] = src_r; | 2589 src_scan[2] = src_r; |
| 2638 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2590 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 2639 *dest_scan = | 2591 *dest_scan = |
| 2640 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2592 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2641 dest_scan++; | 2593 dest_scan++; |
| 2642 *dest_scan = | 2594 *dest_scan = |
| 2643 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2595 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2644 dest_scan++; | 2596 dest_scan++; |
| 2645 *dest_scan = | 2597 *dest_scan = |
| 2646 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2598 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2647 dest_scan++; | 2599 dest_scan++; |
| 2648 } else if (blend_type) { | 2600 } else if (blend_type) { |
| 2649 int blended = _BLEND(blend_type, *dest_scan, src_b); | 2601 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2650 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 2602 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 2651 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2603 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2652 dest_scan++; | 2604 dest_scan++; |
| 2653 blended = _BLEND(blend_type, *dest_scan, src_g); | 2605 blended = Blend(blend_type, *dest_scan, src_g); |
| 2654 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | 2606 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); |
| 2655 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2607 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2656 dest_scan++; | 2608 dest_scan++; |
| 2657 blended = _BLEND(blend_type, *dest_scan, src_r); | 2609 blended = Blend(blend_type, *dest_scan, src_r); |
| 2658 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 2610 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
| 2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2611 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2660 dest_scan++; | 2612 dest_scan++; |
| 2661 } else { | 2613 } else { |
| 2662 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2614 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
| 2663 dest_scan++; | 2615 dest_scan++; |
| 2664 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2616 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2665 dest_scan++; | 2617 dest_scan++; |
| 2666 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2618 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2667 dest_scan++; | 2619 dest_scan++; |
| 2668 } | 2620 } |
| 2669 } | 2621 } |
| 2670 } | 2622 } |
| 2671 void _CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, | 2623 |
| 2672 const uint8_t* src_scan, | 2624 void CompositeRow_ByteMask2Rgb(uint8_t* dest_scan, |
| 2673 int mask_alpha, | 2625 const uint8_t* src_scan, |
| 2674 int src_r, | 2626 int mask_alpha, |
| 2675 int src_g, | 2627 int src_r, |
| 2676 int src_b, | 2628 int src_g, |
| 2677 int pixel_count, | 2629 int src_b, |
| 2678 int blend_type, | 2630 int pixel_count, |
| 2679 int Bpp, | 2631 int blend_type, |
| 2680 const uint8_t* clip_scan) { | 2632 int Bpp, |
| 2633 const uint8_t* clip_scan) { |
| 2681 for (int col = 0; col < pixel_count; col++) { | 2634 for (int col = 0; col < pixel_count; col++) { |
| 2682 int src_alpha; | 2635 int src_alpha; |
| 2683 if (clip_scan) { | 2636 if (clip_scan) { |
| 2684 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2637 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2685 } else { | 2638 } else { |
| 2686 src_alpha = mask_alpha * src_scan[col] / 255; | 2639 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2687 } | 2640 } |
| 2688 if (src_alpha == 0) { | 2641 if (src_alpha == 0) { |
| 2689 dest_scan += Bpp; | 2642 dest_scan += Bpp; |
| 2690 continue; | 2643 continue; |
| 2691 } | 2644 } |
| 2692 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2645 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2693 int blended_colors[3]; | 2646 int blended_colors[3]; |
| 2694 uint8_t src_scan[3]; | 2647 uint8_t src_scan[3]; |
| 2695 src_scan[0] = src_b; | 2648 src_scan[0] = src_b; |
| 2696 src_scan[1] = src_g; | 2649 src_scan[1] = src_g; |
| 2697 src_scan[2] = src_r; | 2650 src_scan[2] = src_r; |
| 2698 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2651 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 2699 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 2652 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
| 2700 dest_scan++; | 2653 dest_scan++; |
| 2701 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 2654 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
| 2702 dest_scan++; | 2655 dest_scan++; |
| 2703 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 2656 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |
| 2704 } else if (blend_type) { | 2657 } else if (blend_type) { |
| 2705 int blended = _BLEND(blend_type, *dest_scan, src_b); | 2658 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2706 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2659 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 2707 dest_scan++; | 2660 dest_scan++; |
| 2708 blended = _BLEND(blend_type, *dest_scan, src_g); | 2661 blended = Blend(blend_type, *dest_scan, src_g); |
| 2709 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2662 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 2710 dest_scan++; | 2663 dest_scan++; |
| 2711 blended = _BLEND(blend_type, *dest_scan, src_r); | 2664 blended = Blend(blend_type, *dest_scan, src_r); |
| 2712 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2665 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 2713 } else { | 2666 } else { |
| 2714 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); | 2667 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); |
| 2715 dest_scan++; | 2668 dest_scan++; |
| 2716 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); | 2669 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); |
| 2717 dest_scan++; | 2670 dest_scan++; |
| 2718 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); | 2671 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); |
| 2719 } | 2672 } |
| 2720 dest_scan += Bpp - 2; | 2673 dest_scan += Bpp - 2; |
| 2721 } | 2674 } |
| 2722 } | 2675 } |
| 2723 void _CompositeRow_ByteMask2Mask(uint8_t* dest_scan, | 2676 |
| 2724 const uint8_t* src_scan, | 2677 void CompositeRow_ByteMask2Mask(uint8_t* dest_scan, |
| 2725 int mask_alpha, | 2678 const uint8_t* src_scan, |
| 2726 int pixel_count, | 2679 int mask_alpha, |
| 2727 const uint8_t* clip_scan) { | 2680 int pixel_count, |
| 2681 const uint8_t* clip_scan) { |
| 2728 for (int col = 0; col < pixel_count; col++) { | 2682 for (int col = 0; col < pixel_count; col++) { |
| 2729 int src_alpha; | 2683 int src_alpha; |
| 2730 if (clip_scan) { | 2684 if (clip_scan) { |
| 2731 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2685 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2732 } else { | 2686 } else { |
| 2733 src_alpha = mask_alpha * src_scan[col] / 255; | 2687 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2734 } | 2688 } |
| 2735 uint8_t back_alpha = *dest_scan; | 2689 uint8_t back_alpha = *dest_scan; |
| 2736 if (!back_alpha) { | 2690 if (!back_alpha) { |
| 2737 *dest_scan = src_alpha; | 2691 *dest_scan = src_alpha; |
| 2738 } else if (src_alpha) { | 2692 } else if (src_alpha) { |
| 2739 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2693 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2740 } | 2694 } |
| 2741 dest_scan++; | 2695 dest_scan++; |
| 2742 } | 2696 } |
| 2743 } | 2697 } |
| 2744 void _CompositeRow_ByteMask2Gray(uint8_t* dest_scan, | 2698 |
| 2745 const uint8_t* src_scan, | 2699 void CompositeRow_ByteMask2Gray(uint8_t* dest_scan, |
| 2746 int mask_alpha, | 2700 const uint8_t* src_scan, |
| 2747 int src_gray, | 2701 int mask_alpha, |
| 2748 int pixel_count, | 2702 int src_gray, |
| 2749 const uint8_t* clip_scan) { | 2703 int pixel_count, |
| 2704 const uint8_t* clip_scan) { |
| 2750 for (int col = 0; col < pixel_count; col++) { | 2705 for (int col = 0; col < pixel_count; col++) { |
| 2751 int src_alpha; | 2706 int src_alpha; |
| 2752 if (clip_scan) { | 2707 if (clip_scan) { |
| 2753 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2708 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2754 } else { | 2709 } else { |
| 2755 src_alpha = mask_alpha * src_scan[col] / 255; | 2710 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2756 } | 2711 } |
| 2757 if (src_alpha) { | 2712 if (src_alpha) { |
| 2758 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); | 2713 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); |
| 2759 } | 2714 } |
| 2760 dest_scan++; | 2715 dest_scan++; |
| 2761 } | 2716 } |
| 2762 } | 2717 } |
| 2763 void _CompositeRow_ByteMask2Graya(uint8_t* dest_scan, | 2718 |
| 2764 const uint8_t* src_scan, | 2719 void CompositeRow_ByteMask2Graya(uint8_t* dest_scan, |
| 2765 int mask_alpha, | 2720 const uint8_t* src_scan, |
| 2766 int src_gray, | 2721 int mask_alpha, |
| 2767 int pixel_count, | 2722 int src_gray, |
| 2768 const uint8_t* clip_scan, | 2723 int pixel_count, |
| 2769 uint8_t* dest_alpha_scan) { | 2724 const uint8_t* clip_scan, |
| 2725 uint8_t* dest_alpha_scan) { |
| 2770 for (int col = 0; col < pixel_count; col++) { | 2726 for (int col = 0; col < pixel_count; col++) { |
| 2771 int src_alpha; | 2727 int src_alpha; |
| 2772 if (clip_scan) { | 2728 if (clip_scan) { |
| 2773 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 2729 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 2774 } else { | 2730 } else { |
| 2775 src_alpha = mask_alpha * src_scan[col] / 255; | 2731 src_alpha = mask_alpha * src_scan[col] / 255; |
| 2776 } | 2732 } |
| 2777 uint8_t back_alpha = *dest_alpha_scan; | 2733 uint8_t back_alpha = *dest_alpha_scan; |
| 2778 if (back_alpha == 0) { | 2734 if (back_alpha == 0) { |
| 2779 *dest_scan++ = src_gray; | 2735 *dest_scan++ = src_gray; |
| 2780 *dest_alpha_scan++ = src_alpha; | 2736 *dest_alpha_scan++ = src_alpha; |
| 2781 continue; | 2737 continue; |
| 2782 } | 2738 } |
| 2783 if (src_alpha == 0) { | 2739 if (src_alpha == 0) { |
| 2784 dest_scan++; | 2740 dest_scan++; |
| 2785 dest_alpha_scan++; | 2741 dest_alpha_scan++; |
| 2786 continue; | 2742 continue; |
| 2787 } | 2743 } |
| 2788 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2744 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2789 *dest_alpha_scan++ = dest_alpha; | 2745 *dest_alpha_scan++ = dest_alpha; |
| 2790 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2746 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2791 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); | 2747 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); |
| 2792 dest_scan++; | 2748 dest_scan++; |
| 2793 } | 2749 } |
| 2794 } | 2750 } |
| 2795 void _CompositeRow_BitMask2Argb(uint8_t* dest_scan, | 2751 |
| 2796 const uint8_t* src_scan, | 2752 void CompositeRow_BitMask2Argb(uint8_t* dest_scan, |
| 2797 int mask_alpha, | 2753 const uint8_t* src_scan, |
| 2798 int src_r, | 2754 int mask_alpha, |
| 2799 int src_g, | 2755 int src_r, |
| 2800 int src_b, | 2756 int src_g, |
| 2801 int src_left, | 2757 int src_b, |
| 2802 int pixel_count, | 2758 int src_left, |
| 2803 int blend_type, | 2759 int pixel_count, |
| 2804 const uint8_t* clip_scan) { | 2760 int blend_type, |
| 2761 const uint8_t* clip_scan) { |
| 2805 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { | 2762 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { |
| 2806 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); | 2763 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); |
| 2807 for (int col = 0; col < pixel_count; col++) { | 2764 for (int col = 0; col < pixel_count; col++) { |
| 2808 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { | 2765 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { |
| 2809 FXARGB_SETDIB(dest_scan, argb); | 2766 FXARGB_SETDIB(dest_scan, argb); |
| 2810 } | 2767 } |
| 2811 dest_scan += 4; | 2768 dest_scan += 4; |
| 2812 } | 2769 } |
| 2813 return; | 2770 return; |
| 2814 } | 2771 } |
| 2815 for (int col = 0; col < pixel_count; col++) { | 2772 for (int col = 0; col < pixel_count; col++) { |
| 2816 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { | 2773 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { |
| 2817 dest_scan += 4; | 2774 dest_scan += 4; |
| 2818 continue; | 2775 continue; |
| 2819 } | 2776 } |
| 2820 int src_alpha; | 2777 int src_alpha; |
| 2821 if (clip_scan) { | |
| 2822 src_alpha = mask_alpha * clip_scan[col] / 255; | |
| 2823 } else { | |
| 2824 src_alpha = mask_alpha; | |
| 2825 } | |
| 2826 uint8_t back_alpha = dest_scan[3]; | |
| 2827 if (back_alpha == 0) { | |
| 2828 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); | |
| 2829 dest_scan += 4; | |
| 2830 continue; | |
| 2831 } | |
| 2832 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | |
| 2833 dest_scan[3] = dest_alpha; | |
| 2834 int alpha_ratio = src_alpha * 255 / dest_alpha; | |
| 2835 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | |
| 2836 int blended_colors[3]; | |
| 2837 uint8_t src_scan[3]; | |
| 2838 src_scan[0] = src_b; | |
| 2839 src_scan[1] = src_g; | |
| 2840 src_scan[2] = src_r; | |
| 2841 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | |
| 2842 *dest_scan = | |
| 2843 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | |
| 2844 dest_scan++; | |
| 2845 *dest_scan = | |
| 2846 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | |
| 2847 dest_scan++; | |
| 2848 *dest_scan = | |
| 2849 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | |
| 2850 } else if (blend_type) { | |
| 2851 int blended = _BLEND(blend_type, *dest_scan, src_b); | |
| 2852 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | |
| 2853 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | |
| 2854 dest_scan++; | |
| 2855 blended = _BLEND(blend_type, *dest_scan, src_g); | |
| 2856 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | |
| 2857 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | |
| 2858 dest_scan++; | |
| 2859 blended = _BLEND(blend_type, *dest_scan, src_r); | |
| 2860 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | |
| 2861 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | |
| 2862 } else { | |
| 2863 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | |
| 2864 dest_scan++; | |
| 2865 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | |
| 2866 dest_scan++; | |
| 2867 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | |
| 2868 } | |
| 2869 dest_scan += 2; | |
| 2870 } | |
| 2871 } | |
| 2872 void _CompositeRow_BitMask2Rgba(uint8_t* dest_scan, | |
| 2873 const uint8_t* src_scan, | |
| 2874 int mask_alpha, | |
| 2875 int src_r, | |
| 2876 int src_g, | |
| 2877 int src_b, | |
| 2878 int src_left, | |
| 2879 int pixel_count, | |
| 2880 int blend_type, | |
| 2881 const uint8_t* clip_scan, | |
| 2882 uint8_t* dest_alpha_scan) { | |
| 2883 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { | |
| 2884 for (int col = 0; col < pixel_count; col++) { | |
| 2885 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { | |
| 2886 dest_scan[0] = src_b; | |
| 2887 dest_scan[1] = src_g; | |
| 2888 dest_scan[2] = src_r; | |
| 2889 *dest_alpha_scan = mask_alpha; | |
| 2890 } | |
| 2891 dest_scan += 3; | |
| 2892 dest_alpha_scan++; | |
| 2893 } | |
| 2894 return; | |
| 2895 } | |
| 2896 for (int col = 0; col < pixel_count; col++) { | |
| 2897 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { | |
| 2898 dest_scan += 3; | |
| 2899 dest_alpha_scan++; | |
| 2900 continue; | |
| 2901 } | |
| 2902 int src_alpha; | |
| 2903 if (clip_scan) { | 2778 if (clip_scan) { |
| 2904 src_alpha = mask_alpha * clip_scan[col] / 255; | 2779 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 2905 } else { | 2780 } else { |
| 2906 src_alpha = mask_alpha; | 2781 src_alpha = mask_alpha; |
| 2907 } | 2782 } |
| 2908 uint8_t back_alpha = dest_scan[3]; | 2783 uint8_t back_alpha = dest_scan[3]; |
| 2909 if (back_alpha == 0) { | 2784 if (back_alpha == 0) { |
| 2910 *dest_scan++ = src_b; | 2785 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alpha, src_r, src_g, src_b)); |
| 2911 *dest_scan++ = src_g; | 2786 dest_scan += 4; |
| 2912 *dest_scan++ = src_r; | |
| 2913 *dest_alpha_scan++ = mask_alpha; | |
| 2914 continue; | 2787 continue; |
| 2915 } | 2788 } |
| 2916 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2789 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 2917 *dest_alpha_scan++ = dest_alpha; | 2790 dest_scan[3] = dest_alpha; |
| 2918 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2791 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 2919 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2792 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2920 int blended_colors[3]; | 2793 int blended_colors[3]; |
| 2921 uint8_t src_scan[3]; | 2794 uint8_t src_scan[3]; |
| 2922 src_scan[0] = src_b; | 2795 src_scan[0] = src_b; |
| 2923 src_scan[1] = src_g; | 2796 src_scan[1] = src_g; |
| 2924 src_scan[2] = src_r; | 2797 src_scan[2] = src_r; |
| 2925 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2798 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 2926 *dest_scan = | 2799 *dest_scan = |
| 2927 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); | 2800 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio); |
| 2928 dest_scan++; | 2801 dest_scan++; |
| 2929 *dest_scan = | 2802 *dest_scan = |
| 2930 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); | 2803 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], alpha_ratio); |
| 2931 dest_scan++; | 2804 dest_scan++; |
| 2932 *dest_scan = | 2805 *dest_scan = |
| 2933 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); | 2806 FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], alpha_ratio); |
| 2934 dest_scan++; | |
| 2935 } else if (blend_type) { | 2807 } else if (blend_type) { |
| 2936 int blended = _BLEND(blend_type, *dest_scan, src_b); | 2808 int blended = Blend(blend_type, *dest_scan, src_b); |
| 2937 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 2809 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 2938 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2810 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2939 dest_scan++; | 2811 dest_scan++; |
| 2940 blended = _BLEND(blend_type, *dest_scan, src_g); | 2812 blended = Blend(blend_type, *dest_scan, src_g); |
| 2941 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | 2813 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); |
| 2942 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2814 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2943 dest_scan++; | 2815 dest_scan++; |
| 2944 blended = _BLEND(blend_type, *dest_scan, src_r); | 2816 blended = Blend(blend_type, *dest_scan, src_r); |
| 2945 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 2817 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
| 2946 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); | 2818 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, alpha_ratio); |
| 2947 dest_scan++; | |
| 2948 } else { | 2819 } else { |
| 2949 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); | 2820 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio); |
| 2950 dest_scan++; | 2821 dest_scan++; |
| 2951 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); | 2822 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio); |
| 2952 dest_scan++; | 2823 dest_scan++; |
| 2953 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); | 2824 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio); |
| 2954 dest_scan++; | |
| 2955 } | 2825 } |
| 2826 dest_scan += 2; |
| 2956 } | 2827 } |
| 2957 } | 2828 } |
| 2958 void _CompositeRow_BitMask2Rgb(uint8_t* dest_scan, | 2829 |
| 2959 const uint8_t* src_scan, | 2830 void CompositeRow_BitMask2Rgb(uint8_t* dest_scan, |
| 2960 int mask_alpha, | 2831 const uint8_t* src_scan, |
| 2961 int src_r, | 2832 int mask_alpha, |
| 2962 int src_g, | 2833 int src_r, |
| 2963 int src_b, | 2834 int src_g, |
| 2964 int src_left, | 2835 int src_b, |
| 2965 int pixel_count, | 2836 int src_left, |
| 2966 int blend_type, | 2837 int pixel_count, |
| 2967 int Bpp, | 2838 int blend_type, |
| 2968 const uint8_t* clip_scan) { | 2839 int Bpp, |
| 2840 const uint8_t* clip_scan) { |
| 2969 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { | 2841 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { |
| 2970 for (int col = 0; col < pixel_count; col++) { | 2842 for (int col = 0; col < pixel_count; col++) { |
| 2971 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { | 2843 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { |
| 2972 dest_scan[2] = src_r; | 2844 dest_scan[2] = src_r; |
| 2973 dest_scan[1] = src_g; | 2845 dest_scan[1] = src_g; |
| 2974 dest_scan[0] = src_b; | 2846 dest_scan[0] = src_b; |
| 2975 } | 2847 } |
| 2976 dest_scan += Bpp; | 2848 dest_scan += Bpp; |
| 2977 } | 2849 } |
| 2978 return; | 2850 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2991 if (src_alpha == 0) { | 2863 if (src_alpha == 0) { |
| 2992 dest_scan += Bpp; | 2864 dest_scan += Bpp; |
| 2993 continue; | 2865 continue; |
| 2994 } | 2866 } |
| 2995 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 2867 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 2996 int blended_colors[3]; | 2868 int blended_colors[3]; |
| 2997 uint8_t src_scan[3]; | 2869 uint8_t src_scan[3]; |
| 2998 src_scan[0] = src_b; | 2870 src_scan[0] = src_b; |
| 2999 src_scan[1] = src_g; | 2871 src_scan[1] = src_g; |
| 3000 src_scan[2] = src_r; | 2872 src_scan[2] = src_r; |
| 3001 _RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); | 2873 RGB_Blend(blend_type, src_scan, dest_scan, blended_colors); |
| 3002 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); | 2874 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha); |
| 3003 dest_scan++; | 2875 dest_scan++; |
| 3004 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); | 2876 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha); |
| 3005 dest_scan++; | 2877 dest_scan++; |
| 3006 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); | 2878 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[2], src_alpha); |
| 3007 } else if (blend_type) { | 2879 } else if (blend_type) { |
| 3008 int blended = _BLEND(blend_type, *dest_scan, src_b); | 2880 int blended = Blend(blend_type, *dest_scan, src_b); |
| 3009 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2881 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 3010 dest_scan++; | 2882 dest_scan++; |
| 3011 blended = _BLEND(blend_type, *dest_scan, src_g); | 2883 blended = Blend(blend_type, *dest_scan, src_g); |
| 3012 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2884 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 3013 dest_scan++; | 2885 dest_scan++; |
| 3014 blended = _BLEND(blend_type, *dest_scan, src_r); | 2886 blended = Blend(blend_type, *dest_scan, src_r); |
| 3015 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); | 2887 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended, src_alpha); |
| 3016 } else { | 2888 } else { |
| 3017 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); | 2889 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha); |
| 3018 dest_scan++; | 2890 dest_scan++; |
| 3019 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); | 2891 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha); |
| 3020 dest_scan++; | 2892 dest_scan++; |
| 3021 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); | 2893 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha); |
| 3022 } | 2894 } |
| 3023 dest_scan += Bpp - 2; | 2895 dest_scan += Bpp - 2; |
| 3024 } | 2896 } |
| 3025 } | 2897 } |
| 3026 void _CompositeRow_BitMask2Mask(uint8_t* dest_scan, | 2898 |
| 3027 const uint8_t* src_scan, | 2899 void CompositeRow_BitMask2Mask(uint8_t* dest_scan, |
| 3028 int mask_alpha, | 2900 const uint8_t* src_scan, |
| 3029 int src_left, | 2901 int mask_alpha, |
| 3030 int pixel_count, | 2902 int src_left, |
| 3031 const uint8_t* clip_scan) { | 2903 int pixel_count, |
| 2904 const uint8_t* clip_scan) { |
| 3032 for (int col = 0; col < pixel_count; col++) { | 2905 for (int col = 0; col < pixel_count; col++) { |
| 3033 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { | 2906 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { |
| 3034 dest_scan++; | 2907 dest_scan++; |
| 3035 continue; | 2908 continue; |
| 3036 } | 2909 } |
| 3037 int src_alpha; | 2910 int src_alpha; |
| 3038 if (clip_scan) { | 2911 if (clip_scan) { |
| 3039 src_alpha = mask_alpha * clip_scan[col] / 255; | 2912 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 3040 } else { | 2913 } else { |
| 3041 src_alpha = mask_alpha; | 2914 src_alpha = mask_alpha; |
| 3042 } | 2915 } |
| 3043 uint8_t back_alpha = *dest_scan; | 2916 uint8_t back_alpha = *dest_scan; |
| 3044 if (!back_alpha) { | 2917 if (!back_alpha) { |
| 3045 *dest_scan = src_alpha; | 2918 *dest_scan = src_alpha; |
| 3046 } else if (src_alpha) { | 2919 } else if (src_alpha) { |
| 3047 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2920 *dest_scan = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3048 } | 2921 } |
| 3049 dest_scan++; | 2922 dest_scan++; |
| 3050 } | 2923 } |
| 3051 } | 2924 } |
| 3052 void _CompositeRow_BitMask2Gray(uint8_t* dest_scan, | 2925 |
| 3053 const uint8_t* src_scan, | 2926 void CompositeRow_BitMask2Gray(uint8_t* dest_scan, |
| 3054 int mask_alpha, | 2927 const uint8_t* src_scan, |
| 3055 int src_gray, | 2928 int mask_alpha, |
| 3056 int src_left, | 2929 int src_gray, |
| 3057 int pixel_count, | 2930 int src_left, |
| 3058 const uint8_t* clip_scan) { | 2931 int pixel_count, |
| 2932 const uint8_t* clip_scan) { |
| 3059 for (int col = 0; col < pixel_count; col++) { | 2933 for (int col = 0; col < pixel_count; col++) { |
| 3060 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { | 2934 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { |
| 3061 dest_scan++; | 2935 dest_scan++; |
| 3062 continue; | 2936 continue; |
| 3063 } | 2937 } |
| 3064 int src_alpha; | 2938 int src_alpha; |
| 3065 if (clip_scan) { | 2939 if (clip_scan) { |
| 3066 src_alpha = mask_alpha * clip_scan[col] / 255; | 2940 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 3067 } else { | 2941 } else { |
| 3068 src_alpha = mask_alpha; | 2942 src_alpha = mask_alpha; |
| 3069 } | 2943 } |
| 3070 if (src_alpha) { | 2944 if (src_alpha) { |
| 3071 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); | 2945 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, src_alpha); |
| 3072 } | 2946 } |
| 3073 dest_scan++; | 2947 dest_scan++; |
| 3074 } | 2948 } |
| 3075 } | 2949 } |
| 3076 void _CompositeRow_BitMask2Graya(uint8_t* dest_scan, | 2950 |
| 3077 const uint8_t* src_scan, | 2951 void CompositeRow_BitMask2Graya(uint8_t* dest_scan, |
| 3078 int mask_alpha, | 2952 const uint8_t* src_scan, |
| 3079 int src_gray, | 2953 int mask_alpha, |
| 3080 int src_left, | 2954 int src_gray, |
| 3081 int pixel_count, | 2955 int src_left, |
| 3082 const uint8_t* clip_scan, | 2956 int pixel_count, |
| 3083 uint8_t* dest_alpha_scan) { | 2957 const uint8_t* clip_scan, |
| 2958 uint8_t* dest_alpha_scan) { |
| 3084 for (int col = 0; col < pixel_count; col++) { | 2959 for (int col = 0; col < pixel_count; col++) { |
| 3085 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { | 2960 if (!(src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8)))) { |
| 3086 dest_scan++; | 2961 dest_scan++; |
| 3087 dest_alpha_scan++; | 2962 dest_alpha_scan++; |
| 3088 continue; | 2963 continue; |
| 3089 } | 2964 } |
| 3090 int src_alpha; | 2965 int src_alpha; |
| 3091 if (clip_scan) { | 2966 if (clip_scan) { |
| 3092 src_alpha = mask_alpha * clip_scan[col] / 255; | 2967 src_alpha = mask_alpha * clip_scan[col] / 255; |
| 3093 } else { | 2968 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3104 dest_alpha_scan++; | 2979 dest_alpha_scan++; |
| 3105 continue; | 2980 continue; |
| 3106 } | 2981 } |
| 3107 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 2982 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3108 *dest_alpha_scan++ = dest_alpha; | 2983 *dest_alpha_scan++ = dest_alpha; |
| 3109 int alpha_ratio = src_alpha * 255 / dest_alpha; | 2984 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3110 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); | 2985 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_gray, alpha_ratio); |
| 3111 dest_scan++; | 2986 dest_scan++; |
| 3112 } | 2987 } |
| 3113 } | 2988 } |
| 3114 void _CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, | 2989 |
| 3115 const uint8_t* src_scan, | 2990 void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, |
| 3116 int pixel_count, | 2991 const uint8_t* src_scan, |
| 3117 int blend_type, | 2992 int pixel_count, |
| 3118 const uint8_t* clip_scan) { | 2993 int blend_type, |
| 2994 const uint8_t* clip_scan) { |
| 3119 int blended_colors[3]; | 2995 int blended_colors[3]; |
| 3120 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 2996 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3121 for (int col = 0; col < pixel_count; col++) { | 2997 for (int col = 0; col < pixel_count; col++) { |
| 3122 uint8_t back_alpha = dest_scan[3]; | 2998 uint8_t back_alpha = dest_scan[3]; |
| 3123 if (back_alpha == 0) { | 2999 if (back_alpha == 0) { |
| 3124 if (clip_scan) { | 3000 if (clip_scan) { |
| 3125 int src_alpha = clip_scan[col] * src_scan[3] / 255; | 3001 int src_alpha = clip_scan[col] * src_scan[3] / 255; |
| 3126 dest_scan[3] = src_alpha; | 3002 dest_scan[3] = src_alpha; |
| 3127 dest_scan[0] = src_scan[2]; | 3003 dest_scan[0] = src_scan[2]; |
| 3128 dest_scan[1] = src_scan[1]; | 3004 dest_scan[1] = src_scan[1]; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3146 continue; | 3022 continue; |
| 3147 } | 3023 } |
| 3148 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3024 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3149 dest_scan[3] = dest_alpha; | 3025 dest_scan[3] = dest_alpha; |
| 3150 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3026 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3151 if (bNonseparableBlend) { | 3027 if (bNonseparableBlend) { |
| 3152 uint8_t dest_scan_o[3]; | 3028 uint8_t dest_scan_o[3]; |
| 3153 dest_scan_o[0] = dest_scan[2]; | 3029 dest_scan_o[0] = dest_scan[2]; |
| 3154 dest_scan_o[1] = dest_scan[1]; | 3030 dest_scan_o[1] = dest_scan[1]; |
| 3155 dest_scan_o[2] = dest_scan[0]; | 3031 dest_scan_o[2] = dest_scan[0]; |
| 3156 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3032 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3157 } | 3033 } |
| 3158 for (int color = 0; color < 3; color++) { | 3034 for (int color = 0; color < 3; color++) { |
| 3159 int index = 2 - color; | 3035 int index = 2 - color; |
| 3160 if (blend_type) { | 3036 if (blend_type) { |
| 3161 int blended = bNonseparableBlend | 3037 int blended = bNonseparableBlend |
| 3162 ? blended_colors[color] | 3038 ? blended_colors[color] |
| 3163 : _BLEND(blend_type, dest_scan[index], *src_scan); | 3039 : Blend(blend_type, dest_scan[index], *src_scan); |
| 3164 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); | 3040 blended = FXDIB_ALPHA_MERGE(*src_scan, blended, back_alpha); |
| 3165 dest_scan[index] = | 3041 dest_scan[index] = |
| 3166 FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio); | 3042 FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio); |
| 3167 } else { | 3043 } else { |
| 3168 dest_scan[index] = | 3044 dest_scan[index] = |
| 3169 FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio); | 3045 FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio); |
| 3170 } | 3046 } |
| 3171 src_scan++; | 3047 src_scan++; |
| 3172 } | 3048 } |
| 3173 dest_scan += 4; | 3049 dest_scan += 4; |
| 3174 src_scan++; | 3050 src_scan++; |
| 3175 } | 3051 } |
| 3176 } | 3052 } |
| 3177 void _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, | 3053 |
| 3178 const uint8_t* src_scan, | 3054 void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3179 int width, | 3055 const uint8_t* src_scan, |
| 3180 int blend_type, | 3056 int width, |
| 3181 int src_Bpp) { | 3057 int blend_type, |
| 3058 int src_Bpp) { |
| 3182 int blended_colors[3]; | 3059 int blended_colors[3]; |
| 3183 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3060 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3184 int src_gap = src_Bpp - 3; | 3061 int src_gap = src_Bpp - 3; |
| 3185 for (int col = 0; col < width; col++) { | 3062 for (int col = 0; col < width; col++) { |
| 3186 uint8_t back_alpha = dest_scan[3]; | 3063 uint8_t back_alpha = dest_scan[3]; |
| 3187 if (back_alpha == 0) { | 3064 if (back_alpha == 0) { |
| 3188 if (src_Bpp == 4) { | 3065 if (src_Bpp == 4) { |
| 3189 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 3066 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
| 3190 } else { | 3067 } else { |
| 3191 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], | 3068 FXARGB_SETRGBORDERDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[2], |
| 3192 src_scan[1], src_scan[0])); | 3069 src_scan[1], src_scan[0])); |
| 3193 } | 3070 } |
| 3194 dest_scan += 4; | 3071 dest_scan += 4; |
| 3195 src_scan += src_Bpp; | 3072 src_scan += src_Bpp; |
| 3196 continue; | 3073 continue; |
| 3197 } | 3074 } |
| 3198 dest_scan[3] = 0xff; | 3075 dest_scan[3] = 0xff; |
| 3199 if (bNonseparableBlend) { | 3076 if (bNonseparableBlend) { |
| 3200 uint8_t dest_scan_o[3]; | 3077 uint8_t dest_scan_o[3]; |
| 3201 dest_scan_o[0] = dest_scan[2]; | 3078 dest_scan_o[0] = dest_scan[2]; |
| 3202 dest_scan_o[1] = dest_scan[1]; | 3079 dest_scan_o[1] = dest_scan[1]; |
| 3203 dest_scan_o[2] = dest_scan[0]; | 3080 dest_scan_o[2] = dest_scan[0]; |
| 3204 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3081 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3205 } | 3082 } |
| 3206 for (int color = 0; color < 3; color++) { | 3083 for (int color = 0; color < 3; color++) { |
| 3207 int index = 2 - color; | 3084 int index = 2 - color; |
| 3208 int src_color = FX_GAMMA(*src_scan); | 3085 int src_color = *src_scan; |
| 3209 int blended = bNonseparableBlend | 3086 int blended = bNonseparableBlend |
| 3210 ? blended_colors[color] | 3087 ? blended_colors[color] |
| 3211 : _BLEND(blend_type, dest_scan[index], src_color); | 3088 : Blend(blend_type, dest_scan[index], src_color); |
| 3212 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 3089 dest_scan[index] = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 3213 src_scan++; | 3090 src_scan++; |
| 3214 } | 3091 } |
| 3215 dest_scan += 4; | 3092 dest_scan += 4; |
| 3216 src_scan += src_gap; | 3093 src_scan += src_gap; |
| 3217 } | 3094 } |
| 3218 } | 3095 } |
| 3219 inline void _CompositeRow_Argb2Rgb_Blend_RgbByteOrder( | 3096 |
| 3220 uint8_t* dest_scan, | 3097 void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, |
| 3221 const uint8_t* src_scan, | 3098 const uint8_t* src_scan, |
| 3222 int width, | 3099 int width, |
| 3223 int blend_type, | 3100 int blend_type, |
| 3224 int dest_Bpp, | 3101 int dest_Bpp, |
| 3225 const uint8_t* clip_scan) { | 3102 const uint8_t* clip_scan) { |
| 3226 int blended_colors[3]; | 3103 int blended_colors[3]; |
| 3227 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3104 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3228 for (int col = 0; col < width; col++) { | 3105 for (int col = 0; col < width; col++) { |
| 3229 uint8_t src_alpha; | 3106 uint8_t src_alpha; |
| 3230 if (clip_scan) { | 3107 if (clip_scan) { |
| 3231 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 3108 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 3232 } else { | 3109 } else { |
| 3233 src_alpha = src_scan[3]; | 3110 src_alpha = src_scan[3]; |
| 3234 } | 3111 } |
| 3235 if (src_alpha == 0) { | 3112 if (src_alpha == 0) { |
| 3236 dest_scan += dest_Bpp; | 3113 dest_scan += dest_Bpp; |
| 3237 src_scan += 4; | 3114 src_scan += 4; |
| 3238 continue; | 3115 continue; |
| 3239 } | 3116 } |
| 3240 if (bNonseparableBlend) { | 3117 if (bNonseparableBlend) { |
| 3241 uint8_t dest_scan_o[3]; | 3118 uint8_t dest_scan_o[3]; |
| 3242 dest_scan_o[0] = dest_scan[2]; | 3119 dest_scan_o[0] = dest_scan[2]; |
| 3243 dest_scan_o[1] = dest_scan[1]; | 3120 dest_scan_o[1] = dest_scan[1]; |
| 3244 dest_scan_o[2] = dest_scan[0]; | 3121 dest_scan_o[2] = dest_scan[0]; |
| 3245 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3122 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3246 } | 3123 } |
| 3247 for (int color = 0; color < 3; color++) { | 3124 for (int color = 0; color < 3; color++) { |
| 3248 int index = 2 - color; | 3125 int index = 2 - color; |
| 3249 int back_color = FX_GAMMA(dest_scan[index]); | 3126 int back_color = dest_scan[index]; |
| 3250 int blended = bNonseparableBlend | 3127 int blended = bNonseparableBlend |
| 3251 ? blended_colors[color] | 3128 ? blended_colors[color] |
| 3252 : _BLEND(blend_type, back_color, *src_scan); | 3129 : Blend(blend_type, back_color, *src_scan); |
| 3253 dest_scan[index] = | 3130 dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3254 FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blended, src_alpha)); | |
| 3255 src_scan++; | 3131 src_scan++; |
| 3256 } | 3132 } |
| 3257 dest_scan += dest_Bpp; | 3133 dest_scan += dest_Bpp; |
| 3258 src_scan++; | 3134 src_scan++; |
| 3259 } | 3135 } |
| 3260 } | 3136 } |
| 3261 inline void _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder( | 3137 |
| 3262 uint8_t* dest_scan, | 3138 void CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3263 const uint8_t* src_scan, | 3139 const uint8_t* src_scan, |
| 3264 int width, | 3140 int width, |
| 3265 int src_Bpp) { | 3141 int src_Bpp) { |
| 3266 for (int col = 0; col < width; col++) { | 3142 for (int col = 0; col < width; col++) { |
| 3267 if (src_Bpp == 4) { | 3143 if (src_Bpp == 4) { |
| 3268 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); | 3144 FXARGB_SETRGBORDERDIB(dest_scan, 0xff000000 | FXARGB_GETDIB(src_scan)); |
| 3269 } else { | 3145 } else { |
| 3270 FXARGB_SETRGBORDERDIB( | 3146 FXARGB_SETRGBORDERDIB( |
| 3271 dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); | 3147 dest_scan, FXARGB_MAKE(0xff, src_scan[2], src_scan[1], src_scan[0])); |
| 3272 } | 3148 } |
| 3273 dest_scan += 4; | 3149 dest_scan += 4; |
| 3274 src_scan += src_Bpp; | 3150 src_scan += src_Bpp; |
| 3275 } | 3151 } |
| 3276 } | 3152 } |
| 3277 inline void _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder( | 3153 |
| 3278 uint8_t* dest_scan, | 3154 void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3279 const uint8_t* src_scan, | 3155 const uint8_t* src_scan, |
| 3280 int width, | 3156 int width, |
| 3281 int blend_type, | 3157 int blend_type, |
| 3282 int dest_Bpp, | 3158 int dest_Bpp, |
| 3283 int src_Bpp) { | 3159 int src_Bpp) { |
| 3284 int blended_colors[3]; | 3160 int blended_colors[3]; |
| 3285 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3161 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3286 int src_gap = src_Bpp - 3; | 3162 int src_gap = src_Bpp - 3; |
| 3287 for (int col = 0; col < width; col++) { | 3163 for (int col = 0; col < width; col++) { |
| 3288 if (bNonseparableBlend) { | 3164 if (bNonseparableBlend) { |
| 3289 uint8_t dest_scan_o[3]; | 3165 uint8_t dest_scan_o[3]; |
| 3290 dest_scan_o[0] = dest_scan[2]; | 3166 dest_scan_o[0] = dest_scan[2]; |
| 3291 dest_scan_o[1] = dest_scan[1]; | 3167 dest_scan_o[1] = dest_scan[1]; |
| 3292 dest_scan_o[2] = dest_scan[0]; | 3168 dest_scan_o[2] = dest_scan[0]; |
| 3293 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3169 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3294 } | 3170 } |
| 3295 for (int color = 0; color < 3; color++) { | 3171 for (int color = 0; color < 3; color++) { |
| 3296 int index = 2 - color; | 3172 int index = 2 - color; |
| 3297 int back_color = FX_GAMMA(dest_scan[index]); | 3173 int back_color = dest_scan[index]; |
| 3298 int src_color = FX_GAMMA(*src_scan); | 3174 int src_color = *src_scan; |
| 3299 int blended = bNonseparableBlend | 3175 int blended = bNonseparableBlend |
| 3300 ? blended_colors[color] | 3176 ? blended_colors[color] |
| 3301 : _BLEND(blend_type, back_color, src_color); | 3177 : Blend(blend_type, back_color, src_color); |
| 3302 dest_scan[index] = FX_GAMMA_INVERSE(blended); | 3178 dest_scan[index] = blended; |
| 3303 src_scan++; | 3179 src_scan++; |
| 3304 } | 3180 } |
| 3305 dest_scan += dest_Bpp; | 3181 dest_scan += dest_Bpp; |
| 3306 src_scan += src_gap; | 3182 src_scan += src_gap; |
| 3307 } | 3183 } |
| 3308 } | 3184 } |
| 3309 inline void _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder( | 3185 |
| 3310 uint8_t* dest_scan, | 3186 void CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, |
| 3311 const uint8_t* src_scan, | 3187 const uint8_t* src_scan, |
| 3312 int width, | 3188 int width, |
| 3313 int dest_Bpp, | 3189 int dest_Bpp, |
| 3314 const uint8_t* clip_scan) { | 3190 const uint8_t* clip_scan) { |
| 3315 for (int col = 0; col < width; col++) { | 3191 for (int col = 0; col < width; col++) { |
| 3316 uint8_t src_alpha; | 3192 uint8_t src_alpha; |
| 3317 if (clip_scan) { | 3193 if (clip_scan) { |
| 3318 src_alpha = src_scan[3] * (*clip_scan++) / 255; | 3194 src_alpha = src_scan[3] * (*clip_scan++) / 255; |
| 3319 } else { | 3195 } else { |
| 3320 src_alpha = src_scan[3]; | 3196 src_alpha = src_scan[3]; |
| 3321 } | 3197 } |
| 3322 if (src_alpha == 255) { | 3198 if (src_alpha == 255) { |
| 3323 dest_scan[2] = FX_GAMMA_INVERSE(*src_scan++); | 3199 dest_scan[2] = *src_scan++; |
| 3324 dest_scan[1] = FX_GAMMA_INVERSE(*src_scan++); | 3200 dest_scan[1] = *src_scan++; |
| 3325 dest_scan[0] = FX_GAMMA_INVERSE(*src_scan++); | 3201 dest_scan[0] = *src_scan++; |
| 3326 dest_scan += dest_Bpp; | 3202 dest_scan += dest_Bpp; |
| 3327 src_scan++; | 3203 src_scan++; |
| 3328 continue; | 3204 continue; |
| 3329 } | 3205 } |
| 3330 if (src_alpha == 0) { | 3206 if (src_alpha == 0) { |
| 3331 dest_scan += dest_Bpp; | 3207 dest_scan += dest_Bpp; |
| 3332 src_scan += 4; | 3208 src_scan += 4; |
| 3333 continue; | 3209 continue; |
| 3334 } | 3210 } |
| 3335 for (int color = 0; color < 3; color++) { | 3211 for (int color = 0; color < 3; color++) { |
| 3336 int index = 2 - color; | 3212 int index = 2 - color; |
| 3337 dest_scan[index] = FX_GAMMA_INVERSE( | 3213 dest_scan[index] = |
| 3338 FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[index]), *src_scan, src_alpha)); | 3214 FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, src_alpha); |
| 3339 src_scan++; | 3215 src_scan++; |
| 3340 } | 3216 } |
| 3341 dest_scan += dest_Bpp; | 3217 dest_scan += dest_Bpp; |
| 3342 src_scan++; | 3218 src_scan++; |
| 3343 } | 3219 } |
| 3344 } | 3220 } |
| 3345 inline void _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder( | 3221 |
| 3346 uint8_t* dest_scan, | 3222 void CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder(uint8_t* dest_scan, |
| 3347 const uint8_t* src_scan, | 3223 const uint8_t* src_scan, |
| 3348 int width, | 3224 int width, |
| 3349 int dest_Bpp, | 3225 int dest_Bpp, |
| 3350 int src_Bpp) { | 3226 int src_Bpp) { |
| 3351 for (int col = 0; col < width; col++) { | 3227 for (int col = 0; col < width; col++) { |
| 3352 dest_scan[2] = src_scan[0]; | 3228 dest_scan[2] = src_scan[0]; |
| 3353 dest_scan[1] = src_scan[1]; | 3229 dest_scan[1] = src_scan[1]; |
| 3354 dest_scan[0] = src_scan[2]; | 3230 dest_scan[0] = src_scan[2]; |
| 3355 dest_scan += dest_Bpp; | 3231 dest_scan += dest_Bpp; |
| 3356 src_scan += src_Bpp; | 3232 src_scan += src_Bpp; |
| 3357 } | 3233 } |
| 3358 } | 3234 } |
| 3359 inline void _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder( | 3235 |
| 3360 uint8_t* dest_scan, | 3236 void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3361 const uint8_t* src_scan, | 3237 const uint8_t* src_scan, |
| 3362 int width, | 3238 int width, |
| 3363 int blend_type, | 3239 int blend_type, |
| 3364 int src_Bpp, | 3240 int src_Bpp, |
| 3365 const uint8_t* clip_scan) { | 3241 const uint8_t* clip_scan) { |
| 3366 int blended_colors[3]; | 3242 int blended_colors[3]; |
| 3367 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3243 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3368 int src_gap = src_Bpp - 3; | 3244 int src_gap = src_Bpp - 3; |
| 3369 for (int col = 0; col < width; col++) { | 3245 for (int col = 0; col < width; col++) { |
| 3370 int src_alpha = *clip_scan++; | 3246 int src_alpha = *clip_scan++; |
| 3371 uint8_t back_alpha = dest_scan[3]; | 3247 uint8_t back_alpha = dest_scan[3]; |
| 3372 if (back_alpha == 0) { | 3248 if (back_alpha == 0) { |
| 3373 dest_scan[2] = FX_GAMMA(*src_scan++); | 3249 dest_scan[2] = *src_scan++; |
| 3374 dest_scan[1] = FX_GAMMA(*src_scan++); | 3250 dest_scan[1] = *src_scan++; |
| 3375 dest_scan[0] = FX_GAMMA(*src_scan++); | 3251 dest_scan[0] = *src_scan++; |
| 3376 src_scan += src_gap; | 3252 src_scan += src_gap; |
| 3377 dest_scan += 4; | 3253 dest_scan += 4; |
| 3378 continue; | 3254 continue; |
| 3379 } | 3255 } |
| 3380 if (src_alpha == 0) { | 3256 if (src_alpha == 0) { |
| 3381 dest_scan += 4; | 3257 dest_scan += 4; |
| 3382 src_scan += src_Bpp; | 3258 src_scan += src_Bpp; |
| 3383 continue; | 3259 continue; |
| 3384 } | 3260 } |
| 3385 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3261 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3386 dest_scan[3] = dest_alpha; | 3262 dest_scan[3] = dest_alpha; |
| 3387 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3263 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3388 if (bNonseparableBlend) { | 3264 if (bNonseparableBlend) { |
| 3389 uint8_t dest_scan_o[3]; | 3265 uint8_t dest_scan_o[3]; |
| 3390 dest_scan_o[0] = dest_scan[2]; | 3266 dest_scan_o[0] = dest_scan[2]; |
| 3391 dest_scan_o[1] = dest_scan[1]; | 3267 dest_scan_o[1] = dest_scan[1]; |
| 3392 dest_scan_o[2] = dest_scan[0]; | 3268 dest_scan_o[2] = dest_scan[0]; |
| 3393 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3269 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3394 } | 3270 } |
| 3395 for (int color = 0; color < 3; color++) { | 3271 for (int color = 0; color < 3; color++) { |
| 3396 int index = 2 - color; | 3272 int index = 2 - color; |
| 3397 int src_color = FX_GAMMA(*src_scan); | 3273 int src_color = *src_scan; |
| 3398 int blended = bNonseparableBlend | 3274 int blended = bNonseparableBlend |
| 3399 ? blended_colors[color] | 3275 ? blended_colors[color] |
| 3400 : _BLEND(blend_type, dest_scan[index], src_color); | 3276 : Blend(blend_type, dest_scan[index], src_color); |
| 3401 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); | 3277 blended = FXDIB_ALPHA_MERGE(src_color, blended, back_alpha); |
| 3402 dest_scan[index] = | 3278 dest_scan[index] = |
| 3403 FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio); | 3279 FXDIB_ALPHA_MERGE(dest_scan[index], blended, alpha_ratio); |
| 3404 src_scan++; | 3280 src_scan++; |
| 3405 } | 3281 } |
| 3406 dest_scan += 4; | 3282 dest_scan += 4; |
| 3407 src_scan += src_gap; | 3283 src_scan += src_gap; |
| 3408 } | 3284 } |
| 3409 } | 3285 } |
| 3410 inline void _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder( | 3286 |
| 3411 uint8_t* dest_scan, | 3287 void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3412 const uint8_t* src_scan, | 3288 const uint8_t* src_scan, |
| 3413 int width, | 3289 int width, |
| 3414 int blend_type, | 3290 int blend_type, |
| 3415 int dest_Bpp, | 3291 int dest_Bpp, |
| 3416 int src_Bpp, | 3292 int src_Bpp, |
| 3417 const uint8_t* clip_scan) { | 3293 const uint8_t* clip_scan) { |
| 3418 int blended_colors[3]; | 3294 int blended_colors[3]; |
| 3419 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; | 3295 FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; |
| 3420 int src_gap = src_Bpp - 3; | 3296 int src_gap = src_Bpp - 3; |
| 3421 for (int col = 0; col < width; col++) { | 3297 for (int col = 0; col < width; col++) { |
| 3422 uint8_t src_alpha = *clip_scan++; | 3298 uint8_t src_alpha = *clip_scan++; |
| 3423 if (src_alpha == 0) { | 3299 if (src_alpha == 0) { |
| 3424 dest_scan += dest_Bpp; | 3300 dest_scan += dest_Bpp; |
| 3425 src_scan += src_Bpp; | 3301 src_scan += src_Bpp; |
| 3426 continue; | 3302 continue; |
| 3427 } | 3303 } |
| 3428 if (bNonseparableBlend) { | 3304 if (bNonseparableBlend) { |
| 3429 uint8_t dest_scan_o[3]; | 3305 uint8_t dest_scan_o[3]; |
| 3430 dest_scan_o[0] = dest_scan[2]; | 3306 dest_scan_o[0] = dest_scan[2]; |
| 3431 dest_scan_o[1] = dest_scan[1]; | 3307 dest_scan_o[1] = dest_scan[1]; |
| 3432 dest_scan_o[2] = dest_scan[0]; | 3308 dest_scan_o[2] = dest_scan[0]; |
| 3433 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3309 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3434 } | 3310 } |
| 3435 for (int color = 0; color < 3; color++) { | 3311 for (int color = 0; color < 3; color++) { |
| 3436 int index = 2 - color; | 3312 int index = 2 - color; |
| 3437 int src_color = FX_GAMMA(*src_scan); | 3313 int src_color = *src_scan; |
| 3438 int back_color = FX_GAMMA(dest_scan[index]); | 3314 int back_color = dest_scan[index]; |
| 3439 int blended = bNonseparableBlend | 3315 int blended = bNonseparableBlend |
| 3440 ? blended_colors[color] | 3316 ? blended_colors[color] |
| 3441 : _BLEND(blend_type, back_color, src_color); | 3317 : Blend(blend_type, back_color, src_color); |
| 3442 dest_scan[index] = | 3318 dest_scan[index] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3443 FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blended, src_alpha)); | |
| 3444 src_scan++; | 3319 src_scan++; |
| 3445 } | 3320 } |
| 3446 dest_scan += dest_Bpp; | 3321 dest_scan += dest_Bpp; |
| 3447 src_scan += src_gap; | 3322 src_scan += src_gap; |
| 3448 } | 3323 } |
| 3449 } | 3324 } |
| 3450 inline void _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder( | 3325 |
| 3451 uint8_t* dest_scan, | 3326 void CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3452 const uint8_t* src_scan, | 3327 const uint8_t* src_scan, |
| 3453 int width, | 3328 int width, |
| 3454 int src_Bpp, | 3329 int src_Bpp, |
| 3455 const uint8_t* clip_scan) { | 3330 const uint8_t* clip_scan) { |
| 3456 int src_gap = src_Bpp - 3; | 3331 int src_gap = src_Bpp - 3; |
| 3457 for (int col = 0; col < width; col++) { | 3332 for (int col = 0; col < width; col++) { |
| 3458 int src_alpha = clip_scan[col]; | 3333 int src_alpha = clip_scan[col]; |
| 3459 if (src_alpha == 255) { | 3334 if (src_alpha == 255) { |
| 3460 dest_scan[2] = FX_GAMMA(*src_scan++); | 3335 dest_scan[2] = *src_scan++; |
| 3461 dest_scan[1] = FX_GAMMA(*src_scan++); | 3336 dest_scan[1] = *src_scan++; |
| 3462 dest_scan[0] = FX_GAMMA(*src_scan++); | 3337 dest_scan[0] = *src_scan++; |
| 3463 dest_scan[3] = 255; | 3338 dest_scan[3] = 255; |
| 3464 dest_scan += 4; | 3339 dest_scan += 4; |
| 3465 src_scan += src_gap; | 3340 src_scan += src_gap; |
| 3466 continue; | 3341 continue; |
| 3467 } | 3342 } |
| 3468 if (src_alpha == 0) { | 3343 if (src_alpha == 0) { |
| 3469 dest_scan += 4; | 3344 dest_scan += 4; |
| 3470 src_scan += src_Bpp; | 3345 src_scan += src_Bpp; |
| 3471 continue; | 3346 continue; |
| 3472 } | 3347 } |
| 3473 int back_alpha = dest_scan[3]; | 3348 int back_alpha = dest_scan[3]; |
| 3474 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3349 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3475 dest_scan[3] = dest_alpha; | 3350 dest_scan[3] = dest_alpha; |
| 3476 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3351 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3477 for (int color = 0; color < 3; color++) { | 3352 for (int color = 0; color < 3; color++) { |
| 3478 int index = 2 - color; | 3353 int index = 2 - color; |
| 3479 dest_scan[index] = | 3354 dest_scan[index] = |
| 3480 FXDIB_ALPHA_MERGE(dest_scan[index], FX_GAMMA(*src_scan), alpha_ratio); | 3355 FXDIB_ALPHA_MERGE(dest_scan[index], *src_scan, alpha_ratio); |
| 3481 src_scan++; | 3356 src_scan++; |
| 3482 } | 3357 } |
| 3483 dest_scan += 4; | 3358 dest_scan += 4; |
| 3484 src_scan += src_gap; | 3359 src_scan += src_gap; |
| 3485 } | 3360 } |
| 3486 } | 3361 } |
| 3487 inline void _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder( | 3362 |
| 3488 uint8_t* dest_scan, | 3363 void CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder(uint8_t* dest_scan, |
| 3489 const uint8_t* src_scan, | 3364 const uint8_t* src_scan, |
| 3490 int width, | 3365 int width, |
| 3491 int dest_Bpp, | 3366 int dest_Bpp, |
| 3492 int src_Bpp, | 3367 int src_Bpp, |
| 3493 const uint8_t* clip_scan) { | 3368 const uint8_t* clip_scan) { |
| 3494 for (int col = 0; col < width; col++) { | 3369 for (int col = 0; col < width; col++) { |
| 3495 int src_alpha = clip_scan[col]; | 3370 int src_alpha = clip_scan[col]; |
| 3496 if (src_alpha == 255) { | 3371 if (src_alpha == 255) { |
| 3497 dest_scan[2] = src_scan[0]; | 3372 dest_scan[2] = src_scan[0]; |
| 3498 dest_scan[1] = src_scan[1]; | 3373 dest_scan[1] = src_scan[1]; |
| 3499 dest_scan[0] = src_scan[2]; | 3374 dest_scan[0] = src_scan[2]; |
| 3500 } else if (src_alpha) { | 3375 } else if (src_alpha) { |
| 3501 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE( | 3376 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], *src_scan, src_alpha); |
| 3502 FX_GAMMA(dest_scan[2]), FX_GAMMA(*src_scan), src_alpha)); | |
| 3503 src_scan++; | 3377 src_scan++; |
| 3504 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE( | 3378 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], *src_scan, src_alpha); |
| 3505 FX_GAMMA(dest_scan[1]), FX_GAMMA(*src_scan), src_alpha)); | |
| 3506 src_scan++; | 3379 src_scan++; |
| 3507 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE( | 3380 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], *src_scan, src_alpha); |
| 3508 FX_GAMMA(dest_scan[0]), FX_GAMMA(*src_scan), src_alpha)); | |
| 3509 dest_scan += dest_Bpp; | 3381 dest_scan += dest_Bpp; |
| 3510 src_scan += src_Bpp - 2; | 3382 src_scan += src_Bpp - 2; |
| 3511 continue; | 3383 continue; |
| 3512 } | 3384 } |
| 3513 dest_scan += dest_Bpp; | 3385 dest_scan += dest_Bpp; |
| 3514 src_scan += src_Bpp; | 3386 src_scan += src_Bpp; |
| 3515 } | 3387 } |
| 3516 } | 3388 } |
| 3517 inline void _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder( | 3389 |
| 3518 uint8_t* dest_scan, | 3390 void CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, |
| 3519 const uint8_t* src_scan, | 3391 const uint8_t* src_scan, |
| 3520 FX_ARGB* pPalette, | 3392 FX_ARGB* pPalette, |
| 3521 int pixel_count, | 3393 int pixel_count, |
| 3522 int DestBpp, | 3394 int DestBpp, |
| 3523 const uint8_t* clip_scan) { | 3395 const uint8_t* clip_scan) { |
| 3524 for (int col = 0; col < pixel_count; col++) { | 3396 for (int col = 0; col < pixel_count; col++) { |
| 3525 FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; | 3397 FX_ARGB argb = pPalette ? pPalette[*src_scan] : (*src_scan) * 0x010101; |
| 3526 int src_r = FXARGB_R(argb); | 3398 int src_r = FXARGB_R(argb); |
| 3527 int src_g = FXARGB_G(argb); | 3399 int src_g = FXARGB_G(argb); |
| 3528 int src_b = FXARGB_B(argb); | 3400 int src_b = FXARGB_B(argb); |
| 3529 if (clip_scan && clip_scan[col] < 255) { | 3401 if (clip_scan && clip_scan[col] < 255) { |
| 3530 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]); | 3402 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, clip_scan[col]); |
| 3531 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]); | 3403 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]); |
| 3532 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]); | 3404 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]); |
| 3533 } else { | 3405 } else { |
| 3534 dest_scan[2] = src_b; | 3406 dest_scan[2] = src_b; |
| 3535 dest_scan[1] = src_g; | 3407 dest_scan[1] = src_g; |
| 3536 dest_scan[0] = src_r; | 3408 dest_scan[0] = src_r; |
| 3537 } | 3409 } |
| 3538 dest_scan += DestBpp; | 3410 dest_scan += DestBpp; |
| 3539 src_scan++; | 3411 src_scan++; |
| 3540 } | 3412 } |
| 3541 } | 3413 } |
| 3542 inline void _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder( | 3414 |
| 3543 uint8_t* dest_scan, | 3415 void CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(uint8_t* dest_scan, |
| 3544 const uint8_t* src_scan, | 3416 const uint8_t* src_scan, |
| 3545 int src_left, | 3417 int src_left, |
| 3546 FX_ARGB* pPalette, | 3418 FX_ARGB* pPalette, |
| 3547 int pixel_count, | 3419 int pixel_count, |
| 3548 int DestBpp, | 3420 int DestBpp, |
| 3549 const uint8_t* clip_scan) { | 3421 const uint8_t* clip_scan) { |
| 3550 int reset_r, reset_g, reset_b; | 3422 int reset_r, reset_g, reset_b; |
| 3551 int set_r, set_g, set_b; | 3423 int set_r, set_g, set_b; |
| 3552 if (pPalette) { | 3424 if (pPalette) { |
| 3553 reset_r = FXARGB_R(pPalette[0]); | 3425 reset_r = FXARGB_R(pPalette[0]); |
| 3554 reset_g = FXARGB_G(pPalette[0]); | 3426 reset_g = FXARGB_G(pPalette[0]); |
| 3555 reset_b = FXARGB_B(pPalette[0]); | 3427 reset_b = FXARGB_B(pPalette[0]); |
| 3556 set_r = FXARGB_R(pPalette[1]); | 3428 set_r = FXARGB_R(pPalette[1]); |
| 3557 set_g = FXARGB_G(pPalette[1]); | 3429 set_g = FXARGB_G(pPalette[1]); |
| 3558 set_b = FXARGB_B(pPalette[1]); | 3430 set_b = FXARGB_B(pPalette[1]); |
| 3559 } else { | 3431 } else { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3576 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]); | 3448 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, clip_scan[col]); |
| 3577 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]); | 3449 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, clip_scan[col]); |
| 3578 } else { | 3450 } else { |
| 3579 dest_scan[2] = src_b; | 3451 dest_scan[2] = src_b; |
| 3580 dest_scan[1] = src_g; | 3452 dest_scan[1] = src_g; |
| 3581 dest_scan[0] = src_r; | 3453 dest_scan[0] = src_r; |
| 3582 } | 3454 } |
| 3583 dest_scan += DestBpp; | 3455 dest_scan += DestBpp; |
| 3584 } | 3456 } |
| 3585 } | 3457 } |
| 3586 inline void _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder( | 3458 |
| 3587 uint8_t* dest_scan, | 3459 void CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, |
| 3588 const uint8_t* src_scan, | 3460 const uint8_t* src_scan, |
| 3589 int width, | 3461 int width, |
| 3590 FX_ARGB* pPalette, | 3462 FX_ARGB* pPalette, |
| 3591 const uint8_t* clip_scan) { | 3463 const uint8_t* clip_scan) { |
| 3592 for (int col = 0; col < width; col++) { | 3464 for (int col = 0; col < width; col++) { |
| 3593 int src_r, src_g, src_b; | 3465 int src_r, src_g, src_b; |
| 3594 if (pPalette) { | 3466 if (pPalette) { |
| 3595 FX_ARGB argb = pPalette[*src_scan]; | 3467 FX_ARGB argb = pPalette[*src_scan]; |
| 3596 src_r = FXARGB_R(argb); | 3468 src_r = FXARGB_R(argb); |
| 3597 src_g = FXARGB_G(argb); | 3469 src_g = FXARGB_G(argb); |
| 3598 src_b = FXARGB_B(argb); | 3470 src_b = FXARGB_B(argb); |
| 3599 } else { | 3471 } else { |
| 3600 src_r = src_g = src_b = *src_scan; | 3472 src_r = src_g = src_b = *src_scan; |
| 3601 } | 3473 } |
| 3602 if (!clip_scan || clip_scan[col] == 255) { | 3474 if (!clip_scan || clip_scan[col] == 255) { |
| 3603 dest_scan[2] = FX_GAMMA(src_b); | 3475 dest_scan[2] = src_b; |
| 3604 dest_scan[1] = FX_GAMMA(src_g); | 3476 dest_scan[1] = src_g; |
| 3605 dest_scan[0] = FX_GAMMA(src_r); | 3477 dest_scan[0] = src_r; |
| 3606 dest_scan[3] = 255; | 3478 dest_scan[3] = 255; |
| 3607 src_scan++; | 3479 src_scan++; |
| 3608 dest_scan += 4; | 3480 dest_scan += 4; |
| 3609 continue; | 3481 continue; |
| 3610 } | 3482 } |
| 3611 int src_alpha = clip_scan[col]; | 3483 int src_alpha = clip_scan[col]; |
| 3612 if (src_alpha == 0) { | 3484 if (src_alpha == 0) { |
| 3613 dest_scan += 4; | 3485 dest_scan += 4; |
| 3614 src_scan++; | 3486 src_scan++; |
| 3615 continue; | 3487 continue; |
| 3616 } | 3488 } |
| 3617 int back_alpha = dest_scan[3]; | 3489 int back_alpha = dest_scan[3]; |
| 3618 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3490 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3619 dest_scan[3] = dest_alpha; | 3491 dest_scan[3] = dest_alpha; |
| 3620 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3492 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3621 dest_scan[2] = | 3493 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
| 3622 FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); | 3494 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
| 3623 dest_scan[1] = | 3495 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
| 3624 FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ratio); | |
| 3625 dest_scan[0] = | |
| 3626 FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ratio); | |
| 3627 dest_scan += 4; | 3496 dest_scan += 4; |
| 3628 src_scan++; | 3497 src_scan++; |
| 3629 } | 3498 } |
| 3630 } | 3499 } |
| 3631 inline void _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder( | 3500 |
| 3632 uint8_t* dest_scan, | 3501 void CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(uint8_t* dest_scan, |
| 3633 const uint8_t* src_scan, | 3502 const uint8_t* src_scan, |
| 3634 int src_left, | 3503 int src_left, |
| 3635 int width, | 3504 int width, |
| 3636 FX_ARGB* pPalette, | 3505 FX_ARGB* pPalette, |
| 3637 const uint8_t* clip_scan) { | 3506 const uint8_t* clip_scan) { |
| 3638 int reset_r, reset_g, reset_b; | 3507 int reset_r, reset_g, reset_b; |
| 3639 int set_r, set_g, set_b; | 3508 int set_r, set_g, set_b; |
| 3640 if (pPalette) { | 3509 if (pPalette) { |
| 3641 reset_r = FXARGB_R(pPalette[0]); | 3510 reset_r = FXARGB_R(pPalette[0]); |
| 3642 reset_g = FXARGB_G(pPalette[0]); | 3511 reset_g = FXARGB_G(pPalette[0]); |
| 3643 reset_b = FXARGB_B(pPalette[0]); | 3512 reset_b = FXARGB_B(pPalette[0]); |
| 3644 set_r = FXARGB_R(pPalette[1]); | 3513 set_r = FXARGB_R(pPalette[1]); |
| 3645 set_g = FXARGB_G(pPalette[1]); | 3514 set_g = FXARGB_G(pPalette[1]); |
| 3646 set_b = FXARGB_B(pPalette[1]); | 3515 set_b = FXARGB_B(pPalette[1]); |
| 3647 } else { | 3516 } else { |
| 3648 reset_r = reset_g = reset_b = 0; | 3517 reset_r = reset_g = reset_b = 0; |
| 3649 set_r = set_g = set_b = 255; | 3518 set_r = set_g = set_b = 255; |
| 3650 } | 3519 } |
| 3651 for (int col = 0; col < width; col++) { | 3520 for (int col = 0; col < width; col++) { |
| 3652 int src_r, src_g, src_b; | 3521 int src_r, src_g, src_b; |
| 3653 if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) { | 3522 if (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) { |
| 3654 src_r = set_r; | 3523 src_r = set_r; |
| 3655 src_g = set_g; | 3524 src_g = set_g; |
| 3656 src_b = set_b; | 3525 src_b = set_b; |
| 3657 } else { | 3526 } else { |
| 3658 src_r = reset_r; | 3527 src_r = reset_r; |
| 3659 src_g = reset_g; | 3528 src_g = reset_g; |
| 3660 src_b = reset_b; | 3529 src_b = reset_b; |
| 3661 } | 3530 } |
| 3662 if (!clip_scan || clip_scan[col] == 255) { | 3531 if (!clip_scan || clip_scan[col] == 255) { |
| 3663 dest_scan[2] = FX_GAMMA(src_b); | 3532 dest_scan[2] = src_b; |
| 3664 dest_scan[1] = FX_GAMMA(src_g); | 3533 dest_scan[1] = src_g; |
| 3665 dest_scan[0] = FX_GAMMA(src_r); | 3534 dest_scan[0] = src_r; |
| 3666 dest_scan[3] = 255; | 3535 dest_scan[3] = 255; |
| 3667 dest_scan += 4; | 3536 dest_scan += 4; |
| 3668 continue; | 3537 continue; |
| 3669 } | 3538 } |
| 3670 int src_alpha = clip_scan[col]; | 3539 int src_alpha = clip_scan[col]; |
| 3671 if (src_alpha == 0) { | 3540 if (src_alpha == 0) { |
| 3672 dest_scan += 4; | 3541 dest_scan += 4; |
| 3673 continue; | 3542 continue; |
| 3674 } | 3543 } |
| 3675 int back_alpha = dest_scan[3]; | 3544 int back_alpha = dest_scan[3]; |
| 3676 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; | 3545 uint8_t dest_alpha = back_alpha + src_alpha - back_alpha * src_alpha / 255; |
| 3677 dest_scan[3] = dest_alpha; | 3546 dest_scan[3] = dest_alpha; |
| 3678 int alpha_ratio = src_alpha * 255 / dest_alpha; | 3547 int alpha_ratio = src_alpha * 255 / dest_alpha; |
| 3679 dest_scan[2] = | 3548 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
| 3680 FXDIB_ALPHA_MERGE(dest_scan[2], FX_GAMMA(src_b), alpha_ratio); | 3549 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
| 3681 dest_scan[1] = | 3550 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
| 3682 FXDIB_ALPHA_MERGE(dest_scan[1], FX_GAMMA(src_g), alpha_ratio); | |
| 3683 dest_scan[0] = | |
| 3684 FXDIB_ALPHA_MERGE(dest_scan[0], FX_GAMMA(src_r), alpha_ratio); | |
| 3685 dest_scan += 4; | 3551 dest_scan += 4; |
| 3686 } | 3552 } |
| 3687 } | 3553 } |
| 3688 void _CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, | 3554 |
| 3689 const uint8_t* src_scan, | 3555 void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan, |
| 3690 int mask_alpha, | 3556 const uint8_t* src_scan, |
| 3691 int src_r, | 3557 int mask_alpha, |
| 3692 int src_g, | 3558 int src_r, |
| 3693 int src_b, | 3559 int src_g, |
| 3694 int pixel_count, | 3560 int src_b, |
| 3695 int blend_type, | 3561 int pixel_count, |
| 3696 const uint8_t* clip_scan) { | 3562 int blend_type, |
| 3563 const uint8_t* clip_scan) { |
| 3697 for (int col = 0; col < pixel_count; col++) { | 3564 for (int col = 0; col < pixel_count; col++) { |
| 3698 int src_alpha; | 3565 int src_alpha; |
| 3699 if (clip_scan) { | 3566 if (clip_scan) { |
| 3700 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 3567 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 3701 } else { | 3568 } else { |
| 3702 src_alpha = mask_alpha * src_scan[col] / 255; | 3569 src_alpha = mask_alpha * src_scan[col] / 255; |
| 3703 } | 3570 } |
| 3704 uint8_t back_alpha = dest_scan[3]; | 3571 uint8_t back_alpha = dest_scan[3]; |
| 3705 if (back_alpha == 0) { | 3572 if (back_alpha == 0) { |
| 3706 FXARGB_SETRGBORDERDIB(dest_scan, | 3573 FXARGB_SETRGBORDERDIB(dest_scan, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 3718 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3585 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3719 int blended_colors[3]; | 3586 int blended_colors[3]; |
| 3720 uint8_t src_scan[3]; | 3587 uint8_t src_scan[3]; |
| 3721 uint8_t dest_scan_o[3]; | 3588 uint8_t dest_scan_o[3]; |
| 3722 src_scan[0] = src_b; | 3589 src_scan[0] = src_b; |
| 3723 src_scan[1] = src_g; | 3590 src_scan[1] = src_g; |
| 3724 src_scan[2] = src_r; | 3591 src_scan[2] = src_r; |
| 3725 dest_scan_o[0] = dest_scan[2]; | 3592 dest_scan_o[0] = dest_scan[2]; |
| 3726 dest_scan_o[1] = dest_scan[1]; | 3593 dest_scan_o[1] = dest_scan[1]; |
| 3727 dest_scan_o[2] = dest_scan[0]; | 3594 dest_scan_o[2] = dest_scan[0]; |
| 3728 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3595 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3729 dest_scan[2] = | 3596 dest_scan[2] = |
| 3730 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 3597 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
| 3731 dest_scan[1] = | 3598 dest_scan[1] = |
| 3732 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 3599 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |
| 3733 dest_scan[0] = | 3600 dest_scan[0] = |
| 3734 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 3601 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |
| 3735 } else if (blend_type) { | 3602 } else if (blend_type) { |
| 3736 int blended = _BLEND(blend_type, dest_scan[2], src_b); | 3603 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3737 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 3604 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 3738 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 3605 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); |
| 3739 blended = _BLEND(blend_type, dest_scan[1], src_g); | 3606 blended = Blend(blend_type, dest_scan[1], src_g); |
| 3740 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | 3607 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); |
| 3741 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio); | 3608 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio); |
| 3742 blended = _BLEND(blend_type, dest_scan[0], src_r); | 3609 blended = Blend(blend_type, dest_scan[0], src_r); |
| 3743 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 3610 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
| 3744 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio); | 3611 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio); |
| 3745 } else { | 3612 } else { |
| 3746 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); | 3613 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
| 3747 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); | 3614 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
| 3748 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); | 3615 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
| 3749 } | 3616 } |
| 3750 dest_scan += 4; | 3617 dest_scan += 4; |
| 3751 } | 3618 } |
| 3752 } | 3619 } |
| 3753 void _CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, | 3620 |
| 3754 const uint8_t* src_scan, | 3621 void CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan, |
| 3755 int mask_alpha, | 3622 const uint8_t* src_scan, |
| 3756 int src_r, | 3623 int mask_alpha, |
| 3757 int src_g, | 3624 int src_r, |
| 3758 int src_b, | 3625 int src_g, |
| 3759 int pixel_count, | 3626 int src_b, |
| 3760 int blend_type, | 3627 int pixel_count, |
| 3761 int Bpp, | 3628 int blend_type, |
| 3762 const uint8_t* clip_scan) { | 3629 int Bpp, |
| 3630 const uint8_t* clip_scan) { |
| 3763 for (int col = 0; col < pixel_count; col++) { | 3631 for (int col = 0; col < pixel_count; col++) { |
| 3764 int src_alpha; | 3632 int src_alpha; |
| 3765 if (clip_scan) { | 3633 if (clip_scan) { |
| 3766 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; | 3634 src_alpha = mask_alpha * clip_scan[col] * src_scan[col] / 255 / 255; |
| 3767 } else { | 3635 } else { |
| 3768 src_alpha = mask_alpha * src_scan[col] / 255; | 3636 src_alpha = mask_alpha * src_scan[col] / 255; |
| 3769 } | 3637 } |
| 3770 if (src_alpha == 0) { | 3638 if (src_alpha == 0) { |
| 3771 dest_scan += Bpp; | 3639 dest_scan += Bpp; |
| 3772 continue; | 3640 continue; |
| 3773 } | 3641 } |
| 3774 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3642 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3775 int blended_colors[3]; | 3643 int blended_colors[3]; |
| 3776 uint8_t src_scan[3]; | 3644 uint8_t src_scan[3]; |
| 3777 uint8_t dest_scan_o[3]; | 3645 uint8_t dest_scan_o[3]; |
| 3778 src_scan[0] = src_b; | 3646 src_scan[0] = src_b; |
| 3779 src_scan[1] = src_g; | 3647 src_scan[1] = src_g; |
| 3780 src_scan[2] = src_r; | 3648 src_scan[2] = src_r; |
| 3781 dest_scan_o[0] = dest_scan[2]; | 3649 dest_scan_o[0] = dest_scan[2]; |
| 3782 dest_scan_o[1] = dest_scan[1]; | 3650 dest_scan_o[1] = dest_scan[1]; |
| 3783 dest_scan_o[2] = dest_scan[0]; | 3651 dest_scan_o[2] = dest_scan[0]; |
| 3784 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3652 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3785 dest_scan[2] = | 3653 dest_scan[2] = |
| 3786 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 3654 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
| 3787 dest_scan[1] = | 3655 dest_scan[1] = |
| 3788 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 3656 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |
| 3789 dest_scan[0] = | 3657 dest_scan[0] = |
| 3790 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 3658 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |
| 3791 } else if (blend_type) { | 3659 } else if (blend_type) { |
| 3792 int blended = _BLEND(blend_type, dest_scan[2], src_b); | 3660 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3793 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); | 3661 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, src_alpha); |
| 3794 blended = _BLEND(blend_type, dest_scan[1], src_g); | 3662 blended = Blend(blend_type, dest_scan[1], src_g); |
| 3795 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, src_alpha); | 3663 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, src_alpha); |
| 3796 blended = _BLEND(blend_type, dest_scan[0], src_r); | 3664 blended = Blend(blend_type, dest_scan[0], src_r); |
| 3797 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha); | 3665 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, src_alpha); |
| 3798 } else { | 3666 } else { |
| 3799 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); | 3667 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); |
| 3800 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); | 3668 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); |
| 3801 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); | 3669 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); |
| 3802 } | 3670 } |
| 3803 dest_scan += Bpp; | 3671 dest_scan += Bpp; |
| 3804 } | 3672 } |
| 3805 } | 3673 } |
| 3806 void _CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, | 3674 |
| 3807 const uint8_t* src_scan, | 3675 void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan, |
| 3808 int mask_alpha, | 3676 const uint8_t* src_scan, |
| 3809 int src_r, | 3677 int mask_alpha, |
| 3810 int src_g, | 3678 int src_r, |
| 3811 int src_b, | 3679 int src_g, |
| 3812 int src_left, | 3680 int src_b, |
| 3813 int pixel_count, | 3681 int src_left, |
| 3814 int blend_type, | 3682 int pixel_count, |
| 3815 const uint8_t* clip_scan) { | 3683 int blend_type, |
| 3684 const uint8_t* clip_scan) { |
| 3816 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { | 3685 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { |
| 3817 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); | 3686 FX_ARGB argb = FXARGB_MAKE(0xff, src_r, src_g, src_b); |
| 3818 for (int col = 0; col < pixel_count; col++) { | 3687 for (int col = 0; col < pixel_count; col++) { |
| 3819 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { | 3688 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { |
| 3820 FXARGB_SETRGBORDERDIB(dest_scan, argb); | 3689 FXARGB_SETRGBORDERDIB(dest_scan, argb); |
| 3821 } | 3690 } |
| 3822 dest_scan += 4; | 3691 dest_scan += 4; |
| 3823 } | 3692 } |
| 3824 return; | 3693 return; |
| 3825 } | 3694 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3847 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3716 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3848 int blended_colors[3]; | 3717 int blended_colors[3]; |
| 3849 uint8_t src_scan[3]; | 3718 uint8_t src_scan[3]; |
| 3850 uint8_t dest_scan_o[3]; | 3719 uint8_t dest_scan_o[3]; |
| 3851 src_scan[0] = src_b; | 3720 src_scan[0] = src_b; |
| 3852 src_scan[1] = src_g; | 3721 src_scan[1] = src_g; |
| 3853 src_scan[2] = src_r; | 3722 src_scan[2] = src_r; |
| 3854 dest_scan_o[0] = dest_scan[2]; | 3723 dest_scan_o[0] = dest_scan[2]; |
| 3855 dest_scan_o[1] = dest_scan[1]; | 3724 dest_scan_o[1] = dest_scan[1]; |
| 3856 dest_scan_o[2] = dest_scan[0]; | 3725 dest_scan_o[2] = dest_scan[0]; |
| 3857 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3726 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3858 dest_scan[2] = | 3727 dest_scan[2] = |
| 3859 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); | 3728 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio); |
| 3860 dest_scan[1] = | 3729 dest_scan[1] = |
| 3861 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); | 3730 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], alpha_ratio); |
| 3862 dest_scan[0] = | 3731 dest_scan[0] = |
| 3863 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); | 3732 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], alpha_ratio); |
| 3864 } else if (blend_type) { | 3733 } else if (blend_type) { |
| 3865 int blended = _BLEND(blend_type, dest_scan[2], src_b); | 3734 int blended = Blend(blend_type, dest_scan[2], src_b); |
| 3866 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); | 3735 blended = FXDIB_ALPHA_MERGE(src_b, blended, back_alpha); |
| 3867 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); | 3736 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], blended, alpha_ratio); |
| 3868 blended = _BLEND(blend_type, dest_scan[1], src_g); | 3737 blended = Blend(blend_type, dest_scan[1], src_g); |
| 3869 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); | 3738 blended = FXDIB_ALPHA_MERGE(src_g, blended, back_alpha); |
| 3870 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio); | 3739 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], blended, alpha_ratio); |
| 3871 blended = _BLEND(blend_type, dest_scan[0], src_r); | 3740 blended = Blend(blend_type, dest_scan[0], src_r); |
| 3872 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); | 3741 blended = FXDIB_ALPHA_MERGE(src_r, blended, back_alpha); |
| 3873 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio); | 3742 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], blended, alpha_ratio); |
| 3874 } else { | 3743 } else { |
| 3875 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); | 3744 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, alpha_ratio); |
| 3876 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); | 3745 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, alpha_ratio); |
| 3877 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); | 3746 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, alpha_ratio); |
| 3878 } | 3747 } |
| 3879 dest_scan += 4; | 3748 dest_scan += 4; |
| 3880 } | 3749 } |
| 3881 } | 3750 } |
| 3882 void _CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, | 3751 |
| 3883 const uint8_t* src_scan, | 3752 void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, |
| 3884 int mask_alpha, | 3753 const uint8_t* src_scan, |
| 3885 int src_r, | 3754 int mask_alpha, |
| 3886 int src_g, | 3755 int src_r, |
| 3887 int src_b, | 3756 int src_g, |
| 3888 int src_left, | 3757 int src_b, |
| 3889 int pixel_count, | 3758 int src_left, |
| 3890 int blend_type, | 3759 int pixel_count, |
| 3891 int Bpp, | 3760 int blend_type, |
| 3892 const uint8_t* clip_scan) { | 3761 int Bpp, |
| 3762 const uint8_t* clip_scan) { |
| 3893 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { | 3763 if (blend_type == FXDIB_BLEND_NORMAL && !clip_scan && mask_alpha == 255) { |
| 3894 for (int col = 0; col < pixel_count; col++) { | 3764 for (int col = 0; col < pixel_count; col++) { |
| 3895 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { | 3765 if (src_scan[(src_left + col) / 8] & (1 << (7 - (src_left + col) % 8))) { |
| 3896 dest_scan[2] = src_b; | 3766 dest_scan[2] = src_b; |
| 3897 dest_scan[1] = src_g; | 3767 dest_scan[1] = src_g; |
| 3898 dest_scan[0] = src_r; | 3768 dest_scan[0] = src_r; |
| 3899 } | 3769 } |
| 3900 dest_scan += Bpp; | 3770 dest_scan += Bpp; |
| 3901 } | 3771 } |
| 3902 return; | 3772 return; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3919 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { | 3789 if (blend_type >= FXDIB_BLEND_NONSEPARABLE) { |
| 3920 int blended_colors[3]; | 3790 int blended_colors[3]; |
| 3921 uint8_t src_scan[3]; | 3791 uint8_t src_scan[3]; |
| 3922 uint8_t dest_scan_o[3]; | 3792 uint8_t dest_scan_o[3]; |
| 3923 src_scan[0] = src_b; | 3793 src_scan[0] = src_b; |
| 3924 src_scan[1] = src_g; | 3794 src_scan[1] = src_g; |
| 3925 src_scan[2] = src_r; | 3795 src_scan[2] = src_r; |
| 3926 dest_scan_o[0] = dest_scan[2]; | 3796 dest_scan_o[0] = dest_scan[2]; |
| 3927 dest_scan_o[1] = dest_scan[1]; | 3797 dest_scan_o[1] = dest_scan[1]; |
| 3928 dest_scan_o[2] = dest_scan[0]; | 3798 dest_scan_o[2] = dest_scan[0]; |
| 3929 _RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); | 3799 RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors); |
| 3930 dest_scan[2] = | 3800 dest_scan[2] = |
| 3931 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); | 3801 FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha); |
| 3932 dest_scan[1] = | 3802 dest_scan[1] = |
| 3933 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); | 3803 FXDIB_ALPHA_MERGE(dest_scan[1], blended_colors[1], src_alpha); |
| 3934 dest_scan[0] = | 3804 dest_scan[0] = |
| 3935 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); | 3805 FXDIB_ALPHA_MERGE(dest_scan[0], blended_colors[2], src_alpha); |
| 3936 } else if (blend_type) { | 3806 } else if (blend_type) { |
| 3937 int back_color = FX_GAMMA(dest_scan[2]); | 3807 int back_color = dest_scan[2]; |
| 3938 int blended = _BLEND(blend_type, back_color, src_b); | 3808 int blended = Blend(blend_type, back_color, src_b); |
| 3939 dest_scan[2] = | 3809 dest_scan[2] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3940 FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blended, src_alpha)); | 3810 back_color = dest_scan[1]; |
| 3941 back_color = FX_GAMMA(dest_scan[1]); | 3811 blended = Blend(blend_type, back_color, src_g); |
| 3942 blended = _BLEND(blend_type, back_color, src_g); | 3812 dest_scan[1] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3943 dest_scan[1] = | 3813 back_color = dest_scan[0]; |
| 3944 FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blended, src_alpha)); | 3814 blended = Blend(blend_type, back_color, src_r); |
| 3945 back_color = FX_GAMMA(dest_scan[0]); | 3815 dest_scan[0] = FXDIB_ALPHA_MERGE(back_color, blended, src_alpha); |
| 3946 blended = _BLEND(blend_type, back_color, src_r); | |
| 3947 dest_scan[0] = | |
| 3948 FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(back_color, blended, src_alpha)); | |
| 3949 } else { | 3816 } else { |
| 3950 dest_scan[2] = FX_GAMMA_INVERSE( | 3817 dest_scan[2] = FXDIB_ALPHA_MERGE(dest_scan[2], src_b, src_alpha); |
| 3951 FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[2]), src_b, src_alpha)); | 3818 dest_scan[1] = FXDIB_ALPHA_MERGE(dest_scan[1], src_g, src_alpha); |
| 3952 dest_scan[1] = FX_GAMMA_INVERSE( | 3819 dest_scan[0] = FXDIB_ALPHA_MERGE(dest_scan[0], src_r, src_alpha); |
| 3953 FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[1]), src_g, src_alpha)); | |
| 3954 dest_scan[0] = FX_GAMMA_INVERSE( | |
| 3955 FXDIB_ALPHA_MERGE(FX_GAMMA(dest_scan[0]), src_r, src_alpha)); | |
| 3956 } | 3820 } |
| 3957 dest_scan += Bpp; | 3821 dest_scan += Bpp; |
| 3958 } | 3822 } |
| 3959 } | 3823 } |
| 3960 inline FX_BOOL _ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, | 3824 |
| 3961 int alpha_flag, | 3825 FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, |
| 3962 uint32_t mask_color, | 3826 int alpha_flag, |
| 3963 int& mask_alpha, | 3827 uint32_t mask_color, |
| 3964 int& mask_red, | 3828 int& mask_alpha, |
| 3965 int& mask_green, | 3829 int& mask_red, |
| 3966 int& mask_blue, | 3830 int& mask_green, |
| 3967 int& mask_black, | 3831 int& mask_blue, |
| 3968 CCodec_IccModule* pIccModule, | 3832 int& mask_black, |
| 3969 void* pIccTransform) { | 3833 CCodec_IccModule* pIccModule, |
| 3834 void* pIccTransform) { |
| 3970 if (alpha_flag >> 8) { | 3835 if (alpha_flag >> 8) { |
| 3971 mask_alpha = alpha_flag & 0xff; | 3836 mask_alpha = alpha_flag & 0xff; |
| 3972 mask_red = FXSYS_GetCValue(mask_color); | 3837 mask_red = FXSYS_GetCValue(mask_color); |
| 3973 mask_green = FXSYS_GetMValue(mask_color); | 3838 mask_green = FXSYS_GetMValue(mask_color); |
| 3974 mask_blue = FXSYS_GetYValue(mask_color); | 3839 mask_blue = FXSYS_GetYValue(mask_color); |
| 3975 mask_black = FXSYS_GetKValue(mask_color); | 3840 mask_black = FXSYS_GetKValue(mask_color); |
| 3976 } else { | 3841 } else { |
| 3977 mask_alpha = FXARGB_A(mask_color); | 3842 mask_alpha = FXARGB_A(mask_color); |
| 3978 mask_red = FXARGB_R(mask_color); | 3843 mask_red = FXARGB_R(mask_color); |
| 3979 mask_green = FXARGB_G(mask_color); | 3844 mask_green = FXARGB_G(mask_color); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4016 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2], | 3881 AdobeCMYK_to_sRGB1(mask_color_p[0], mask_color_p[1], mask_color_p[2], |
| 4017 mask_color_p[3], mask_color_p[2], mask_color_p[1], | 3882 mask_color_p[3], mask_color_p[2], mask_color_p[1], |
| 4018 mask_color_p[0]); | 3883 mask_color_p[0]); |
| 4019 mask_red = mask_color_p[2]; | 3884 mask_red = mask_color_p[2]; |
| 4020 mask_green = mask_color_p[1]; | 3885 mask_green = mask_color_p[1]; |
| 4021 mask_blue = mask_color_p[0]; | 3886 mask_blue = mask_color_p[0]; |
| 4022 } | 3887 } |
| 4023 } | 3888 } |
| 4024 return TRUE; | 3889 return TRUE; |
| 4025 } | 3890 } |
| 4026 inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, | 3891 |
| 4027 FXDIB_Format dest_format, | 3892 void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, |
| 4028 uint32_t*& pDestPalette, | 3893 FXDIB_Format dest_format, |
| 4029 uint32_t* pSrcPalette, | 3894 uint32_t*& pDestPalette, |
| 4030 CCodec_IccModule* pIccModule, | 3895 uint32_t* pSrcPalette, |
| 4031 void* pIccTransform) { | 3896 CCodec_IccModule* pIccModule, |
| 3897 void* pIccTransform) { |
| 4032 FX_BOOL isSrcCmyk = !!(src_format & 0x0400); | 3898 FX_BOOL isSrcCmyk = !!(src_format & 0x0400); |
| 4033 FX_BOOL isDstCmyk = !!(dest_format & 0x0400); | 3899 FX_BOOL isDstCmyk = !!(dest_format & 0x0400); |
| 4034 pDestPalette = NULL; | 3900 pDestPalette = nullptr; |
| 4035 if (pIccTransform) { | 3901 if (pIccTransform) { |
| 4036 if (pSrcPalette) { | 3902 if (pSrcPalette) { |
| 4037 if ((dest_format & 0xff) == 8) { | 3903 if ((dest_format & 0xff) == 8) { |
| 4038 int pal_count = 1 << (src_format & 0xff); | 3904 int pal_count = 1 << (src_format & 0xff); |
| 4039 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); | 3905 uint8_t* gray_pal = FX_Alloc(uint8_t, pal_count); |
| 4040 pDestPalette = (uint32_t*)gray_pal; | 3906 pDestPalette = (uint32_t*)gray_pal; |
| 4041 for (int i = 0; i < pal_count; i++) { | 3907 for (int i = 0; i < pal_count; i++) { |
| 4042 uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) | 3908 uint32_t color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) |
| 4043 : FXARGB_TODIB(pSrcPalette[i]); | 3909 : FXARGB_TODIB(pSrcPalette[i]); |
| 4044 pIccModule->TranslateScanline(pIccTransform, gray_pal, | 3910 pIccModule->TranslateScanline(pIccTransform, gray_pal, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), | 4018 AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk), |
| 4153 FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, | 4019 FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, |
| 4154 g, b); | 4020 g, b); |
| 4155 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); | 4021 pDestPalette[i] = FXARGB_MAKE(0xff, r, g, b); |
| 4156 } | 4022 } |
| 4157 } | 4023 } |
| 4158 } | 4024 } |
| 4159 } | 4025 } |
| 4160 } | 4026 } |
| 4161 } | 4027 } |
| 4028 |
| 4029 } // namespace |
| 4030 |
| 4162 CFX_ScanlineCompositor::CFX_ScanlineCompositor() { | 4031 CFX_ScanlineCompositor::CFX_ScanlineCompositor() { |
| 4163 m_pSrcPalette = NULL; | 4032 m_pSrcPalette = nullptr; |
| 4164 m_pCacheScanline = NULL; | 4033 m_pCacheScanline = nullptr; |
| 4165 m_CacheSize = 0; | 4034 m_CacheSize = 0; |
| 4166 m_bRgbByteOrder = FALSE; | 4035 m_bRgbByteOrder = FALSE; |
| 4167 m_BlendType = FXDIB_BLEND_NORMAL; | 4036 m_BlendType = FXDIB_BLEND_NORMAL; |
| 4168 } | 4037 } |
| 4038 |
| 4169 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { | 4039 CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { |
| 4170 FX_Free(m_pSrcPalette); | 4040 FX_Free(m_pSrcPalette); |
| 4171 FX_Free(m_pCacheScanline); | 4041 FX_Free(m_pCacheScanline); |
| 4172 } | 4042 } |
| 4043 |
| 4173 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, | 4044 FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, |
| 4174 FXDIB_Format src_format, | 4045 FXDIB_Format src_format, |
| 4175 int32_t width, | 4046 int32_t width, |
| 4176 uint32_t* pSrcPalette, | 4047 uint32_t* pSrcPalette, |
| 4177 uint32_t mask_color, | 4048 uint32_t mask_color, |
| 4178 int blend_type, | 4049 int blend_type, |
| 4179 FX_BOOL bClip, | 4050 FX_BOOL bClip, |
| 4180 FX_BOOL bRgbByteOrder, | 4051 FX_BOOL bRgbByteOrder, |
| 4181 int alpha_flag, | 4052 int alpha_flag, |
| 4182 void* pIccTransform) { | 4053 void* pIccTransform) { |
| 4183 m_SrcFormat = src_format; | 4054 m_SrcFormat = src_format; |
| 4184 m_DestFormat = dest_format; | 4055 m_DestFormat = dest_format; |
| 4185 m_BlendType = blend_type; | 4056 m_BlendType = blend_type; |
| 4186 m_bRgbByteOrder = bRgbByteOrder; | 4057 m_bRgbByteOrder = bRgbByteOrder; |
| 4187 CCodec_IccModule* pIccModule = nullptr; | 4058 CCodec_IccModule* pIccModule = nullptr; |
| 4188 if (CFX_GEModule::Get()->GetCodecModule()) { | 4059 if (CFX_GEModule::Get()->GetCodecModule()) { |
| 4189 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 4060 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
| 4190 } | 4061 } |
| 4191 if (!pIccModule) { | 4062 if (!pIccModule) { |
| 4192 pIccTransform = NULL; | 4063 pIccTransform = nullptr; |
| 4193 } | 4064 } |
| 4194 m_pIccTransform = pIccTransform; | 4065 m_pIccTransform = pIccTransform; |
| 4195 if ((dest_format & 0xff) == 1) { | 4066 if ((dest_format & 0xff) == 1) { |
| 4196 return FALSE; | 4067 return FALSE; |
| 4197 } | 4068 } |
| 4198 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { | 4069 if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { |
| 4199 return _ScanlineCompositor_InitSourceMask( | 4070 return ScanlineCompositor_InitSourceMask( |
| 4200 dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed, | 4071 dest_format, alpha_flag, mask_color, m_MaskAlpha, m_MaskRed, |
| 4201 m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform); | 4072 m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform); |
| 4202 } | 4073 } |
| 4203 if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) { | 4074 if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) { |
| 4204 return FALSE; | 4075 return FALSE; |
| 4205 } | 4076 } |
| 4206 if ((m_SrcFormat & 0xff) <= 8) { | 4077 if ((m_SrcFormat & 0xff) <= 8) { |
| 4207 if (dest_format == FXDIB_8bppMask) { | 4078 if (dest_format == FXDIB_8bppMask) { |
| 4208 return TRUE; | 4079 return TRUE; |
| 4209 } | 4080 } |
| 4210 _ScanlineCompositor_InitSourcePalette(src_format, dest_format, | 4081 ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette, |
| 4211 m_pSrcPalette, pSrcPalette, | 4082 pSrcPalette, pIccModule, |
| 4212 pIccModule, pIccTransform); | 4083 pIccTransform); |
| 4213 m_Transparency = | 4084 m_Transparency = |
| 4214 (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) + | 4085 (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) + |
| 4215 (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); | 4086 (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); |
| 4216 return TRUE; | 4087 return TRUE; |
| 4217 } | 4088 } |
| 4218 m_Transparency = (src_format & 0x0200 ? 0 : 1) + | 4089 m_Transparency = (src_format & 0x0200 ? 0 : 1) + |
| 4219 (dest_format & 0x0200 ? 0 : 2) + | 4090 (dest_format & 0x0200 ? 0 : 2) + |
| 4220 (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + | 4091 (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + |
| 4221 (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) + | 4092 (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) + |
| 4222 (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); | 4093 (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); |
| 4223 return TRUE; | 4094 return TRUE; |
| 4224 } | 4095 } |
| 4096 |
| 4225 void CFX_ScanlineCompositor::CompositeRgbBitmapLine( | 4097 void CFX_ScanlineCompositor::CompositeRgbBitmapLine( |
| 4226 uint8_t* dest_scan, | 4098 uint8_t* dest_scan, |
| 4227 const uint8_t* src_scan, | 4099 const uint8_t* src_scan, |
| 4228 int width, | 4100 int width, |
| 4229 const uint8_t* clip_scan, | 4101 const uint8_t* clip_scan, |
| 4230 const uint8_t* src_extra_alpha, | 4102 const uint8_t* src_extra_alpha, |
| 4231 uint8_t* dst_extra_alpha) { | 4103 uint8_t* dst_extra_alpha) { |
| 4232 int src_Bpp = (m_SrcFormat & 0xff) >> 3; | 4104 int src_Bpp = (m_SrcFormat & 0xff) >> 3; |
| 4233 int dest_Bpp = (m_DestFormat & 0xff) >> 3; | 4105 int dest_Bpp = (m_DestFormat & 0xff) >> 3; |
| 4234 if (m_bRgbByteOrder) { | 4106 if (m_bRgbByteOrder) { |
| 4235 switch (m_Transparency) { | 4107 switch (m_Transparency) { |
| 4236 case 0: | 4108 case 0: |
| 4237 case 4: | 4109 case 4: |
| 4238 case 8: | 4110 case 8: |
| 4239 case 12: | 4111 case 12: |
| 4240 _CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width, | 4112 CompositeRow_Argb2Argb_RgbByteOrder(dest_scan, src_scan, width, |
| 4241 m_BlendType, clip_scan); | 4113 m_BlendType, clip_scan); |
| 4242 break; | 4114 break; |
| 4243 case 1: | 4115 case 1: |
| 4244 _CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder( | 4116 CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder( |
| 4245 dest_scan, src_scan, width, m_BlendType, src_Bpp); | 4117 dest_scan, src_scan, width, m_BlendType, src_Bpp); |
| 4246 break; | 4118 break; |
| 4247 case 2: | 4119 case 2: |
| 4248 case 10: | 4120 case 10: |
| 4249 _CompositeRow_Argb2Rgb_Blend_RgbByteOrder( | 4121 CompositeRow_Argb2Rgb_Blend_RgbByteOrder( |
| 4250 dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan); | 4122 dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan); |
| 4251 break; | 4123 break; |
| 4252 case 3: | 4124 case 3: |
| 4253 _CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder( | 4125 CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder( |
| 4254 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp); | 4126 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp); |
| 4255 break; | 4127 break; |
| 4256 case 5: | 4128 case 5: |
| 4257 _CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(dest_scan, src_scan, | 4129 CompositeRow_Rgb2Argb_NoBlend_NoClip_RgbByteOrder(dest_scan, src_scan, |
| 4258 width, src_Bpp); | 4130 width, src_Bpp); |
| 4259 break; | 4131 break; |
| 4260 case 6: | 4132 case 6: |
| 4261 case 14: | 4133 case 14: |
| 4262 _CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, width, | 4134 CompositeRow_Argb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, width, |
| 4263 dest_Bpp, clip_scan); | 4135 dest_Bpp, clip_scan); |
| 4264 break; | 4136 break; |
| 4265 case 7: | 4137 case 7: |
| 4266 _CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder( | 4138 CompositeRow_Rgb2Rgb_NoBlend_NoClip_RgbByteOrder( |
| 4267 dest_scan, src_scan, width, dest_Bpp, src_Bpp); | 4139 dest_scan, src_scan, width, dest_Bpp, src_Bpp); |
| 4268 break; | 4140 break; |
| 4269 case 9: | 4141 case 9: |
| 4270 _CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder( | 4142 CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder( |
| 4271 dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan); | 4143 dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan); |
| 4272 break; | 4144 break; |
| 4273 case 11: | 4145 case 11: |
| 4274 _CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder( | 4146 CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(dest_scan, src_scan, width, |
| 4275 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp, | 4147 m_BlendType, dest_Bpp, |
| 4276 clip_scan); | 4148 src_Bpp, clip_scan); |
| 4277 break; | 4149 break; |
| 4278 case 13: | 4150 case 13: |
| 4279 _CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder( | 4151 CompositeRow_Rgb2Argb_NoBlend_Clip_RgbByteOrder( |
| 4280 dest_scan, src_scan, width, src_Bpp, clip_scan); | 4152 dest_scan, src_scan, width, src_Bpp, clip_scan); |
| 4281 break; | 4153 break; |
| 4282 case 15: | 4154 case 15: |
| 4283 _CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder( | 4155 CompositeRow_Rgb2Rgb_NoBlend_Clip_RgbByteOrder( |
| 4284 dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan); | 4156 dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan); |
| 4285 break; | 4157 break; |
| 4286 } | 4158 } |
| 4287 return; | 4159 return; |
| 4288 } | 4160 } |
| 4289 if (m_DestFormat == FXDIB_8bppMask) { | 4161 if (m_DestFormat == FXDIB_8bppMask) { |
| 4290 if (m_SrcFormat & 0x0200) { | 4162 if (m_SrcFormat & 0x0200) { |
| 4291 if (m_SrcFormat == FXDIB_Argb) { | 4163 if (m_SrcFormat == FXDIB_Argb) { |
| 4292 _CompositeRow_Argb2Mask(dest_scan, src_scan, width, clip_scan); | 4164 CompositeRow_Argb2Mask(dest_scan, src_scan, width, clip_scan); |
| 4293 } else { | 4165 } else { |
| 4294 _CompositeRow_Rgba2Mask(dest_scan, src_extra_alpha, width, clip_scan); | 4166 CompositeRow_Rgba2Mask(dest_scan, src_extra_alpha, width, clip_scan); |
| 4295 } | 4167 } |
| 4296 } else { | 4168 } else { |
| 4297 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); | 4169 CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); |
| 4298 } | 4170 } |
| 4299 } else if ((m_DestFormat & 0xff) == 8) { | 4171 } else if ((m_DestFormat & 0xff) == 8) { |
| 4300 if (m_DestFormat & 0x0400) { | 4172 if (m_DestFormat & 0x0400) { |
| 4301 for (int i = 0; i < width; i++) { | 4173 for (int i = 0; i < width; i++) { |
| 4302 *dest_scan = ~*dest_scan; | 4174 *dest_scan = ~*dest_scan; |
| 4303 dest_scan++; | 4175 dest_scan++; |
| 4304 } | 4176 } |
| 4305 } | 4177 } |
| 4306 if (m_SrcFormat & 0x0200) { | 4178 if (m_SrcFormat & 0x0200) { |
| 4307 if (m_DestFormat & 0x0200) { | 4179 if (m_DestFormat & 0x0200) { |
| 4308 _CompositeRow_Argb2Graya(dest_scan, src_scan, width, m_BlendType, | 4180 CompositeRow_Argb2Graya(dest_scan, src_scan, width, m_BlendType, |
| 4309 clip_scan, src_extra_alpha, dst_extra_alpha, | 4181 clip_scan, src_extra_alpha, dst_extra_alpha, |
| 4310 m_pIccTransform); | 4182 m_pIccTransform); |
| 4311 } else { | 4183 } else { |
| 4312 _CompositeRow_Argb2Gray(dest_scan, src_scan, width, m_BlendType, | 4184 CompositeRow_Argb2Gray(dest_scan, src_scan, width, m_BlendType, |
| 4313 clip_scan, src_extra_alpha, m_pIccTransform); | 4185 clip_scan, src_extra_alpha, m_pIccTransform); |
| 4314 } | 4186 } |
| 4315 } else { | 4187 } else { |
| 4316 if (m_DestFormat & 0x0200) { | 4188 if (m_DestFormat & 0x0200) { |
| 4317 _CompositeRow_Rgb2Graya(dest_scan, src_scan, src_Bpp, width, | 4189 CompositeRow_Rgb2Graya(dest_scan, src_scan, src_Bpp, width, m_BlendType, |
| 4318 m_BlendType, clip_scan, dst_extra_alpha, | 4190 clip_scan, dst_extra_alpha, m_pIccTransform); |
| 4319 m_pIccTransform); | |
| 4320 } else { | 4191 } else { |
| 4321 _CompositeRow_Rgb2Gray(dest_scan, src_scan, src_Bpp, width, m_BlendType, | 4192 CompositeRow_Rgb2Gray(dest_scan, src_scan, src_Bpp, width, m_BlendType, |
| 4322 clip_scan, m_pIccTransform); | 4193 clip_scan, m_pIccTransform); |
| 4323 } | 4194 } |
| 4324 } | 4195 } |
| 4325 if (m_DestFormat & 0x0400) { | 4196 if (m_DestFormat & 0x0400) { |
| 4326 for (int i = 0; i < width; i++) { | 4197 for (int i = 0; i < width; i++) { |
| 4327 *dest_scan = ~*dest_scan; | 4198 *dest_scan = ~*dest_scan; |
| 4328 dest_scan++; | 4199 dest_scan++; |
| 4329 } | 4200 } |
| 4330 } | 4201 } |
| 4331 } else { | 4202 } else { |
| 4332 int dest_Size = width * dest_Bpp + 4; | 4203 int dest_Size = width * dest_Bpp + 4; |
| 4333 if (dest_Size > m_CacheSize) { | 4204 if (dest_Size > m_CacheSize) { |
| 4334 m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size); | 4205 m_pCacheScanline = FX_Realloc(uint8_t, m_pCacheScanline, dest_Size); |
| 4335 if (!m_pCacheScanline) { | 4206 if (!m_pCacheScanline) { |
| 4336 return; | 4207 return; |
| 4337 } | 4208 } |
| 4338 m_CacheSize = dest_Size; | 4209 m_CacheSize = dest_Size; |
| 4339 } | 4210 } |
| 4340 switch (m_Transparency) { | 4211 switch (m_Transparency) { |
| 4341 case 0: | 4212 case 0: |
| 4342 case 4: | 4213 case 4: |
| 4343 case 8: | 4214 case 8: |
| 4344 case 4 + 8: { | 4215 case 4 + 8: { |
| 4345 _CompositeRow_Argb2Argb(dest_scan, src_scan, width, m_BlendType, | 4216 CompositeRow_Argb2Argb(dest_scan, src_scan, width, m_BlendType, |
| 4346 clip_scan, dst_extra_alpha, src_extra_alpha); | 4217 clip_scan, dst_extra_alpha, src_extra_alpha); |
| 4347 } break; | 4218 } break; |
| 4348 case 64: | 4219 case 64: |
| 4349 case 4 + 64: | 4220 case 4 + 64: |
| 4350 case 8 + 64: | 4221 case 8 + 64: |
| 4351 case 4 + 8 + 64: { | 4222 case 4 + 8 + 64: { |
| 4352 _CompositeRow_Argb2Argb_Transform( | 4223 CompositeRow_Argb2Argb_Transform( |
| 4353 dest_scan, src_scan, width, m_BlendType, clip_scan, dst_extra_alpha, | 4224 dest_scan, src_scan, width, m_BlendType, clip_scan, dst_extra_alpha, |
| 4354 src_extra_alpha, m_pCacheScanline, m_pIccTransform); | 4225 src_extra_alpha, m_pCacheScanline, m_pIccTransform); |
| 4355 } break; | 4226 } break; |
| 4356 case 1: | 4227 case 1: |
| 4357 _CompositeRow_Rgb2Argb_Blend_NoClip( | 4228 CompositeRow_Rgb2Argb_Blend_NoClip( |
| 4358 dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha); | 4229 dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha); |
| 4359 break; | 4230 break; |
| 4360 case 1 + 64: | 4231 case 1 + 64: |
| 4361 _CompositeRow_Rgb2Argb_Blend_NoClip_Transform( | 4232 CompositeRow_Rgb2Argb_Blend_NoClip_Transform( |
| 4362 dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha, | 4233 dest_scan, src_scan, width, m_BlendType, src_Bpp, dst_extra_alpha, |
| 4363 m_pCacheScanline, m_pIccTransform); | 4234 m_pCacheScanline, m_pIccTransform); |
| 4364 break; | 4235 break; |
| 4365 case 1 + 8: | 4236 case 1 + 8: |
| 4366 _CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_scan, width, | 4237 CompositeRow_Rgb2Argb_Blend_Clip(dest_scan, src_scan, width, |
| 4367 m_BlendType, src_Bpp, clip_scan, | 4238 m_BlendType, src_Bpp, clip_scan, |
| 4368 dst_extra_alpha); | 4239 dst_extra_alpha); |
| 4369 break; | 4240 break; |
| 4370 case 1 + 8 + 64: | 4241 case 1 + 8 + 64: |
| 4371 _CompositeRow_Rgb2Argb_Blend_Clip_Transform( | 4242 CompositeRow_Rgb2Argb_Blend_Clip_Transform( |
| 4372 dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan, | 4243 dest_scan, src_scan, width, m_BlendType, src_Bpp, clip_scan, |
| 4373 dst_extra_alpha, m_pCacheScanline, m_pIccTransform); | 4244 dst_extra_alpha, m_pCacheScanline, m_pIccTransform); |
| 4374 break; | 4245 break; |
| 4375 case 1 + 4: | 4246 case 1 + 4: |
| 4376 _CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_scan, width, | 4247 CompositeRow_Rgb2Argb_NoBlend_NoClip(dest_scan, src_scan, width, |
| 4377 src_Bpp, dst_extra_alpha); | 4248 src_Bpp, dst_extra_alpha); |
| 4378 break; | 4249 break; |
| 4379 case 1 + 4 + 64: | 4250 case 1 + 4 + 64: |
| 4380 _CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform( | 4251 CompositeRow_Rgb2Argb_NoBlend_NoClip_Transform( |
| 4381 dest_scan, src_scan, width, src_Bpp, dst_extra_alpha, | 4252 dest_scan, src_scan, width, src_Bpp, dst_extra_alpha, |
| 4382 m_pCacheScanline, m_pIccTransform); | 4253 m_pCacheScanline, m_pIccTransform); |
| 4383 break; | 4254 break; |
| 4384 case 1 + 4 + 8: | 4255 case 1 + 4 + 8: |
| 4385 _CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_scan, width, src_Bpp, | 4256 CompositeRow_Rgb2Argb_NoBlend_Clip(dest_scan, src_scan, width, src_Bpp, |
| 4386 clip_scan, dst_extra_alpha); | 4257 clip_scan, dst_extra_alpha); |
| 4387 break; | 4258 break; |
| 4388 case 1 + 4 + 8 + 64: | 4259 case 1 + 4 + 8 + 64: |
| 4389 _CompositeRow_Rgb2Argb_NoBlend_Clip_Transform( | 4260 CompositeRow_Rgb2Argb_NoBlend_Clip_Transform( |
| 4390 dest_scan, src_scan, width, src_Bpp, clip_scan, dst_extra_alpha, | 4261 dest_scan, src_scan, width, src_Bpp, clip_scan, dst_extra_alpha, |
| 4391 m_pCacheScanline, m_pIccTransform); | 4262 m_pCacheScanline, m_pIccTransform); |
| 4392 break; | 4263 break; |
| 4393 case 2: | 4264 case 2: |
| 4394 case 2 + 8: | 4265 case 2 + 8: |
| 4395 _CompositeRow_Argb2Rgb_Blend(dest_scan, src_scan, width, m_BlendType, | 4266 CompositeRow_Argb2Rgb_Blend(dest_scan, src_scan, width, m_BlendType, |
| 4396 dest_Bpp, clip_scan, src_extra_alpha); | 4267 dest_Bpp, clip_scan, src_extra_alpha); |
| 4397 break; | 4268 break; |
| 4398 case 2 + 64: | 4269 case 2 + 64: |
| 4399 case 2 + 8 + 64: | 4270 case 2 + 8 + 64: |
| 4400 _CompositeRow_Argb2Rgb_Blend_Transform( | 4271 CompositeRow_Argb2Rgb_Blend_Transform( |
| 4401 dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan, | 4272 dest_scan, src_scan, width, m_BlendType, dest_Bpp, clip_scan, |
| 4402 src_extra_alpha, m_pCacheScanline, m_pIccTransform); | 4273 src_extra_alpha, m_pCacheScanline, m_pIccTransform); |
| 4403 break; | 4274 break; |
| 4404 case 2 + 4: | 4275 case 2 + 4: |
| 4405 case 2 + 4 + 8: | 4276 case 2 + 4 + 8: |
| 4406 _CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_scan, width, dest_Bpp, | 4277 CompositeRow_Argb2Rgb_NoBlend(dest_scan, src_scan, width, dest_Bpp, |
| 4407 clip_scan, src_extra_alpha); | 4278 clip_scan, src_extra_alpha); |
| 4408 break; | 4279 break; |
| 4409 case 2 + 4 + 64: | 4280 case 2 + 4 + 64: |
| 4410 case 2 + 4 + 8 + 64: | 4281 case 2 + 4 + 8 + 64: |
| 4411 _CompositeRow_Argb2Rgb_NoBlend_Transform( | 4282 CompositeRow_Argb2Rgb_NoBlend_Transform( |
| 4412 dest_scan, src_scan, width, dest_Bpp, clip_scan, src_extra_alpha, | 4283 dest_scan, src_scan, width, dest_Bpp, clip_scan, src_extra_alpha, |
| 4413 m_pCacheScanline, m_pIccTransform); | 4284 m_pCacheScanline, m_pIccTransform); |
| 4414 break; | 4285 break; |
| 4415 case 1 + 2: | 4286 case 1 + 2: |
| 4416 _CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_scan, width, | 4287 CompositeRow_Rgb2Rgb_Blend_NoClip(dest_scan, src_scan, width, |
| 4417 m_BlendType, dest_Bpp, src_Bpp); | 4288 m_BlendType, dest_Bpp, src_Bpp); |
| 4418 break; | 4289 break; |
| 4419 case 1 + 2 + 64: | 4290 case 1 + 2 + 64: |
| 4420 _CompositeRow_Rgb2Rgb_Blend_NoClip_Transform( | 4291 CompositeRow_Rgb2Rgb_Blend_NoClip_Transform( |
| 4421 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp, | 4292 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp, |
| 4422 m_pCacheScanline, m_pIccTransform); | 4293 m_pCacheScanline, m_pIccTransform); |
| 4423 break; | 4294 break; |
| 4424 case 1 + 2 + 8: | 4295 case 1 + 2 + 8: |
| 4425 _CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_scan, width, | 4296 CompositeRow_Rgb2Rgb_Blend_Clip(dest_scan, src_scan, width, m_BlendType, |
| 4426 m_BlendType, dest_Bpp, src_Bpp, | 4297 dest_Bpp, src_Bpp, clip_scan); |
| 4427 clip_scan); | |
| 4428 break; | 4298 break; |
| 4429 case 1 + 2 + 8 + 64: | 4299 case 1 + 2 + 8 + 64: |
| 4430 _CompositeRow_Rgb2Rgb_Blend_Clip_Transform( | 4300 CompositeRow_Rgb2Rgb_Blend_Clip_Transform( |
| 4431 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp, | 4301 dest_scan, src_scan, width, m_BlendType, dest_Bpp, src_Bpp, |
| 4432 clip_scan, m_pCacheScanline, m_pIccTransform); | 4302 clip_scan, m_pCacheScanline, m_pIccTransform); |
| 4433 break; | 4303 break; |
| 4434 case 1 + 2 + 4: | 4304 case 1 + 2 + 4: |
| 4435 _CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_scan, width, | 4305 CompositeRow_Rgb2Rgb_NoBlend_NoClip(dest_scan, src_scan, width, |
| 4436 dest_Bpp, src_Bpp); | 4306 dest_Bpp, src_Bpp); |
| 4437 break; | 4307 break; |
| 4438 case 1 + 2 + 4 + 64: | 4308 case 1 + 2 + 4 + 64: |
| 4439 _CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform( | 4309 CompositeRow_Rgb2Rgb_NoBlend_NoClip_Transform( |
| 4440 dest_scan, src_scan, width, dest_Bpp, src_Bpp, m_pCacheScanline, | 4310 dest_scan, src_scan, width, dest_Bpp, src_Bpp, m_pCacheScanline, |
| 4441 m_pIccTransform); | 4311 m_pIccTransform); |
| 4442 break; | 4312 break; |
| 4443 case 1 + 2 + 4 + 8: | 4313 case 1 + 2 + 4 + 8: |
| 4444 _CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, dest_Bpp, | 4314 CompositeRow_Rgb2Rgb_NoBlend_Clip(dest_scan, src_scan, width, dest_Bpp, |
| 4445 src_Bpp, clip_scan); | 4315 src_Bpp, clip_scan); |
| 4446 break; | 4316 break; |
| 4447 case 1 + 2 + 4 + 8 + 64: | 4317 case 1 + 2 + 4 + 8 + 64: |
| 4448 _CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform( | 4318 CompositeRow_Rgb2Rgb_NoBlend_Clip_Transform( |
| 4449 dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan, | 4319 dest_scan, src_scan, width, dest_Bpp, src_Bpp, clip_scan, |
| 4450 m_pCacheScanline, m_pIccTransform); | 4320 m_pCacheScanline, m_pIccTransform); |
| 4451 break; | 4321 break; |
| 4452 } | 4322 } |
| 4453 } | 4323 } |
| 4454 } | 4324 } |
| 4325 |
| 4455 void CFX_ScanlineCompositor::CompositePalBitmapLine( | 4326 void CFX_ScanlineCompositor::CompositePalBitmapLine( |
| 4456 uint8_t* dest_scan, | 4327 uint8_t* dest_scan, |
| 4457 const uint8_t* src_scan, | 4328 const uint8_t* src_scan, |
| 4458 int src_left, | 4329 int src_left, |
| 4459 int width, | 4330 int width, |
| 4460 const uint8_t* clip_scan, | 4331 const uint8_t* clip_scan, |
| 4461 const uint8_t* src_extra_alpha, | 4332 const uint8_t* src_extra_alpha, |
| 4462 uint8_t* dst_extra_alpha) { | 4333 uint8_t* dst_extra_alpha) { |
| 4463 if (m_bRgbByteOrder) { | 4334 if (m_bRgbByteOrder) { |
| 4464 if (m_SrcFormat == FXDIB_1bppRgb) { | 4335 if (m_SrcFormat == FXDIB_1bppRgb) { |
| 4465 if (m_DestFormat == FXDIB_8bppRgb) { | 4336 if (m_DestFormat == FXDIB_8bppRgb) { |
| 4466 return; | 4337 return; |
| 4467 } | 4338 } |
| 4468 if (m_DestFormat == FXDIB_Argb) { | 4339 if (m_DestFormat == FXDIB_Argb) { |
| 4469 _CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder( | 4340 CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder( |
| 4470 dest_scan, src_scan, src_left, width, m_pSrcPalette, clip_scan); | 4341 dest_scan, src_scan, src_left, width, m_pSrcPalette, clip_scan); |
| 4471 } else { | 4342 } else { |
| 4472 _CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder( | 4343 CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder( |
| 4473 dest_scan, src_scan, src_left, m_pSrcPalette, width, | 4344 dest_scan, src_scan, src_left, m_pSrcPalette, width, |
| 4474 (m_DestFormat & 0xff) >> 3, clip_scan); | 4345 (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4475 } | 4346 } |
| 4476 } else { | 4347 } else { |
| 4477 if (m_DestFormat == FXDIB_8bppRgb) { | 4348 if (m_DestFormat == FXDIB_8bppRgb) { |
| 4478 return; | 4349 return; |
| 4479 } | 4350 } |
| 4480 if (m_DestFormat == FXDIB_Argb) { | 4351 if (m_DestFormat == FXDIB_Argb) { |
| 4481 _CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder( | 4352 CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder( |
| 4482 dest_scan, src_scan, width, m_pSrcPalette, clip_scan); | 4353 dest_scan, src_scan, width, m_pSrcPalette, clip_scan); |
| 4483 } else { | 4354 } else { |
| 4484 _CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder( | 4355 CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder( |
| 4485 dest_scan, src_scan, m_pSrcPalette, width, | 4356 dest_scan, src_scan, m_pSrcPalette, width, |
| 4486 (m_DestFormat & 0xff) >> 3, clip_scan); | 4357 (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4487 } | 4358 } |
| 4488 } | 4359 } |
| 4489 return; | 4360 return; |
| 4490 } | 4361 } |
| 4491 if (m_DestFormat == FXDIB_8bppMask) { | 4362 if (m_DestFormat == FXDIB_8bppMask) { |
| 4492 _CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); | 4363 CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan); |
| 4493 return; | 4364 return; |
| 4494 } | 4365 } |
| 4495 if ((m_DestFormat & 0xff) == 8) { | 4366 if ((m_DestFormat & 0xff) == 8) { |
| 4496 if (m_Transparency & 8) { | 4367 if (m_Transparency & 8) { |
| 4497 if (m_DestFormat & 0x0200) { | 4368 if (m_DestFormat & 0x0200) { |
| 4498 _CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, | 4369 CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, |
| 4499 (const uint8_t*)m_pSrcPalette, width, | 4370 (const uint8_t*)m_pSrcPalette, width, |
| 4500 m_BlendType, clip_scan, dst_extra_alpha); | 4371 m_BlendType, clip_scan, dst_extra_alpha); |
| 4501 } else { | 4372 } else { |
| 4502 _CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, | 4373 CompositeRow_1bppPal2Gray(dest_scan, src_scan, src_left, |
| 4503 (const uint8_t*)m_pSrcPalette, width, | 4374 (const uint8_t*)m_pSrcPalette, width, |
| 4504 m_BlendType, clip_scan); | 4375 m_BlendType, clip_scan); |
| 4505 } | 4376 } |
| 4506 } else { | 4377 } else { |
| 4507 if (m_DestFormat & 0x0200) | 4378 if (m_DestFormat & 0x0200) |
| 4508 _CompositeRow_8bppPal2Graya( | 4379 CompositeRow_8bppPal2Graya( |
| 4509 dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, | 4380 dest_scan, src_scan, (const uint8_t*)m_pSrcPalette, width, |
| 4510 m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha); | 4381 m_BlendType, clip_scan, dst_extra_alpha, src_extra_alpha); |
| 4511 else | 4382 else |
| 4512 _CompositeRow_8bppPal2Gray(dest_scan, src_scan, | 4383 CompositeRow_8bppPal2Gray(dest_scan, src_scan, |
| 4513 (const uint8_t*)m_pSrcPalette, width, | 4384 (const uint8_t*)m_pSrcPalette, width, |
| 4514 m_BlendType, clip_scan, src_extra_alpha); | 4385 m_BlendType, clip_scan, src_extra_alpha); |
| 4515 } | 4386 } |
| 4516 } else { | 4387 } else { |
| 4517 switch (m_Transparency) { | 4388 switch (m_Transparency) { |
| 4518 case 1 + 2: | 4389 case 1 + 2: |
| 4519 _CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width, | 4390 CompositeRow_8bppRgb2Argb_NoBlend(dest_scan, src_scan, width, |
| 4520 m_pSrcPalette, clip_scan, | 4391 m_pSrcPalette, clip_scan, |
| 4521 src_extra_alpha); | 4392 src_extra_alpha); |
| 4522 break; | 4393 break; |
| 4523 case 1 + 2 + 8: | 4394 case 1 + 2 + 8: |
| 4524 _CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left, width, | 4395 CompositeRow_1bppRgb2Argb_NoBlend(dest_scan, src_scan, src_left, width, |
| 4525 m_pSrcPalette, clip_scan); | 4396 m_pSrcPalette, clip_scan); |
| 4526 break; | 4397 break; |
| 4527 case 0: | 4398 case 0: |
| 4528 _CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette, | 4399 CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette, |
| 4529 width, (m_DestFormat & 0xff) >> 3, | 4400 width, (m_DestFormat & 0xff) >> 3, |
| 4530 clip_scan, src_extra_alpha); | 4401 clip_scan, src_extra_alpha); |
| 4531 break; | 4402 break; |
| 4532 case 0 + 8: | 4403 case 0 + 8: |
| 4533 _CompositeRow_1bppRgb2Rgb_NoBlend( | 4404 CompositeRow_1bppRgb2Rgb_NoBlend(dest_scan, src_scan, src_left, |
| 4534 dest_scan, src_scan, src_left, m_pSrcPalette, width, | 4405 m_pSrcPalette, width, |
| 4535 (m_DestFormat & 0xff) >> 3, clip_scan); | 4406 (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4536 break; | 4407 break; |
| 4537 case 0 + 2: | 4408 case 0 + 2: |
| 4538 _CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette, | 4409 CompositeRow_8bppRgb2Rgb_NoBlend(dest_scan, src_scan, m_pSrcPalette, |
| 4539 width, (m_DestFormat & 0xff) >> 3, | 4410 width, (m_DestFormat & 0xff) >> 3, |
| 4540 clip_scan, src_extra_alpha); | 4411 clip_scan, src_extra_alpha); |
| 4541 break; | 4412 break; |
| 4542 case 0 + 2 + 8: | 4413 case 0 + 2 + 8: |
| 4543 _CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left, width, | 4414 CompositeRow_1bppRgb2Rgba_NoBlend(dest_scan, src_scan, src_left, width, |
| 4544 m_pSrcPalette, clip_scan, | 4415 m_pSrcPalette, clip_scan, |
| 4545 dst_extra_alpha); | 4416 dst_extra_alpha); |
| 4546 break; | 4417 break; |
| 4547 break; | 4418 break; |
| 4548 } | 4419 } |
| 4549 } | 4420 } |
| 4550 } | 4421 } |
| 4422 |
| 4551 void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan, | 4423 void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan, |
| 4552 const uint8_t* src_scan, | 4424 const uint8_t* src_scan, |
| 4553 int width, | 4425 int width, |
| 4554 const uint8_t* clip_scan, | 4426 const uint8_t* clip_scan, |
| 4555 uint8_t* dst_extra_alpha) { | 4427 uint8_t* dst_extra_alpha) { |
| 4556 if (m_DestFormat == FXDIB_8bppMask) { | 4428 if (m_DestFormat == FXDIB_8bppMask) { |
| 4557 _CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, | 4429 CompositeRow_ByteMask2Mask(dest_scan, src_scan, m_MaskAlpha, width, |
| 4558 clip_scan); | 4430 clip_scan); |
| 4559 } else if ((m_DestFormat & 0xff) == 8) { | 4431 } else if ((m_DestFormat & 0xff) == 8) { |
| 4560 if (m_DestFormat & 0x0200) { | 4432 if (m_DestFormat & 0x0200) { |
| 4561 _CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4433 CompositeRow_ByteMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4562 width, clip_scan, dst_extra_alpha); | 4434 width, clip_scan, dst_extra_alpha); |
| 4563 } else { | 4435 } else { |
| 4564 _CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4436 CompositeRow_ByteMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4565 width, clip_scan); | 4437 width, clip_scan); |
| 4566 } | 4438 } |
| 4567 } else if (m_bRgbByteOrder) { | 4439 } else if (m_bRgbByteOrder) { |
| 4568 if (m_DestFormat == FXDIB_Argb) { | 4440 if (m_DestFormat == FXDIB_Argb) { |
| 4569 _CompositeRow_ByteMask2Argb_RgbByteOrder( | 4441 CompositeRow_ByteMask2Argb_RgbByteOrder( |
| 4570 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4442 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4571 width, m_BlendType, clip_scan); | 4443 width, m_BlendType, clip_scan); |
| 4572 } else { | 4444 } else { |
| 4573 _CompositeRow_ByteMask2Rgb_RgbByteOrder( | 4445 CompositeRow_ByteMask2Rgb_RgbByteOrder( |
| 4574 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4446 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4575 width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); | 4447 width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4576 } | 4448 } |
| 4577 return; | 4449 return; |
| 4578 } else if (m_DestFormat == FXDIB_Argb) { | 4450 } else if (m_DestFormat == FXDIB_Argb) { |
| 4579 _CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4451 CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4580 m_MaskGreen, m_MaskBlue, width, m_BlendType, | 4452 m_MaskGreen, m_MaskBlue, width, m_BlendType, |
| 4581 clip_scan); | 4453 clip_scan); |
| 4582 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { | 4454 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { |
| 4583 _CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4455 CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4456 m_MaskGreen, m_MaskBlue, width, m_BlendType, |
| 4457 (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4458 } else if (m_DestFormat == FXDIB_Rgba) { |
| 4459 CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4584 m_MaskGreen, m_MaskBlue, width, m_BlendType, | 4460 m_MaskGreen, m_MaskBlue, width, m_BlendType, |
| 4585 (m_DestFormat & 0xff) >> 3, clip_scan); | 4461 clip_scan, dst_extra_alpha); |
| 4586 } else if (m_DestFormat == FXDIB_Rgba) { | |
| 4587 _CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | |
| 4588 m_MaskGreen, m_MaskBlue, width, m_BlendType, | |
| 4589 clip_scan, dst_extra_alpha); | |
| 4590 } | 4462 } |
| 4591 } | 4463 } |
| 4464 |
| 4592 void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, | 4465 void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, |
| 4593 const uint8_t* src_scan, | 4466 const uint8_t* src_scan, |
| 4594 int src_left, | 4467 int src_left, |
| 4595 int width, | 4468 int width, |
| 4596 const uint8_t* clip_scan, | 4469 const uint8_t* clip_scan, |
| 4597 uint8_t* dst_extra_alpha) { | 4470 uint8_t* dst_extra_alpha) { |
| 4598 if (m_DestFormat == FXDIB_8bppMask) { | 4471 if (m_DestFormat == FXDIB_8bppMask) { |
| 4599 _CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, | 4472 CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left, width, |
| 4600 width, clip_scan); | 4473 clip_scan); |
| 4601 } else if ((m_DestFormat & 0xff) == 8) { | 4474 } else if ((m_DestFormat & 0xff) == 8) { |
| 4602 if (m_DestFormat & 0x0200) { | 4475 if (m_DestFormat & 0x0200) { |
| 4603 _CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4476 CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4604 src_left, width, clip_scan, dst_extra_alpha); | 4477 src_left, width, clip_scan, dst_extra_alpha); |
| 4605 } else { | 4478 } else { |
| 4606 _CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4479 CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4607 src_left, width, clip_scan); | 4480 src_left, width, clip_scan); |
| 4608 } | 4481 } |
| 4609 } else if (m_bRgbByteOrder) { | 4482 } else if (m_bRgbByteOrder) { |
| 4610 if (m_DestFormat == FXDIB_Argb) { | 4483 if (m_DestFormat == FXDIB_Argb) { |
| 4611 _CompositeRow_BitMask2Argb_RgbByteOrder( | 4484 CompositeRow_BitMask2Argb_RgbByteOrder( |
| 4612 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4485 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4613 src_left, width, m_BlendType, clip_scan); | 4486 src_left, width, m_BlendType, clip_scan); |
| 4614 } else { | 4487 } else { |
| 4615 _CompositeRow_BitMask2Rgb_RgbByteOrder( | 4488 CompositeRow_BitMask2Rgb_RgbByteOrder( |
| 4616 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4489 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4617 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); | 4490 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4618 } | 4491 } |
| 4619 return; | 4492 return; |
| 4620 } else if (m_DestFormat == FXDIB_Argb) { | 4493 } else if (m_DestFormat == FXDIB_Argb) { |
| 4621 _CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, | 4494 CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed, |
| 4622 m_MaskGreen, m_MaskBlue, src_left, width, | 4495 m_MaskGreen, m_MaskBlue, src_left, width, |
| 4623 m_BlendType, clip_scan); | 4496 m_BlendType, clip_scan); |
| 4624 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { | 4497 } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) { |
| 4625 _CompositeRow_BitMask2Rgb( | 4498 CompositeRow_BitMask2Rgb( |
| 4626 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, | 4499 dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue, |
| 4627 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); | 4500 src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan); |
| 4628 } | 4501 } |
| 4629 } | 4502 } |
| 4630 | 4503 |
| 4631 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, | 4504 FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, |
| 4632 int dest_top, | 4505 int dest_top, |
| 4633 int width, | 4506 int width, |
| 4634 int height, | 4507 int height, |
| 4635 const CFX_DIBSource* pSrcBitmap, | 4508 const CFX_DIBSource* pSrcBitmap, |
| 4636 int src_left, | 4509 int src_left, |
| 4637 int src_top, | 4510 int src_top, |
| 4638 int blend_type, | 4511 int blend_type, |
| 4639 const CFX_ClipRgn* pClipRgn, | 4512 const CFX_ClipRgn* pClipRgn, |
| 4640 FX_BOOL bRgbByteOrder, | 4513 FX_BOOL bRgbByteOrder, |
| 4641 void* pIccTransform) { | 4514 void* pIccTransform) { |
| 4642 if (!m_pBuffer) { | 4515 if (!m_pBuffer) { |
| 4643 return FALSE; | 4516 return FALSE; |
| 4644 } | 4517 } |
| 4645 ASSERT(!pSrcBitmap->IsAlphaMask()); | 4518 ASSERT(!pSrcBitmap->IsAlphaMask()); |
| 4646 ASSERT(m_bpp >= 8); | 4519 ASSERT(m_bpp >= 8); |
| 4647 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { | 4520 if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { |
| 4648 return FALSE; | 4521 return FALSE; |
| 4649 } | 4522 } |
| 4650 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), | 4523 GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), |
| 4651 pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); | 4524 pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); |
| 4652 if (width == 0 || height == 0) { | 4525 if (width == 0 || height == 0) { |
| 4653 return TRUE; | 4526 return TRUE; |
| 4654 } | 4527 } |
| 4655 const CFX_DIBitmap* pClipMask = NULL; | 4528 const CFX_DIBitmap* pClipMask = nullptr; |
| 4656 FX_RECT clip_box; | 4529 FX_RECT clip_box; |
| 4657 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4530 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 4658 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4531 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
| 4659 pClipMask = pClipRgn->GetMask(); | 4532 pClipMask = pClipRgn->GetMask(); |
| 4660 clip_box = pClipRgn->GetBox(); | 4533 clip_box = pClipRgn->GetBox(); |
| 4661 } | 4534 } |
| 4662 CFX_ScanlineCompositor compositor; | 4535 CFX_ScanlineCompositor compositor; |
| 4663 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, | 4536 if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, |
| 4664 pSrcBitmap->GetPalette(), 0, blend_type, | 4537 pSrcBitmap->GetPalette(), 0, blend_type, |
| 4665 pClipMask != NULL, bRgbByteOrder, 0, pIccTransform)) { | 4538 pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) { |
| 4666 return FALSE; | 4539 return FALSE; |
| 4667 } | 4540 } |
| 4668 int dest_Bpp = m_bpp / 8; | 4541 int dest_Bpp = m_bpp / 8; |
| 4669 int src_Bpp = pSrcBitmap->GetBPP() / 8; | 4542 int src_Bpp = pSrcBitmap->GetBPP() / 8; |
| 4670 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); | 4543 FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); |
| 4671 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; | 4544 CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; |
| 4672 for (int row = 0; row < height; row++) { | 4545 for (int row = 0; row < height; row++) { |
| 4673 uint8_t* dest_scan = | 4546 uint8_t* dest_scan = |
| 4674 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; | 4547 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; |
| 4675 const uint8_t* src_scan = | 4548 const uint8_t* src_scan = |
| 4676 pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; | 4549 pSrcBitmap->GetScanline(src_top + row) + src_left * src_Bpp; |
| 4677 const uint8_t* src_scan_extra_alpha = | 4550 const uint8_t* src_scan_extra_alpha = |
| 4678 pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left | 4551 pSrcAlphaMask ? pSrcAlphaMask->GetScanline(src_top + row) + src_left |
| 4679 : NULL; | 4552 : nullptr; |
| 4680 uint8_t* dst_scan_extra_alpha = | 4553 uint8_t* dst_scan_extra_alpha = |
| 4681 m_pAlphaMask | 4554 m_pAlphaMask |
| 4682 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left | 4555 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left |
| 4683 : NULL; | 4556 : nullptr; |
| 4684 const uint8_t* clip_scan = NULL; | 4557 const uint8_t* clip_scan = nullptr; |
| 4685 if (pClipMask) { | 4558 if (pClipMask) { |
| 4686 clip_scan = pClipMask->m_pBuffer + | 4559 clip_scan = pClipMask->m_pBuffer + |
| 4687 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + | 4560 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + |
| 4688 (dest_left - clip_box.left); | 4561 (dest_left - clip_box.left); |
| 4689 } | 4562 } |
| 4690 if (bRgb) { | 4563 if (bRgb) { |
| 4691 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan, | 4564 compositor.CompositeRgbBitmapLine(dest_scan, src_scan, width, clip_scan, |
| 4692 src_scan_extra_alpha, | 4565 src_scan_extra_alpha, |
| 4693 dst_scan_extra_alpha); | 4566 dst_scan_extra_alpha); |
| 4694 } else { | 4567 } else { |
| 4695 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, | 4568 compositor.CompositePalBitmapLine(dest_scan, src_scan, src_left, width, |
| 4696 clip_scan, src_scan_extra_alpha, | 4569 clip_scan, src_scan_extra_alpha, |
| 4697 dst_scan_extra_alpha); | 4570 dst_scan_extra_alpha); |
| 4698 } | 4571 } |
| 4699 } | 4572 } |
| 4700 return TRUE; | 4573 return TRUE; |
| 4701 } | 4574 } |
| 4575 |
| 4702 FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, | 4576 FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, |
| 4703 int dest_top, | 4577 int dest_top, |
| 4704 int width, | 4578 int width, |
| 4705 int height, | 4579 int height, |
| 4706 const CFX_DIBSource* pMask, | 4580 const CFX_DIBSource* pMask, |
| 4707 uint32_t color, | 4581 uint32_t color, |
| 4708 int src_left, | 4582 int src_left, |
| 4709 int src_top, | 4583 int src_top, |
| 4710 int blend_type, | 4584 int blend_type, |
| 4711 const CFX_ClipRgn* pClipRgn, | 4585 const CFX_ClipRgn* pClipRgn, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4723 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), | 4597 GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), |
| 4724 pMask->GetHeight(), src_left, src_top, pClipRgn); | 4598 pMask->GetHeight(), src_left, src_top, pClipRgn); |
| 4725 if (width == 0 || height == 0) { | 4599 if (width == 0 || height == 0) { |
| 4726 return TRUE; | 4600 return TRUE; |
| 4727 } | 4601 } |
| 4728 int src_alpha = | 4602 int src_alpha = |
| 4729 (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); | 4603 (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); |
| 4730 if (src_alpha == 0) { | 4604 if (src_alpha == 0) { |
| 4731 return TRUE; | 4605 return TRUE; |
| 4732 } | 4606 } |
| 4733 const CFX_DIBitmap* pClipMask = NULL; | 4607 const CFX_DIBitmap* pClipMask = nullptr; |
| 4734 FX_RECT clip_box; | 4608 FX_RECT clip_box; |
| 4735 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4609 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 4736 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); | 4610 ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); |
| 4737 pClipMask = pClipRgn->GetMask(); | 4611 pClipMask = pClipRgn->GetMask(); |
| 4738 clip_box = pClipRgn->GetBox(); | 4612 clip_box = pClipRgn->GetBox(); |
| 4739 } | 4613 } |
| 4740 int src_bpp = pMask->GetBPP(); | 4614 int src_bpp = pMask->GetBPP(); |
| 4741 int Bpp = GetBPP() / 8; | 4615 int Bpp = GetBPP() / 8; |
| 4742 CFX_ScanlineCompositor compositor; | 4616 CFX_ScanlineCompositor compositor; |
| 4743 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, NULL, color, | 4617 if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color, |
| 4744 blend_type, pClipMask != NULL, bRgbByteOrder, alpha_flag, | 4618 blend_type, pClipMask != nullptr, bRgbByteOrder, |
| 4745 pIccTransform)) { | 4619 alpha_flag, pIccTransform)) { |
| 4746 return FALSE; | 4620 return FALSE; |
| 4747 } | 4621 } |
| 4748 for (int row = 0; row < height; row++) { | 4622 for (int row = 0; row < height; row++) { |
| 4749 uint8_t* dest_scan = | 4623 uint8_t* dest_scan = |
| 4750 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; | 4624 m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; |
| 4751 const uint8_t* src_scan = pMask->GetScanline(src_top + row); | 4625 const uint8_t* src_scan = pMask->GetScanline(src_top + row); |
| 4752 uint8_t* dst_scan_extra_alpha = | 4626 uint8_t* dst_scan_extra_alpha = |
| 4753 m_pAlphaMask | 4627 m_pAlphaMask |
| 4754 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left | 4628 ? (uint8_t*)m_pAlphaMask->GetScanline(dest_top + row) + dest_left |
| 4755 : NULL; | 4629 : nullptr; |
| 4756 const uint8_t* clip_scan = NULL; | 4630 const uint8_t* clip_scan = nullptr; |
| 4757 if (pClipMask) { | 4631 if (pClipMask) { |
| 4758 clip_scan = pClipMask->m_pBuffer + | 4632 clip_scan = pClipMask->m_pBuffer + |
| 4759 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + | 4633 (dest_top + row - clip_box.top) * pClipMask->m_Pitch + |
| 4760 (dest_left - clip_box.left); | 4634 (dest_left - clip_box.left); |
| 4761 } | 4635 } |
| 4762 if (src_bpp == 1) { | 4636 if (src_bpp == 1) { |
| 4763 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width, | 4637 compositor.CompositeBitMaskLine(dest_scan, src_scan, src_left, width, |
| 4764 clip_scan, dst_scan_extra_alpha); | 4638 clip_scan, dst_scan_extra_alpha); |
| 4765 } else { | 4639 } else { |
| 4766 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, | 4640 compositor.CompositeByteMaskLine(dest_scan, src_scan + src_left, width, |
| 4767 clip_scan, dst_scan_extra_alpha); | 4641 clip_scan, dst_scan_extra_alpha); |
| 4768 } | 4642 } |
| 4769 } | 4643 } |
| 4770 return TRUE; | 4644 return TRUE; |
| 4771 } | 4645 } |
| 4646 |
| 4772 FX_BOOL CFX_DIBitmap::CompositeRect(int left, | 4647 FX_BOOL CFX_DIBitmap::CompositeRect(int left, |
| 4773 int top, | 4648 int top, |
| 4774 int width, | 4649 int width, |
| 4775 int height, | 4650 int height, |
| 4776 uint32_t color, | 4651 uint32_t color, |
| 4777 int alpha_flag, | 4652 int alpha_flag, |
| 4778 void* pIccTransform) { | 4653 void* pIccTransform) { |
| 4779 if (!m_pBuffer) { | 4654 if (!m_pBuffer) { |
| 4780 return FALSE; | 4655 return FALSE; |
| 4781 } | 4656 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4891 color_p[3] = (uint8_t)src_alpha; | 4766 color_p[3] = (uint8_t)src_alpha; |
| 4892 } | 4767 } |
| 4893 int Bpp = m_bpp / 8; | 4768 int Bpp = m_bpp / 8; |
| 4894 FX_BOOL bAlpha = HasAlpha(); | 4769 FX_BOOL bAlpha = HasAlpha(); |
| 4895 bool bArgb = GetFormat() == FXDIB_Argb; | 4770 bool bArgb = GetFormat() == FXDIB_Argb; |
| 4896 if (src_alpha == 255) { | 4771 if (src_alpha == 255) { |
| 4897 for (int row = rect.top; row < rect.bottom; row++) { | 4772 for (int row = rect.top; row < rect.bottom; row++) { |
| 4898 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; | 4773 uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; |
| 4899 uint8_t* dest_scan_alpha = | 4774 uint8_t* dest_scan_alpha = |
| 4900 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left | 4775 m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left |
| 4901 : NULL; | 4776 : nullptr; |
| 4902 if (dest_scan_alpha) { | 4777 if (dest_scan_alpha) { |
| 4903 FXSYS_memset(dest_scan_alpha, 0xff, width); | 4778 FXSYS_memset(dest_scan_alpha, 0xff, width); |
| 4904 } | 4779 } |
| 4905 if (Bpp == 4) { | 4780 if (Bpp == 4) { |
| 4906 uint32_t* scan = (uint32_t*)dest_scan; | 4781 uint32_t* scan = (uint32_t*)dest_scan; |
| 4907 for (int col = 0; col < width; col++) { | 4782 for (int col = 0; col < width; col++) { |
| 4908 *scan++ = dst_color; | 4783 *scan++ = dst_color; |
| 4909 } | 4784 } |
| 4910 } else { | 4785 } else { |
| 4911 for (int col = 0; col < width; col++) { | 4786 for (int col = 0; col < width; col++) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4970 continue; | 4845 continue; |
| 4971 } | 4846 } |
| 4972 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha); | 4847 *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, color_p[comps], src_alpha); |
| 4973 dest_scan++; | 4848 dest_scan++; |
| 4974 } | 4849 } |
| 4975 } | 4850 } |
| 4976 } | 4851 } |
| 4977 } | 4852 } |
| 4978 return TRUE; | 4853 return TRUE; |
| 4979 } | 4854 } |
| 4855 |
| 4980 CFX_BitmapComposer::CFX_BitmapComposer() { | 4856 CFX_BitmapComposer::CFX_BitmapComposer() { |
| 4981 m_pScanlineV = NULL; | 4857 m_pScanlineV = nullptr; |
| 4982 m_pScanlineAlphaV = NULL; | 4858 m_pScanlineAlphaV = nullptr; |
| 4983 m_pClipScanV = NULL; | 4859 m_pClipScanV = nullptr; |
| 4984 m_pAddClipScan = NULL; | 4860 m_pAddClipScan = nullptr; |
| 4985 m_bRgbByteOrder = FALSE; | 4861 m_bRgbByteOrder = FALSE; |
| 4986 m_BlendType = FXDIB_BLEND_NORMAL; | 4862 m_BlendType = FXDIB_BLEND_NORMAL; |
| 4987 } | 4863 } |
| 4864 |
| 4988 CFX_BitmapComposer::~CFX_BitmapComposer() { | 4865 CFX_BitmapComposer::~CFX_BitmapComposer() { |
| 4989 FX_Free(m_pScanlineV); | 4866 FX_Free(m_pScanlineV); |
| 4990 FX_Free(m_pScanlineAlphaV); | 4867 FX_Free(m_pScanlineAlphaV); |
| 4991 FX_Free(m_pClipScanV); | 4868 FX_Free(m_pClipScanV); |
| 4992 FX_Free(m_pAddClipScan); | 4869 FX_Free(m_pAddClipScan); |
| 4993 } | 4870 } |
| 4871 |
| 4994 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, | 4872 void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, |
| 4995 const CFX_ClipRgn* pClipRgn, | 4873 const CFX_ClipRgn* pClipRgn, |
| 4996 int bitmap_alpha, | 4874 int bitmap_alpha, |
| 4997 uint32_t mask_color, | 4875 uint32_t mask_color, |
| 4998 FX_RECT& dest_rect, | 4876 FX_RECT& dest_rect, |
| 4999 FX_BOOL bVertical, | 4877 FX_BOOL bVertical, |
| 5000 FX_BOOL bFlipX, | 4878 FX_BOOL bFlipX, |
| 5001 FX_BOOL bFlipY, | 4879 FX_BOOL bFlipY, |
| 5002 FX_BOOL bRgbByteOrder, | 4880 FX_BOOL bRgbByteOrder, |
| 5003 int alpha_flag, | 4881 int alpha_flag, |
| 5004 void* pIccTransform, | 4882 void* pIccTransform, |
| 5005 int blend_type) { | 4883 int blend_type) { |
| 5006 m_pBitmap = pDest; | 4884 m_pBitmap = pDest; |
| 5007 m_pClipRgn = pClipRgn; | 4885 m_pClipRgn = pClipRgn; |
| 5008 m_DestLeft = dest_rect.left; | 4886 m_DestLeft = dest_rect.left; |
| 5009 m_DestTop = dest_rect.top; | 4887 m_DestTop = dest_rect.top; |
| 5010 m_DestWidth = dest_rect.Width(); | 4888 m_DestWidth = dest_rect.Width(); |
| 5011 m_DestHeight = dest_rect.Height(); | 4889 m_DestHeight = dest_rect.Height(); |
| 5012 m_BitmapAlpha = bitmap_alpha; | 4890 m_BitmapAlpha = bitmap_alpha; |
| 5013 m_MaskColor = mask_color; | 4891 m_MaskColor = mask_color; |
| 5014 m_pClipMask = NULL; | 4892 m_pClipMask = nullptr; |
| 5015 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { | 4893 if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { |
| 5016 m_pClipMask = pClipRgn->GetMask(); | 4894 m_pClipMask = pClipRgn->GetMask(); |
| 5017 } | 4895 } |
| 5018 m_bVertical = bVertical; | 4896 m_bVertical = bVertical; |
| 5019 m_bFlipX = bFlipX; | 4897 m_bFlipX = bFlipX; |
| 5020 m_bFlipY = bFlipY; | 4898 m_bFlipY = bFlipY; |
| 5021 m_AlphaFlag = alpha_flag; | 4899 m_AlphaFlag = alpha_flag; |
| 5022 m_pIccTransform = pIccTransform; | 4900 m_pIccTransform = pIccTransform; |
| 5023 m_bRgbByteOrder = bRgbByteOrder; | 4901 m_bRgbByteOrder = bRgbByteOrder; |
| 5024 m_BlendType = blend_type; | 4902 m_BlendType = blend_type; |
| 5025 } | 4903 } |
| 5026 FX_BOOL CFX_BitmapComposer::SetInfo(int width, | 4904 FX_BOOL CFX_BitmapComposer::SetInfo(int width, |
| 5027 int height, | 4905 int height, |
| 5028 FXDIB_Format src_format, | 4906 FXDIB_Format src_format, |
| 5029 uint32_t* pSrcPalette) { | 4907 uint32_t* pSrcPalette) { |
| 5030 m_SrcFormat = src_format; | 4908 m_SrcFormat = src_format; |
| 5031 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, | 4909 if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, |
| 5032 m_MaskColor, FXDIB_BLEND_NORMAL, | 4910 m_MaskColor, FXDIB_BLEND_NORMAL, |
| 5033 m_pClipMask != NULL || (m_BitmapAlpha < 255), | 4911 m_pClipMask != nullptr || (m_BitmapAlpha < 255), |
| 5034 m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { | 4912 m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { |
| 5035 return FALSE; | 4913 return FALSE; |
| 5036 } | 4914 } |
| 5037 if (m_bVertical) { | 4915 if (m_bVertical) { |
| 5038 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); | 4916 m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); |
| 5039 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); | 4917 m_pClipScanV = FX_Alloc(uint8_t, m_pBitmap->GetHeight()); |
| 5040 if (m_pBitmap->m_pAlphaMask) { | 4918 if (m_pBitmap->m_pAlphaMask) { |
| 5041 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); | 4919 m_pScanlineAlphaV = FX_Alloc(uint8_t, width + 4); |
| 5042 } | 4920 } |
| 5043 } | 4921 } |
| 5044 if (m_BitmapAlpha < 255) { | 4922 if (m_BitmapAlpha < 255) { |
| 5045 m_pAddClipScan = FX_Alloc( | 4923 m_pAddClipScan = FX_Alloc( |
| 5046 uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); | 4924 uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); |
| 5047 } | 4925 } |
| 5048 return TRUE; | 4926 return TRUE; |
| 5049 } | 4927 } |
| 4928 |
| 5050 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, | 4929 void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, |
| 5051 const uint8_t* src_scan, | 4930 const uint8_t* src_scan, |
| 5052 int dest_width, | 4931 int dest_width, |
| 5053 const uint8_t* clip_scan, | 4932 const uint8_t* clip_scan, |
| 5054 const uint8_t* src_extra_alpha, | 4933 const uint8_t* src_extra_alpha, |
| 5055 uint8_t* dst_extra_alpha) { | 4934 uint8_t* dst_extra_alpha) { |
| 5056 if (m_BitmapAlpha < 255) { | 4935 if (m_BitmapAlpha < 255) { |
| 5057 if (clip_scan) { | 4936 if (clip_scan) { |
| 5058 for (int i = 0; i < dest_width; i++) { | 4937 for (int i = 0; i < dest_width; i++) { |
| 5059 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; | 4938 m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; |
| 5060 } | 4939 } |
| 5061 } else { | 4940 } else { |
| 5062 FXSYS_memset(m_pAddClipScan, m_BitmapAlpha, dest_width); | 4941 FXSYS_memset(m_pAddClipScan, m_BitmapAlpha, dest_width); |
| 5063 } | 4942 } |
| 5064 clip_scan = m_pAddClipScan; | 4943 clip_scan = m_pAddClipScan; |
| 5065 } | 4944 } |
| 5066 if (m_SrcFormat == FXDIB_8bppMask) { | 4945 if (m_SrcFormat == FXDIB_8bppMask) { |
| 5067 m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width, | 4946 m_Compositor.CompositeByteMaskLine(dest_scan, src_scan, dest_width, |
| 5068 clip_scan, dst_extra_alpha); | 4947 clip_scan, dst_extra_alpha); |
| 5069 } else if ((m_SrcFormat & 0xff) == 8) { | 4948 } else if ((m_SrcFormat & 0xff) == 8) { |
| 5070 m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width, | 4949 m_Compositor.CompositePalBitmapLine(dest_scan, src_scan, 0, dest_width, |
| 5071 clip_scan, src_extra_alpha, | 4950 clip_scan, src_extra_alpha, |
| 5072 dst_extra_alpha); | 4951 dst_extra_alpha); |
| 5073 } else { | 4952 } else { |
| 5074 m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, | 4953 m_Compositor.CompositeRgbBitmapLine(dest_scan, src_scan, dest_width, |
| 5075 clip_scan, src_extra_alpha, | 4954 clip_scan, src_extra_alpha, |
| 5076 dst_extra_alpha); | 4955 dst_extra_alpha); |
| 5077 } | 4956 } |
| 5078 } | 4957 } |
| 4958 |
| 5079 void CFX_BitmapComposer::ComposeScanline(int line, | 4959 void CFX_BitmapComposer::ComposeScanline(int line, |
| 5080 const uint8_t* scanline, | 4960 const uint8_t* scanline, |
| 5081 const uint8_t* scan_extra_alpha) { | 4961 const uint8_t* scan_extra_alpha) { |
| 5082 if (m_bVertical) { | 4962 if (m_bVertical) { |
| 5083 ComposeScanlineV(line, scanline, scan_extra_alpha); | 4963 ComposeScanlineV(line, scanline, scan_extra_alpha); |
| 5084 return; | 4964 return; |
| 5085 } | 4965 } |
| 5086 const uint8_t* clip_scan = NULL; | 4966 const uint8_t* clip_scan = nullptr; |
| 5087 if (m_pClipMask) | 4967 if (m_pClipMask) |
| 5088 clip_scan = m_pClipMask->GetBuffer() + | 4968 clip_scan = m_pClipMask->GetBuffer() + |
| 5089 (m_DestTop + line - m_pClipRgn->GetBox().top) * | 4969 (m_DestTop + line - m_pClipRgn->GetBox().top) * |
| 5090 m_pClipMask->GetPitch() + | 4970 m_pClipMask->GetPitch() + |
| 5091 (m_DestLeft - m_pClipRgn->GetBox().left); | 4971 (m_DestLeft - m_pClipRgn->GetBox().left); |
| 5092 uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) + | 4972 uint8_t* dest_scan = (uint8_t*)m_pBitmap->GetScanline(line + m_DestTop) + |
| 5093 m_DestLeft * m_pBitmap->GetBPP() / 8; | 4973 m_DestLeft * m_pBitmap->GetBPP() / 8; |
| 5094 uint8_t* dest_alpha_scan = | 4974 uint8_t* dest_alpha_scan = |
| 5095 m_pBitmap->m_pAlphaMask | 4975 m_pBitmap->m_pAlphaMask |
| 5096 ? (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + | 4976 ? (uint8_t*)m_pBitmap->m_pAlphaMask->GetScanline(line + m_DestTop) + |
| 5097 m_DestLeft | 4977 m_DestLeft |
| 5098 : NULL; | 4978 : nullptr; |
| 5099 DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, | 4979 DoCompose(dest_scan, scanline, m_DestWidth, clip_scan, scan_extra_alpha, |
| 5100 dest_alpha_scan); | 4980 dest_alpha_scan); |
| 5101 } | 4981 } |
| 4982 |
| 5102 void CFX_BitmapComposer::ComposeScanlineV(int line, | 4983 void CFX_BitmapComposer::ComposeScanlineV(int line, |
| 5103 const uint8_t* scanline, | 4984 const uint8_t* scanline, |
| 5104 const uint8_t* scan_extra_alpha) { | 4985 const uint8_t* scan_extra_alpha) { |
| 5105 int i; | 4986 int i; |
| 5106 int Bpp = m_pBitmap->GetBPP() / 8; | 4987 int Bpp = m_pBitmap->GetBPP() / 8; |
| 5107 int dest_pitch = m_pBitmap->GetPitch(); | 4988 int dest_pitch = m_pBitmap->GetPitch(); |
| 5108 int dest_alpha_pitch = | 4989 int dest_alpha_pitch = |
| 5109 m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0; | 4990 m_pBitmap->m_pAlphaMask ? m_pBitmap->m_pAlphaMask->GetPitch() : 0; |
| 5110 int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); | 4991 int dest_x = m_DestLeft + (m_bFlipX ? (m_DestWidth - line - 1) : line); |
| 5111 uint8_t* dest_buf = | 4992 uint8_t* dest_buf = |
| 5112 m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; | 4993 m_pBitmap->GetBuffer() + dest_x * Bpp + m_DestTop * dest_pitch; |
| 5113 uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask | 4994 uint8_t* dest_alpha_buf = m_pBitmap->m_pAlphaMask |
| 5114 ? m_pBitmap->m_pAlphaMask->GetBuffer() + | 4995 ? m_pBitmap->m_pAlphaMask->GetBuffer() + |
| 5115 dest_x + m_DestTop * dest_alpha_pitch | 4996 dest_x + m_DestTop * dest_alpha_pitch |
| 5116 : NULL; | 4997 : nullptr; |
| 5117 if (m_bFlipY) { | 4998 if (m_bFlipY) { |
| 5118 dest_buf += dest_pitch * (m_DestHeight - 1); | 4999 dest_buf += dest_pitch * (m_DestHeight - 1); |
| 5119 dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1); | 5000 dest_alpha_buf += dest_alpha_pitch * (m_DestHeight - 1); |
| 5120 } | 5001 } |
| 5121 int y_step = dest_pitch; | 5002 int y_step = dest_pitch; |
| 5122 int y_alpha_step = dest_alpha_pitch; | 5003 int y_alpha_step = dest_alpha_pitch; |
| 5123 if (m_bFlipY) { | 5004 if (m_bFlipY) { |
| 5124 y_step = -y_step; | 5005 y_step = -y_step; |
| 5125 y_alpha_step = -y_alpha_step; | 5006 y_alpha_step = -y_alpha_step; |
| 5126 } | 5007 } |
| 5127 uint8_t* src_scan = m_pScanlineV; | 5008 uint8_t* src_scan = m_pScanlineV; |
| 5128 uint8_t* dest_scan = dest_buf; | 5009 uint8_t* dest_scan = dest_buf; |
| 5129 for (i = 0; i < m_DestHeight; i++) { | 5010 for (i = 0; i < m_DestHeight; i++) { |
| 5130 for (int j = 0; j < Bpp; j++) { | 5011 for (int j = 0; j < Bpp; j++) { |
| 5131 *src_scan++ = dest_scan[j]; | 5012 *src_scan++ = dest_scan[j]; |
| 5132 } | 5013 } |
| 5133 dest_scan += y_step; | 5014 dest_scan += y_step; |
| 5134 } | 5015 } |
| 5135 uint8_t* src_alpha_scan = m_pScanlineAlphaV; | 5016 uint8_t* src_alpha_scan = m_pScanlineAlphaV; |
| 5136 uint8_t* dest_alpha_scan = dest_alpha_buf; | 5017 uint8_t* dest_alpha_scan = dest_alpha_buf; |
| 5137 if (dest_alpha_scan) { | 5018 if (dest_alpha_scan) { |
| 5138 for (i = 0; i < m_DestHeight; i++) { | 5019 for (i = 0; i < m_DestHeight; i++) { |
| 5139 *src_alpha_scan++ = *dest_alpha_scan; | 5020 *src_alpha_scan++ = *dest_alpha_scan; |
| 5140 dest_alpha_scan += y_alpha_step; | 5021 dest_alpha_scan += y_alpha_step; |
| 5141 } | 5022 } |
| 5142 } | 5023 } |
| 5143 uint8_t* clip_scan = NULL; | 5024 uint8_t* clip_scan = nullptr; |
| 5144 if (m_pClipMask) { | 5025 if (m_pClipMask) { |
| 5145 clip_scan = m_pClipScanV; | 5026 clip_scan = m_pClipScanV; |
| 5146 int clip_pitch = m_pClipMask->GetPitch(); | 5027 int clip_pitch = m_pClipMask->GetPitch(); |
| 5147 const uint8_t* src_clip = | 5028 const uint8_t* src_clip = |
| 5148 m_pClipMask->GetBuffer() + | 5029 m_pClipMask->GetBuffer() + |
| 5149 (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch + | 5030 (m_DestTop - m_pClipRgn->GetBox().top) * clip_pitch + |
| 5150 (dest_x - m_pClipRgn->GetBox().left); | 5031 (dest_x - m_pClipRgn->GetBox().left); |
| 5151 if (m_bFlipY) { | 5032 if (m_bFlipY) { |
| 5152 src_clip += clip_pitch * (m_DestHeight - 1); | 5033 src_clip += clip_pitch * (m_DestHeight - 1); |
| 5153 clip_pitch = -clip_pitch; | 5034 clip_pitch = -clip_pitch; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5169 } | 5050 } |
| 5170 src_alpha_scan = m_pScanlineAlphaV; | 5051 src_alpha_scan = m_pScanlineAlphaV; |
| 5171 dest_alpha_scan = dest_alpha_buf; | 5052 dest_alpha_scan = dest_alpha_buf; |
| 5172 if (dest_alpha_scan) { | 5053 if (dest_alpha_scan) { |
| 5173 for (i = 0; i < m_DestHeight; i++) { | 5054 for (i = 0; i < m_DestHeight; i++) { |
| 5174 *dest_alpha_scan = *src_alpha_scan++; | 5055 *dest_alpha_scan = *src_alpha_scan++; |
| 5175 dest_alpha_scan += y_alpha_step; | 5056 dest_alpha_scan += y_alpha_step; |
| 5176 } | 5057 } |
| 5177 } | 5058 } |
| 5178 } | 5059 } |
| OLD | NEW |