uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 8 10534483575f
equal deleted inserted replaced
0:15bf7259bb7c 3:d8a3531bc6b8
   298     iImagePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   298     iImagePath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   299                               5, 8, VG_PATH_CAPABILITY_APPEND_TO | VG_PATH_CAPABILITY_MODIFY);
   299                               5, 8, VG_PATH_CAPABILITY_APPEND_TO | VG_PATH_CAPABILITY_MODIFY);
   300     iArcPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   300     iArcPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   301                             2, 7, VG_PATH_CAPABILITY_APPEND_TO);
   301                             2, 7, VG_PATH_CAPABILITY_APPEND_TO);
   302     iPaint = vgCreatePaint();
   302     iPaint = vgCreatePaint();
       
   303     iPaintColor = 0;
       
   304     vgSetColor(iPaint, iPaintColor);
   303     iGradientPaint = vgCreatePaint();
   305     iGradientPaint = vgCreatePaint();
   304     iBlendMode = VG_BLEND_SRC_OVER;
   306     iBlendMode = VG_BLEND_SRC_OVER;
   305 
   307 
   306     // Initialize a rectangle path with dummy coordinates
   308     // Initialize a rectangle path with dummy coordinates
   307     iRectPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   309     iRectPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
   705 void CHuiVg10Gc::SetDimmingFog(const TRgb& /*aColor*/, TReal32 /*aAmount*/) __SOFTFP
   707 void CHuiVg10Gc::SetDimmingFog(const TRgb& /*aColor*/, TReal32 /*aAmount*/) __SOFTFP
   706     {
   708     {
   707     // Fog not supported
   709     // Fog not supported
   708     }
   710     }
   709 
   711 
       
   712 void CHuiVg10Gc::Clear(const TRect& aRect)
       
   713     {
       
   714     HUI_VG_INVARIANT();
       
   715     
       
   716     UpdateClientMatrix();
       
   717 
       
   718     THuiRealRect transformed = aRect;
       
   719     iMatrixStack->Current().Multiply(transformed.iTl);
       
   720     iMatrixStack->Current().Multiply(transformed.iBr);
       
   721         
       
   722     // Normalize the rectangle
       
   723     if (transformed.iTl.iX > transformed.iBr.iX)
       
   724         {
       
   725         TReal32 tmp = transformed.iTl.iX;
       
   726         transformed.iTl.iX = transformed.iBr.iX;
       
   727         transformed.iBr.iX = tmp;
       
   728         }
       
   729     if (transformed.iTl.iY > transformed.iBr.iY)
       
   730         {
       
   731         TReal32 tmp = transformed.iTl.iY;
       
   732         transformed.iTl.iY = transformed.iBr.iY;
       
   733         transformed.iBr.iY = tmp;
       
   734         }            
       
   735     VGfloat scale = 1.0f / 255.0f;
       
   736     VGfloat color[] = 
       
   737         {
       
   738         PenColor().Red()   * scale,
       
   739         PenColor().Green() * scale,
       
   740         PenColor().Blue()  * scale,
       
   741         PenAlpha() * scale
       
   742         };
       
   743 
       
   744     vgSetfv(VG_CLEAR_COLOR, 4, color);
       
   745     vgClear(transformed.iTl.iX, transformed.iTl.iY, transformed.Width(), transformed.Height());
       
   746     HUI_VG_INVARIANT();
       
   747     }
   710 
   748 
   711 void CHuiVg10Gc::Clear()
   749 void CHuiVg10Gc::Clear()
   712     {
   750     {
   713     HUI_VG_INVARIANT();
   751     HUI_VG_INVARIANT();
   714     TInt x = ProjectionViewport().iTl.iX;
   752     TInt x = ProjectionViewport().iTl.iX;
   939 #if defined(RENDER_DEBUG_RECTANGLES)
   977 #if defined(RENDER_DEBUG_RECTANGLES)
   940     color = Math::Random() | 0xff;
   978     color = Math::Random() | 0xff;
   941 #endif
   979 #endif
   942     
   980     
   943     // Update the color of the current paint
   981     // Update the color of the current paint
   944     vgSetColor(iPaint, color);
   982     // if required
       
   983     if (iPaintColor != color)
       
   984         {
       
   985         vgSetColor(iPaint, color);
       
   986         iPaintColor = color;
       
   987         }
   945     
   988     
   946     // Detect white fully opaque color
   989     // Detect white fully opaque color
   947     if (color == 0xffffffff)
   990     if (color == 0xffffffff)
   948         {
   991         {
   949         vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL);
   992         vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_NORMAL);
  1048     vgTranslate(aDestRect.iTl.iX, aDestRect.iTl.iY);
  1091     vgTranslate(aDestRect.iTl.iX, aDestRect.iTl.iY);
  1049     vgScale(scaleX, scaleY);
  1092     vgScale(scaleX, scaleY);
  1050     vgTranslate(-srcX, -srcY);
  1093     vgTranslate(-srcX, -srcY);
  1051 
  1094 
  1052 #ifdef __NVG
  1095 #ifdef __NVG
  1053     if ( isExtended && texture.IsNvgContent())
  1096     if ( isExtended )
  1054         {
  1097         {
  1055         // Determine the size to which we want to draw the NVG icon paths
  1098         // Determine the size to which we want to draw the NVG icon paths
  1056         TSize contentSize( HUI_ROUND_FLOAT_TO_INT(aDestRect.Width()),
  1099         TSize contentSize( HUI_ROUND_FLOAT_TO_INT(aDestRect.Width()),
  1057                 HUI_ROUND_FLOAT_TO_INT(aDestRect.Height()) );
  1100                 HUI_ROUND_FLOAT_TO_INT(aDestRect.Height()) );
  1058         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  1101         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  1161     
  1204     
  1162 #ifdef __NVG
  1205 #ifdef __NVG
  1163     const CHuiVg10Texture& texture = static_cast<const CHuiVg10Texture&>( aTexture );
  1206     const CHuiVg10Texture& texture = static_cast<const CHuiVg10Texture&>( aTexture );
  1164     TBool isExtended = texture.IsExtended();
  1207     TBool isExtended = texture.IsExtended();
  1165     
  1208     
  1166     if (isExtended && texture.IsNvgContent())
  1209     if (isExtended)
  1167         {
  1210         {
  1168         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  1211         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  1169         TSize contentSize(0, 0);
  1212         TSize contentSize(0, 0);
  1170         contentSize.SetSize( HUI_ROUND_FLOAT_TO_INT( aDestRect.Width() ),
  1213         contentSize.SetSize( HUI_ROUND_FLOAT_TO_INT( aDestRect.Width() ),
  1171             HUI_ROUND_FLOAT_TO_INT( aDestRect.Height() ) );
  1214             HUI_ROUND_FLOAT_TO_INT( aDestRect.Height() ) );