uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp
branchRCL_3
changeset 12 f93c875b566e
parent 9 3ac8bf5c5014
equal deleted inserted replaced
10:7c5dd702d6d3 12:f93c875b566e
   103     vgDestroyPath(iBorderPath);
   103     vgDestroyPath(iBorderPath);
   104     vgDestroyPath(iArcPath);
   104     vgDestroyPath(iArcPath);
   105     vgDestroyPaint(iPaint);
   105     vgDestroyPaint(iPaint);
   106     vgDestroyPaint(iGradientPaint);
   106     vgDestroyPaint(iGradientPaint);
   107     vgDestroyPath(iEllipsePath);
   107     vgDestroyPath(iEllipsePath);
       
   108     
       
   109     iTempRegion.Close();
   108     }
   110     }
   109     
   111     
   110 
   112 
   111 void CHuiVg10Gc::Push(THuiGcMatrix aMatrix)
   113 void CHuiVg10Gc::Push(THuiGcMatrix aMatrix)
   112     {
   114     {
   976     VGuint color = (PenColor().Internal() << 8) | PenAlpha();
   978     VGuint color = (PenColor().Internal() << 8) | PenAlpha();
   977     
   979     
   978 #if defined(RENDER_DEBUG_RECTANGLES)
   980 #if defined(RENDER_DEBUG_RECTANGLES)
   979     color = Math::Random() | 0xff;
   981     color = Math::Random() | 0xff;
   980 #endif
   982 #endif
   981     
   983     vgSetPaint(iPaint, VG_FILL_PATH | VG_STROKE_PATH);
   982     // Update the color of the current paint
   984    // Update the color of the current paint
   983     // if required
   985     // if required
   984     if (iPaintColor != color)
   986     if (iPaintColor != color)
   985         {
   987         {
   986         vgSetColor(iPaint, color);
   988         vgSetColor(iPaint, color);
   987         iPaintColor = color;
   989         iPaintColor = color;
  2083         {
  2085         {
  2084         0.0f,  aStartColor.Red() * scale, aStartColor.Green() * scale, aStartColor.Blue() * scale, aStartOpacity,
  2086         0.0f,  aStartColor.Red() * scale, aStartColor.Green() * scale, aStartColor.Blue() * scale, aStartOpacity,
  2085         1.0f,  aEndColor.Red()   * scale, aEndColor.Green()   * scale, aEndColor.Blue()   * scale, aEndOpacity,
  2087         1.0f,  aEndColor.Red()   * scale, aEndColor.Green()   * scale, aEndColor.Blue()   * scale, aEndOpacity,
  2086         };
  2088         };
  2087     
  2089     
       
  2090 
  2088     vgSetParameterfv(iGradientPaint, VG_PAINT_LINEAR_GRADIENT, 2 * 2, gradientCoords);
  2091     vgSetParameterfv(iGradientPaint, VG_PAINT_LINEAR_GRADIENT, 2 * 2, gradientCoords);
  2089     vgSetParameterfv(iGradientPaint, VG_PAINT_COLOR_RAMP_STOPS, 2 * 5, gradientStops);
  2092     vgSetParameterfv(iGradientPaint, VG_PAINT_COLOR_RAMP_STOPS, 2 * 5, gradientStops);
  2090     vgSetPaint(iGradientPaint, VG_FILL_PATH);
  2093     vgSetPaint(iGradientPaint, VG_FILL_PATH);
  2091     HUI_VG_INVARIANT();
  2094     HUI_VG_INVARIANT();
  2092 
  2095 
  2093     UpdateColor();
       
  2094     UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  2096     UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  2095     
  2097     
  2096     // Draw the gradient as an image if we have a texture, otherwise draw a regular rectangle
  2098     // Draw the gradient as an image if we have a texture, otherwise draw a regular rectangle
  2097     if (aTexCoords)
  2099     if (aTexCoords)
  2098         {
  2100         {
  2115         
  2117         
  2116         const MHuiSegmentedTexture* tex = surface->BoundTexture();
  2118         const MHuiSegmentedTexture* tex = surface->BoundTexture();
  2117 
  2119 
  2118         if (!tex)
  2120         if (!tex)
  2119             {
  2121             {
  2120             DrawRect(aRect);
  2122             UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
       
  2123             vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
       
  2124             
       
  2125             vgTranslate(aRect.iTl.iX, aRect.iTl.iY);
       
  2126             vgScale(aRect.Width(),aRect.Height());
       
  2127             
       
  2128             vgDrawPath(iRectPath, VG_FILL_PATH);
       
  2129             
       
  2130             vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
       
  2131             UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  2121             }
  2132             }
  2122         else
  2133         else
  2123             {
  2134             {
  2124             vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_MULTIPLY); // Will be restored by next call to UpdateColor()
  2135             vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_MULTIPLY); // Will be restored by next call to UpdateColor()
  2125             DrawTexture(*tex, *aTexCoords, aRect);
  2136             DrawTexture(*tex, *aTexCoords, aRect);
  2126             }
  2137             }
  2127         }
  2138         }
  2128     else
  2139     else
  2129         {
  2140         {
  2130         DrawRect(aRect);
  2141         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
  2131         }
  2142         vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
  2132     HUI_VG_INVARIANT();
  2143         
  2133     
  2144         vgTranslate(aRect.iTl.iX, aRect.iTl.iY);
  2134     // Restore the original paint
  2145         vgScale(aRect.Width(),aRect.Height());
  2135     vgSetPaint(iPaint, VG_FILL_PATH | VG_STROKE_PATH);
  2146         
       
  2147         vgDrawPath(iRectPath, VG_FILL_PATH);
       
  2148         
       
  2149         vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
       
  2150         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
       
  2151         }
       
  2152     HUI_VG_INVARIANT();
       
  2153     
       
  2154     // Restore the original color & paint
  2136     UpdateColor();
  2155     UpdateColor();
  2137     }
  2156     }
  2138 
  2157 
  2139 
  2158 
  2140 void CHuiVg10Gc::SetDepthOffset(TInt /*aOffset*/)
  2159 void CHuiVg10Gc::SetDepthOffset(TInt /*aOffset*/)