svgtopt/gfx2d/src/GfxRenderer/GfxDrawHLine.s
changeset 46 88edb906c587
equal deleted inserted replaced
-1:000000000000 46:88edb906c587
       
     1 /*
       
     2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Graphics Extension Library source file
       
    15  *
       
    16 */
       
    17 
       
    18 @
       
    19 @   DrawHLine - Draw a horizontal line Fast!
       
    20 @
       
    21 @       Draws a horizontal line using a very fast inner loop which writes pixels
       
    22 @   in pairs.  If either the first and/or last pixels are not aligned to a
       
    23 @   4 byte boundary, they are masked into the frame buffer appropriately.
       
    24 @
       
    25 @       Entry Parameters:
       
    26 @
       
    27 @       r0 = pBuffer.
       
    28 @       r1 = Color (High 16 bits must be zero).
       
    29 @       r2 = LeftX.
       
    30 @       r3 = Width (Can be zero).
       
    31 
       
    32         .align  2
       
    33         .globl  DrawHLine__20TGfxPolygonRendererPPUsUlii
       
    34         .thumb_func
       
    35         .code   16
       
    36 
       
    37 DrawHLine__20TGfxPolygonRendererPPUsUlii:
       
    38 
       
    39         push    {r4}
       
    40         mov     r4, #3          @ Round pointer to 4 byte boundary.
       
    41         bic     r0, r0, r4
       
    42         lsl     r4, r1, #16
       
    43         lsr     r2, r2, #1      @ First pixel aligned to 4 byte boundary?
       
    44         bcc     skip                    @ Yes, skip to loop.
       
    45 
       
    46         sub     r3, r3, #1              @ No, decrement count.
       
    47         bcc     exit            @ Width was 0!
       
    48 
       
    49         ldrh    r2, [r0]        @ Draw first pixel with masking.
       
    50         orr     r2, r2, r4
       
    51         stmia   r0!, {r2}
       
    52 skip:   sub     r3, r3, #1      @ Two or more pixels remaining?
       
    53         bls     last                    @ No, skip to last pixel.
       
    54 
       
    55         orr     r4, r4, r1              @ Yes, combine two pixel patterns.
       
    56 loop:   stmia   r0!, {r4}       @ Loop to draw aligned pixel pairs.
       
    57         sub     r3, r3, #2
       
    58         bhi     loop                    @ Two or more pixels remain.
       
    59 
       
    60 last:   bcc     exit            @ Last pixel remaining?
       
    61 
       
    62         ldrh    r4, [r0, #2]            @ Yes, draw last pixel with masking.
       
    63         lsl     r4, r4, #16
       
    64         orr     r4, r4, r1
       
    65         str     r4, [r0]
       
    66 exit:   pop     {r4}
       
    67         bx      lr
       
    68