[Title] GraphicsContextState should have a data member lineJoin
authorRashmi Shyamasundar <rashmi.s2@samsung.com>
Tue, 18 Jun 2013 11:15:55 +0000 (16:45 +0530)
committerRashmi Shyamasundar <rashmi.s2@samsung.com>
Thu, 27 Jun 2013 06:09:22 +0000 (11:39 +0530)
[Issue#] N_SE-41312

[Problem] When the application is switched background and foreground, the canvas state is
          saved and restored respectively. If the value of lineJoin is not saved in the
          GraphicsContextState, the canvas will take the default linJoin when it comes
          to foreground.

[Solution] Save the value of lineJoin in GraphicsContextState

[Developer] rashmi.s2@samsung.com

Change-Id: I0331aa4b0809649281a093a294a5c9b3cf10bbed

Source/WTF/wtf/Platform.h
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h [changed mode: 0644->0755]
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp [changed mode: 0644->0755]

index 8a52ed6..10db9d4 100755 (executable)
 #define ENABLE_TIZEN_SUPPORT_COMPLEX_FONTS_SHAPING 1 /* Hyeonji Kim(hyeonji.kim@samsung.com) : Support complex fonts shaping */
 #define ENABLE_TIZEN_FALLBACK_FONTDATA 1 /* Hyeonji Kim(hyeonji.kim@samsung.com) : Add the fallback fontData to FontFallbackList */
 #define ENABLE_TIZEN_COLLECT_HARFBUZZRUN 1 /* Rashmi Shyamasundar(rashmi.s2@samsung.com) Create proper harfBuzzRun for a word which follows a space */
+#define ENABLE_TIZEN_CANVAS_2D_LINE_JOIN 1 /* Rashmi Shyamasundar(rashmi.s2@samsung.com) Save the value of lineJoin in GraphicsContextState */
 
 #define ENABLE_TIZEN_CONTEXTSHADOW_BLUR_NEON 0 /* use neon shadowblur function in ContextShadow.cpp <hyunki.baik@samsung.com> */
 #define ENABLE_TIZEN_ON_AUTHENTICATION_REQUESTED 1 /* Sungman Kim(ssungmai.kim@samsung.com) : Implement to requested authentication signal handling method */
index f8155b7..6cfdaa8 100755 (executable)
@@ -268,6 +268,9 @@ void GraphicsContext::setState(const GraphicsContextState& state)
     setPlatformShouldSmoothFonts(m_state.shouldSmoothFonts);
     setPlatformTextDrawingMode(m_state.textDrawingMode);
     setPlatformCompositeOperation(m_state.compositeOperator);
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+    setPlatformLineJoin(m_state.lineJoin);
+#endif
 }
 #endif
 
old mode 100644 (file)
new mode 100755 (executable)
index b443729..64da126
@@ -153,6 +153,9 @@ namespace WebCore {
     struct GraphicsContextState {
         GraphicsContextState()
             : strokeThickness(0)
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+            , lineJoin(MiterJoin)
+#endif
             , shadowBlur(0)
             , textDrawingMode(TextModeFill)
             , strokeColor(Color::black)
@@ -184,6 +187,9 @@ namespace WebCore {
         FloatSize shadowOffset;
 
         float strokeThickness;
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+        LineJoin lineJoin;
+#endif
         float shadowBlur;
 
         TextDrawingModeFlags textDrawingMode;
@@ -222,6 +228,9 @@ namespace WebCore {
 
         float strokeThickness() const;
         void setStrokeThickness(float);
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+        void setPlatformLineJoin(LineJoin);
+#endif
         StrokeStyle strokeStyle() const;
         void setStrokeStyle(StrokeStyle);
         Color strokeColor() const;
old mode 100644 (file)
new mode 100755 (executable)
index 0c7593f..4e868ad
@@ -805,6 +805,28 @@ void GraphicsContext::setPlatformStrokeThickness(float strokeThickness)
     cairo_set_line_width(platformContext()->cr(), strokeThickness);
 }
 
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+void GraphicsContext::setPlatformLineJoin(LineJoin lineJoin)
+{
+    if (paintingDisabled())
+        return;
+
+    cairo_line_join_t cairoJoin = CAIRO_LINE_JOIN_MITER;
+    switch (lineJoin) {
+    case MiterJoin:
+        // no-op
+        break;
+    case RoundJoin:
+        cairoJoin = CAIRO_LINE_JOIN_ROUND;
+        break;
+    case BevelJoin:
+        cairoJoin = CAIRO_LINE_JOIN_BEVEL;
+        break;
+    }
+    cairo_set_line_join(platformContext()->cr(), cairoJoin);
+}
+#endif
+
 void GraphicsContext::setPlatformStrokeStyle(StrokeStyle strokeStyle)
 {
     static double dashPattern[] = {5.0, 5.0};
@@ -1007,6 +1029,10 @@ void GraphicsContext::setLineJoin(LineJoin lineJoin)
     if (paintingDisabled())
         return;
 
+#if ENABLE(TIZEN_CANVAS_2D_LINE_JOIN)
+    m_state.lineJoin = lineJoin;
+    setPlatformLineJoin(lineJoin);
+#else
     cairo_line_join_t cairoJoin = CAIRO_LINE_JOIN_MITER;
     switch (lineJoin) {
     case MiterJoin:
@@ -1020,6 +1046,7 @@ void GraphicsContext::setLineJoin(LineJoin lineJoin)
         break;
     }
     cairo_set_line_join(platformContext()->cr(), cairoJoin);
+#endif
 }
 
 void GraphicsContext::setMiterLimit(float miter)