| 1 | ;****************************************************************************
|
|---|
| 2 | ;**
|
|---|
| 3 | ;** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ;** All rights reserved.
|
|---|
| 5 | ;** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | ;**
|
|---|
| 7 | ;** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 8 | ;**
|
|---|
| 9 | ;** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ;** Commercial Usage
|
|---|
| 11 | ;** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ;** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ;** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ;** a written agreement between you and Nokia.
|
|---|
| 15 | ;**
|
|---|
| 16 | ;** GNU Lesser General Public License Usage
|
|---|
| 17 | ;** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ;** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ;** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ;** packaging of this file. Please review the following information to
|
|---|
| 21 | ;** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ;** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | ;**
|
|---|
| 24 | ;** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ;** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ;** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | ;**
|
|---|
| 28 | ;** GNU General Public License Usage
|
|---|
| 29 | ;** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ;** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ;** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ;** packaging of this file. Please review the following information to
|
|---|
| 33 | ;** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ;** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | ;**
|
|---|
| 36 | ;** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ;** Nokia at [email protected].
|
|---|
| 38 | ;** $QT_END_LICENSE$
|
|---|
| 39 | ;**
|
|---|
| 40 | ;****************************************************************************
|
|---|
| 41 |
|
|---|
| 42 | ;
|
|---|
| 43 | ; W A R N I N G
|
|---|
| 44 | ; -------------
|
|---|
| 45 | ;
|
|---|
| 46 | ; This file is not part of the Qt API. It exists purely as an
|
|---|
| 47 | ; implementation detail. This header file may change from version to
|
|---|
| 48 | ; version without notice, or even be removed.
|
|---|
| 49 | ;
|
|---|
| 50 | ; We mean it.
|
|---|
| 51 | ;
|
|---|
| 52 |
|
|---|
| 53 | ;-----------------------------------------------------------------------------
|
|---|
| 54 | ; Globals.
|
|---|
| 55 | ; Earch marcro expects that caller has loaded 0x800080 to r14.
|
|---|
| 56 | ;-----------------------------------------------------------------------------
|
|---|
| 57 |
|
|---|
| 58 | ComponentHalf EQU 0x800080
|
|---|
| 59 |
|
|---|
| 60 | ;-----------------------------------------------------------------------------
|
|---|
| 61 | ; ARM assembly implementations of accelerated graphics operations.
|
|---|
| 62 | ;
|
|---|
| 63 | ; Conventions:
|
|---|
| 64 | ;
|
|---|
| 65 | ; - r0 = Target buffer pointer
|
|---|
| 66 | ; - r1 = Source buffer pointer
|
|---|
| 67 | ; - r2 = Length of the buffer to blend
|
|---|
| 68 | ; - r3 = Constant alpha for source buffer
|
|---|
| 69 | ;
|
|---|
| 70 | ;-----------------------------------------------------------------------------
|
|---|
| 71 |
|
|---|
| 72 | ; A macro for transparently defining ARM functions
|
|---|
| 73 | MACRO
|
|---|
| 74 | $func Function
|
|---|
| 75 | AREA Function_$func, CODE
|
|---|
| 76 | GLOBAL $func
|
|---|
| 77 | ALIGN 4
|
|---|
| 78 | CODE32
|
|---|
| 79 | $func
|
|---|
| 80 | MEND
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 | ;-----------------------------------------------------------------------------
|
|---|
| 84 | ; Armv6 boosted implementation of BYTE_MUL(...) function found in qdrawhelper_p.h.
|
|---|
| 85 | ;
|
|---|
| 86 | ; @param dst Destination register where to store the result
|
|---|
| 87 | ; @param x Value to multiply
|
|---|
| 88 | ; @param a Multiplicator byte
|
|---|
| 89 | ; @param r14 Component half 0x800080
|
|---|
| 90 | ;
|
|---|
| 91 | ; @note Trashes x, r8
|
|---|
| 92 | ;-----------------------------------------------------------------------------
|
|---|
| 93 | MACRO
|
|---|
| 94 | ByteMul $dst, $x, $a
|
|---|
| 95 |
|
|---|
| 96 | ; static inline uint BYTE_MUL(uint x, uint a)
|
|---|
| 97 |
|
|---|
| 98 | ; uint r8 = (x & 0xff00ff) * a + 0x800080
|
|---|
| 99 | uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF
|
|---|
| 100 | mla r8, r8, $a, r14
|
|---|
| 101 |
|
|---|
| 102 | ; x = ((r >> 8) & 0xff00ff) * a + 0x800080
|
|---|
| 103 | uxtb16 $x, $x, ror #8
|
|---|
| 104 | mla $x, $x, $a, r14
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8
|
|---|
| 108 | ; r8 &= 0xff00ff
|
|---|
| 109 | uxtab16 r8, r8, r8, ror #8
|
|---|
| 110 | uxtb16 r8, r8, ror #8
|
|---|
| 111 |
|
|---|
| 112 | ; x = x + ((x >>8) & 0xff00ff)
|
|---|
| 113 | uxtab16 $x, $x, $x, ror #8
|
|---|
| 114 |
|
|---|
| 115 | ; x &= 0xff00ff00
|
|---|
| 116 | ; x |= r8
|
|---|
| 117 | uxtb16 $x, $x, ror #8
|
|---|
| 118 | orr $dst, r8, $x, lsl #8
|
|---|
| 119 |
|
|---|
| 120 | MEND
|
|---|
| 121 |
|
|---|
| 122 | ;-----------------------------------------------------------------------------
|
|---|
| 123 | ; Armv6 boosted implementation of INTERPOLATE_PIXEL_255(...) function found in
|
|---|
| 124 | ; qdrawhelper_p.h.
|
|---|
| 125 | ;
|
|---|
| 126 | ; @param dst Destination register where to store the result
|
|---|
| 127 | ; @param x First value to multiply
|
|---|
| 128 | ; @param a Multiplicator byte for first value
|
|---|
| 129 | ; @param y Second value to multiply
|
|---|
| 130 | ; @param b Multiplicator byte for second value
|
|---|
| 131 | ; @param r14 Component half 0x800080
|
|---|
| 132 | ;
|
|---|
| 133 | ;
|
|---|
| 134 | ; @note Trashes x, r8, r14
|
|---|
| 135 | ;-----------------------------------------------------------------------------
|
|---|
| 136 | MACRO
|
|---|
| 137 | InterpolatePixel255 $dst, $x, $a, $y, $b
|
|---|
| 138 |
|
|---|
| 139 | ; static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b)
|
|---|
| 140 |
|
|---|
| 141 | ; First calculate the parts where we need 0x800080
|
|---|
| 142 |
|
|---|
| 143 | ; uint r8 = (((x & 0xff00ff) * a) + 0x800080)
|
|---|
| 144 | uxtb16 r8, $x ; r8 = r8 & 0x00FF00FF
|
|---|
| 145 | mla r8, r8, $a, r14
|
|---|
| 146 |
|
|---|
| 147 | ; x = ((((x >> 8) & 0xff00ff) * a) + 0x800080)
|
|---|
| 148 | uxtb16 $x, $x, ror #8
|
|---|
| 149 | mla $x, $x, $a, r14
|
|---|
| 150 |
|
|---|
| 151 | ; Now we are trashing r14 to free it for other purposes
|
|---|
| 152 |
|
|---|
| 153 | ; uint r14 = (y & 0xff00ff) * b
|
|---|
| 154 | uxtb16 r14, $y ; r14 = y & 0x00FF00FF
|
|---|
| 155 | mul r14, r14, $b
|
|---|
| 156 |
|
|---|
| 157 | ; r8 = r8 + r14
|
|---|
| 158 | add r8, r8, r14
|
|---|
| 159 |
|
|---|
| 160 | ; r8 = (r8 + ((r8 >> 8) & 0xff00ff) ) >> 8
|
|---|
| 161 | ; r8 &= 0xff00ff
|
|---|
| 162 | uxtab16 r8, r8, r8, ror #8
|
|---|
| 163 | uxtb16 r8, r8, ror #8
|
|---|
| 164 |
|
|---|
| 165 | ; r14 = ((y >> 8) & 0xff00ff) * b
|
|---|
| 166 | uxtb16 r14, $y, ror #8 ; r14 = ((y >> 8) & 0xFF00FF)
|
|---|
| 167 | mul r14, r14, $b
|
|---|
| 168 |
|
|---|
| 169 | ; x = x + r14
|
|---|
| 170 | add $x, $x, r14
|
|---|
| 171 |
|
|---|
| 172 | ; x = x + ((x >>8) & 0xff00ff)
|
|---|
| 173 | uxtab16 $x, $x, $x, ror #8
|
|---|
| 174 |
|
|---|
| 175 | ; x &= 0xff00ff00
|
|---|
| 176 | ; x |= r8
|
|---|
| 177 | uxtb16 $x, $x, ror #8
|
|---|
| 178 | orr $dst, r8, $x, lsl #8
|
|---|
| 179 |
|
|---|
| 180 | MEND
|
|---|
| 181 |
|
|---|
| 182 | ;-----------------------------------------------------------------------------
|
|---|
| 183 | ;
|
|---|
| 184 | ;-----------------------------------------------------------------------------
|
|---|
| 185 | MACRO
|
|---|
| 186 | $label Blend4Pixels $BlendPixel
|
|---|
| 187 |
|
|---|
| 188 | ; Blend first 4 pixels
|
|---|
| 189 |
|
|---|
| 190 | ldmia r1!, {r4-r7}
|
|---|
| 191 | ldm r0, {r9-r12}
|
|---|
| 192 |
|
|---|
| 193 | b4p1_$label $BlendPixel r9, r4, r3
|
|---|
| 194 | b4p2_$label $BlendPixel r10, r5, r3
|
|---|
| 195 | b4p3_$label $BlendPixel r11, r6, r3
|
|---|
| 196 | b4p4_$label $BlendPixel r12, r7, r3
|
|---|
| 197 |
|
|---|
| 198 | stmia r0!, {r9-r12}
|
|---|
| 199 |
|
|---|
| 200 | MEND
|
|---|
| 201 |
|
|---|
| 202 | ;-----------------------------------------------------------------------------
|
|---|
| 203 | ;
|
|---|
| 204 | ;-----------------------------------------------------------------------------
|
|---|
| 205 | MACRO
|
|---|
| 206 | $label Blend8Pixels $BlendPixel
|
|---|
| 207 |
|
|---|
| 208 | b8p1_$label Blend4Pixels $BlendPixel
|
|---|
| 209 | b8p2_$label Blend4Pixels $BlendPixel
|
|---|
| 210 |
|
|---|
| 211 | MEND
|
|---|
| 212 |
|
|---|
| 213 | ;-----------------------------------------------------------------------------
|
|---|
| 214 | ;
|
|---|
| 215 | ;-----------------------------------------------------------------------------
|
|---|
| 216 | MACRO
|
|---|
| 217 | $label Blend16Pixels $BlendPixel
|
|---|
| 218 |
|
|---|
| 219 | b16p1_$label Blend8Pixels $BlendPixel
|
|---|
| 220 | b16p2_$label Blend8Pixels $BlendPixel
|
|---|
| 221 |
|
|---|
| 222 | MEND
|
|---|
| 223 |
|
|---|
| 224 | ;-----------------------------------------------------------------------------
|
|---|
| 225 | ;
|
|---|
| 226 | ;-----------------------------------------------------------------------------
|
|---|
| 227 | MACRO
|
|---|
| 228 | $label Blend32Pixels $BlendPixel
|
|---|
| 229 |
|
|---|
| 230 | b32p1_$label Blend16Pixels $BlendPixel
|
|---|
| 231 | b32p2_$label Blend16Pixels $BlendPixel
|
|---|
| 232 |
|
|---|
| 233 | MEND
|
|---|
| 234 |
|
|---|
| 235 | ;-----------------------------------------------------------------------------
|
|---|
| 236 | ; A macro for source over compositing one row of pixels and saving the results
|
|---|
| 237 | ; to destination buffer.
|
|---|
| 238 | ;
|
|---|
| 239 | ; @param dest Destination buffer (r0)
|
|---|
| 240 | ; @param src Source buffer (r1)
|
|---|
| 241 | ; @param length Length (r2)
|
|---|
| 242 | ; @param const_alpha Constant alpha (r3)
|
|---|
| 243 | ; @param r14 Component Half (0x800080) (r14)
|
|---|
| 244 | ;
|
|---|
| 245 | ; @note Advances r0, r1
|
|---|
| 246 | ; @note Trashes r2, r4-r12
|
|---|
| 247 | ;-----------------------------------------------------------------------------
|
|---|
| 248 | MACRO
|
|---|
| 249 | $label BlendRow $BlendPixel
|
|---|
| 250 |
|
|---|
| 251 | pld [r1]
|
|---|
| 252 |
|
|---|
| 253 | bloop_$label
|
|---|
| 254 | ; Blend 32 pixels per loop iteration
|
|---|
| 255 | subs r2, r2, #32
|
|---|
| 256 | bmi b_remaining_$label
|
|---|
| 257 |
|
|---|
| 258 | brp1_$label Blend32Pixels $BlendPixel
|
|---|
| 259 |
|
|---|
| 260 | b bloop_$label
|
|---|
| 261 |
|
|---|
| 262 | b_remaining_$label
|
|---|
| 263 |
|
|---|
| 264 | ; Remaining 31 pixels
|
|---|
| 265 |
|
|---|
| 266 | addmi r2, r2, #32
|
|---|
| 267 |
|
|---|
| 268 | ; Blend 16 pixels
|
|---|
| 269 | tst r2, #16
|
|---|
| 270 | beq b_remaining8_$label
|
|---|
| 271 |
|
|---|
| 272 | brp2_$label Blend16Pixels $BlendPixel
|
|---|
| 273 |
|
|---|
| 274 | b_remaining8_$label
|
|---|
| 275 |
|
|---|
| 276 | ; Blend 8 pixels
|
|---|
| 277 | tst r2, #8
|
|---|
| 278 | beq b_remaining4_$label
|
|---|
| 279 |
|
|---|
| 280 | brp3_$label Blend8Pixels $BlendPixel
|
|---|
| 281 |
|
|---|
| 282 | b_remaining4_$label
|
|---|
| 283 |
|
|---|
| 284 | ; Blend 4 pixels
|
|---|
| 285 | tst r2, #4
|
|---|
| 286 | beq b_remaining3_$label
|
|---|
| 287 |
|
|---|
| 288 | brp4_$label Blend4Pixels $BlendPixel
|
|---|
| 289 |
|
|---|
| 290 | b_remaining3_$label
|
|---|
| 291 |
|
|---|
| 292 | ; Remaining 3 pixels
|
|---|
| 293 |
|
|---|
| 294 | tst r2, #2
|
|---|
| 295 | beq b_last_$label
|
|---|
| 296 |
|
|---|
| 297 | ldmia r1!, {r4-r5}
|
|---|
| 298 | ldm r0, {r9-r10}
|
|---|
| 299 |
|
|---|
| 300 | brp5_$label $BlendPixel r9, r4, r3
|
|---|
| 301 | brp6_$label $BlendPixel r10, r5, r3
|
|---|
| 302 |
|
|---|
| 303 | stmia r0!, {r9-r10}
|
|---|
| 304 |
|
|---|
| 305 | b_last_$label
|
|---|
| 306 |
|
|---|
| 307 | tst r2, #1
|
|---|
| 308 | beq bexit_$label
|
|---|
| 309 |
|
|---|
| 310 | ldr r4, [r1]
|
|---|
| 311 | ldr r9, [r0]
|
|---|
| 312 |
|
|---|
| 313 | bpl_$label $BlendPixel r9, r4, r3
|
|---|
| 314 |
|
|---|
| 315 | str r9, [r0]
|
|---|
| 316 |
|
|---|
| 317 | bexit_$label
|
|---|
| 318 |
|
|---|
| 319 | MEND
|
|---|
| 320 |
|
|---|
| 321 | ;-----------------------------------------------------------------------------
|
|---|
| 322 | ; A macro for source over compositing one row of pixels and saving the results
|
|---|
| 323 | ; to destination buffer. Restores all registers.
|
|---|
| 324 | ;
|
|---|
| 325 | ; @param dest Destination buffer (r0)
|
|---|
| 326 | ; @param src Source buffer (r1)
|
|---|
| 327 | ; @param length Length (r2)
|
|---|
| 328 | ; @param const_alpha Constant alpha (r3)
|
|---|
| 329 | ; @param r14 Component Half (0x800080) (r14)
|
|---|
| 330 | ;
|
|---|
| 331 | ; @note Advances r0, r1
|
|---|
| 332 | ; @note Trashes r2, r4-r12
|
|---|
| 333 | ;-----------------------------------------------------------------------------
|
|---|
| 334 | MACRO
|
|---|
| 335 | $label BlendRowSafe $BlendPixel
|
|---|
| 336 |
|
|---|
| 337 | stmfd sp!, {r0-r6} ; Preserves registers only up to r6
|
|---|
| 338 |
|
|---|
| 339 | brs_$label BlendRow $BlendPixel
|
|---|
| 340 |
|
|---|
| 341 | ldmfd sp!, {r0-r6}
|
|---|
| 342 |
|
|---|
| 343 | MEND
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 | ;-----------------------------------------------------------------------------
|
|---|
| 347 | ; Pix Copy.
|
|---|
| 348 | ; NOTE! Cache line size of ARM1136JF-S and ARM1136J-S is 32 bytes (8 pixels).
|
|---|
| 349 | ;
|
|---|
| 350 | ; @param dst Destination pixels (r0)
|
|---|
| 351 | ; @param src Source pixels (r1)
|
|---|
| 352 | ; @param len Length (r2)
|
|---|
| 353 | ;
|
|---|
| 354 | ; @note Trashes r3-r10
|
|---|
| 355 | ;-----------------------------------------------------------------------------
|
|---|
| 356 | MACRO
|
|---|
| 357 | $label PixCpy $dst, $src, $len
|
|---|
| 358 |
|
|---|
| 359 | pld [$src]
|
|---|
| 360 |
|
|---|
| 361 | pcpy_loop_$label
|
|---|
| 362 | ; Copy 8 pixels per loop iteration
|
|---|
| 363 | pld [$src, #96]
|
|---|
| 364 | subs $len, $len, #8
|
|---|
| 365 | ldmgeia $src!, {r3-r10}
|
|---|
| 366 | stmgeia $dst!, {r3-r10}
|
|---|
| 367 | bgt pcpy_loop_$label
|
|---|
| 368 |
|
|---|
| 369 | pcpy_remaining_$label
|
|---|
| 370 |
|
|---|
| 371 | ; Copy up to 7 remaining pixels
|
|---|
| 372 |
|
|---|
| 373 | ; Copy 4 pixels
|
|---|
| 374 | tst $len, #4
|
|---|
| 375 | ldmneia $src!, {r3-r6}
|
|---|
| 376 | stmneia $dst!, {r3-r6}
|
|---|
| 377 |
|
|---|
| 378 | tst $len, #2
|
|---|
| 379 | ldmneia $src!, {r3-r4}
|
|---|
| 380 | stmneia $dst!, {r3-r4}
|
|---|
| 381 |
|
|---|
| 382 | tst $len, #1
|
|---|
| 383 | ldrne r3, [$src]
|
|---|
| 384 | strne r3, [$dst]
|
|---|
| 385 |
|
|---|
| 386 | MEND
|
|---|
| 387 |
|
|---|
| 388 | ;-----------------------------------------------------------------------------
|
|---|
| 389 | ; General Pix Copy. Maximum 8 pixels at time. Restores all registers.
|
|---|
| 390 | ;
|
|---|
| 391 | ; @param dst Destination pixels (r0)
|
|---|
| 392 | ; @param src Source pixels (r1)
|
|---|
| 393 | ; @param len Length (r2)
|
|---|
| 394 | ;
|
|---|
| 395 | ; @note Trashes r3-r10
|
|---|
| 396 | ;-----------------------------------------------------------------------------
|
|---|
| 397 | MACRO
|
|---|
| 398 | $label PixCpySafe $dst, $src, $len
|
|---|
| 399 |
|
|---|
| 400 | stmfd sp!, {r0-r6} ; Preserves registers only up to r6
|
|---|
| 401 |
|
|---|
| 402 | pcs_$label PixCpy $dst, $src, $len
|
|---|
| 403 |
|
|---|
| 404 | ldmfd sp!, {r0-r6} ; pop
|
|---|
| 405 |
|
|---|
| 406 | MEND
|
|---|
| 407 |
|
|---|
| 408 |
|
|---|
| 409 | ;-----------------------------------------------------------------------------
|
|---|
| 410 | ; A macro for source over compositing one pixel and saving the result to
|
|---|
| 411 | ; dst register.
|
|---|
| 412 | ;
|
|---|
| 413 | ; @param dst Destination register, must contain destination pixel upon entry
|
|---|
| 414 | ; @param src Source register, must contain source pixel upon entry
|
|---|
| 415 | ; @param const_alpha Constant source alpha
|
|---|
| 416 | ; @param r14 Component half 0x800080
|
|---|
| 417 | ;
|
|---|
| 418 | ; @note Trashes const_alpha, r8
|
|---|
| 419 | ;-----------------------------------------------------------------------------
|
|---|
| 420 | MACRO
|
|---|
| 421 | $label PixelSourceOver $dst, $src, $const_alpha
|
|---|
| 422 |
|
|---|
| 423 | ; Negate src and extract alpha
|
|---|
| 424 | mvn $const_alpha, $src ; bitwise not
|
|---|
| 425 | uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24);
|
|---|
| 426 |
|
|---|
| 427 | ;cmp $const_alpha, #255 ; test for full transparency ( negated )
|
|---|
| 428 | ;beq exit_$label
|
|---|
| 429 | cmp $const_alpha, #0 ; test for full opacity ( negated )
|
|---|
| 430 | moveq $dst, $src
|
|---|
| 431 | beq exit_$label
|
|---|
| 432 |
|
|---|
| 433 | ByteMul $dst, $dst, $const_alpha
|
|---|
| 434 | add $dst, $src, $dst
|
|---|
| 435 |
|
|---|
| 436 | exit_$label
|
|---|
| 437 | MEND
|
|---|
| 438 |
|
|---|
| 439 | ;-----------------------------------------------------------------------------
|
|---|
| 440 | ; A macro for source over compositing one pixel and saving the result to
|
|---|
| 441 | ; dst register.
|
|---|
| 442 | ;
|
|---|
| 443 | ; @param dst Destination register, must contain destination pixel upon entry
|
|---|
| 444 | ; @param src Source register, must contain source pixel upon entry
|
|---|
| 445 | ; @param const_alpha Constant source alpha
|
|---|
| 446 | ; @param r14 Component half 0x800080
|
|---|
| 447 | ;
|
|---|
| 448 | ; @note Trashes src, const_alpha, r8
|
|---|
| 449 | ;-----------------------------------------------------------------------------
|
|---|
| 450 | MACRO
|
|---|
| 451 | $label PixelSourceOverConstAlpha $dst, $src, $const_alpha
|
|---|
| 452 |
|
|---|
| 453 | ; store alpha because we are going to trash it
|
|---|
| 454 | stmfd sp!, {$const_alpha}
|
|---|
| 455 |
|
|---|
| 456 | ByteMul $src, $src, $const_alpha
|
|---|
| 457 |
|
|---|
| 458 | ; Negate src and extract alpha
|
|---|
| 459 | mvn $const_alpha, $src ; bitwise not
|
|---|
| 460 | uxtb $const_alpha, $const_alpha, ror #24 ; r3 = ((r3 & 0xFF000000) >> 24);
|
|---|
| 461 |
|
|---|
| 462 | ByteMul $dst, $dst, $const_alpha
|
|---|
| 463 |
|
|---|
| 464 | add $dst, $src, $dst
|
|---|
| 465 |
|
|---|
| 466 | ; recover alpha
|
|---|
| 467 | ldmfd sp!, {$const_alpha}
|
|---|
| 468 |
|
|---|
| 469 | MEND
|
|---|
| 470 |
|
|---|
| 471 | ;-----------------------------------------------------------------------------
|
|---|
| 472 | ; A macro for source over compositing one pixel and saving the result to
|
|---|
| 473 | ; a register.
|
|---|
| 474 | ;
|
|---|
| 475 | ; @param dst Destination register, must contain destination pixel upon entry
|
|---|
| 476 | ; @param src Source register, must contain source pixel upon entry
|
|---|
| 477 | ; @param const_alpha Constant source alpha
|
|---|
| 478 | ; @param r14 Component half 0x800080
|
|---|
| 479 | ;
|
|---|
| 480 | ; @note Trashes src, r8
|
|---|
| 481 | ;-----------------------------------------------------------------------------
|
|---|
| 482 | MACRO
|
|---|
| 483 | $label PixelSourceConstAlpha $dst, $src, $const_alpha
|
|---|
| 484 |
|
|---|
| 485 | ; store r2 and r14 because we are going to trash them
|
|---|
| 486 | stmfd sp!, {r2, r14}
|
|---|
| 487 |
|
|---|
| 488 | rsb r2, $const_alpha, #255
|
|---|
| 489 | InterpolatePixel255 $dst, $src, $const_alpha, $dst, r2
|
|---|
| 490 |
|
|---|
| 491 | ; recover r2 and r14
|
|---|
| 492 | ldmfd sp!, {r2, r14}
|
|---|
| 493 |
|
|---|
| 494 | MEND
|
|---|
| 495 |
|
|---|
| 496 | END ; File end
|
|---|