javauis/lcdui_akn/javalcdui/inc.nokialcdui/TMIDTriangleFiller.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Triangle filler.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TMIDTRIANGLEFILLER_H
       
    21 #define TMIDTRIANGLEFILLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32def.h>
       
    25 
       
    26 
       
    27 //  CONSTANTS
       
    28 const TInt KShift = 8;
       
    29 
       
    30 //  MACROS
       
    31 #define FPDIV( x, y ) ( ( ( x ) << KShift ) / ( y ) )
       
    32 
       
    33 
       
    34 
       
    35 //  CLASS DEFINITION
       
    36 /**
       
    37  * Triangle filler.
       
    38  *
       
    39  */
       
    40 NONSHARABLE_CLASS(TMIDTriangleFiller)    // usually not derived
       
    41 {
       
    42 public:     // Constructors and destructors
       
    43     void Construct(TInt aX1, TInt aY1,
       
    44                    TInt aX2, TInt aY2,
       
    45                    TInt aX3, TInt aY3);
       
    46 
       
    47 public:     // New methods
       
    48     void GetNextPixelRun(TBool& aExists, TInt& aScanLine,
       
    49                          TInt& aStart, TInt& aEnd);
       
    50 
       
    51 private:    // New methods
       
    52 
       
    53     void ConstructNormalCase();
       
    54     void ConstructSpecialCaseOne();
       
    55     void ConstructSpecialCaseTwo();
       
    56     void ConstructSingleLine();
       
    57     void SecondHalf();
       
    58 
       
    59     inline void SwapPoints(TInt& aX1, TInt& aY1,
       
    60                            TInt& aX2, TInt& aY2);
       
    61 
       
    62 private:    // Data
       
    63     TInt iX1;
       
    64     TInt iY1;
       
    65     TInt iX2;
       
    66     TInt iY2;
       
    67     TInt iX3;
       
    68     TInt iY3;
       
    69     TInt iRightDelta;
       
    70     TInt iLeftDelta;
       
    71     TInt iScanlines;
       
    72     TInt iSpanStart;
       
    73     TInt iSpanStop;
       
    74     TInt iDx12;
       
    75     TInt iDx23;
       
    76     TInt iDx13;
       
    77     TBool iNormalCase;
       
    78 };
       
    79 
       
    80 void TMIDTriangleFiller::SwapPoints(TInt& aX1, TInt& aY1,
       
    81                                     TInt& aX2, TInt& aY2)
       
    82 {
       
    83     TInt temp(aX1);
       
    84     aX1 = aX2;
       
    85     aX2 = temp;
       
    86     temp = aY1;
       
    87     aY1 = aY2;
       
    88     aY2 = temp;
       
    89 };
       
    90 
       
    91 #endif // TMIDTRIANGLEFILLER_H
       
    92 
       
    93 
       
    94