egl/sfegltest/src/vgline.cpp
branchbug235_bringup_0
changeset 211 3804ba25b23f
child 215 097e92a68d68
equal deleted inserted replaced
210:da03feddbab7 211:3804ba25b23f
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 
       
    15 #include "vgline.h"
       
    16 
       
    17 CVGLine* CVGLine::NewL(RWindow& aWindow)
       
    18     {
       
    19     CVGLine* self = new (ELeave) CVGLine(aWindow);
       
    20     CleanupStack::PushL(self);
       
    21     self->ConstructL();
       
    22     CleanupStack::Pop(self);
       
    23     return self;
       
    24     }
       
    25 
       
    26 CVGLine::CVGLine(RWindow& aWindow)
       
    27     :   CEGLRendering(aWindow)
       
    28     {
       
    29     }
       
    30 
       
    31 void CVGLine::KhrSetup()
       
    32     {
       
    33     static VGubyte const Segments[] =
       
    34         {
       
    35         VG_MOVE_TO_ABS,
       
    36         VG_LINE_TO_REL,
       
    37         VG_CLOSE_PATH
       
    38         };
       
    39 
       
    40     static VGfloat const Coords[] =
       
    41         {
       
    42         110, 35,
       
    43         50, 160,
       
    44         };
       
    45 
       
    46     VGfloat strokeColor[4]  = {1.f, 0.f, 0.f, 1.f};
       
    47 
       
    48     RDebug::Printf("[EBT] CVGLine::KhrSetup vgCreatePaint");
       
    49     iVGPaint = vgCreatePaint();
       
    50     VGCheckError();
       
    51 
       
    52     RDebug::Printf("[EBT] CVGLine::KhrSetup vgSetParameterX");
       
    53     vgSetParameteri(iVGPaint, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR);
       
    54     VGCheckError();
       
    55     vgSetParameterfv(iVGPaint, VG_PAINT_COLOR, 4, strokeColor);
       
    56     VGCheckError();
       
    57 
       
    58     RDebug::Printf("[EBT] CVGLine::KhrSetup vgCreatePath");
       
    59     iVGPath = vgCreatePath(VG_PATH_FORMAT_STANDARD,
       
    60                             VG_PATH_DATATYPE_F,
       
    61                             1.0f, // scale
       
    62                             0.0f, // bias
       
    63                             3,    // segmentCapacityHint
       
    64                             4,    // coordCapacityHint
       
    65                             VG_PATH_CAPABILITY_ALL);
       
    66     VGCheckError();
       
    67 
       
    68     RDebug::Printf("[EBT] CVGLine::KhrSetup vgAppendPathData");
       
    69     vgAppendPathData(iVGPath, sizeof(Segments), Segments, Coords);
       
    70     VGCheckError();
       
    71     }
       
    72 
       
    73 void CVGLine::KhrPaint()
       
    74     {
       
    75     RDebug::Printf("[EBT] CVGLine::KhrPaint vgSetPaint");
       
    76     vgSetPaint(iVGPaint, VG_STROKE_PATH);
       
    77     VGCheckError();
       
    78 
       
    79     RDebug::Printf("[EBT] CVGLine::KhrPaint vgDrawPath");
       
    80     vgDrawPath(iVGPath, VG_STROKE_PATH);
       
    81     VGCheckError();
       
    82     }
       
    83