From 0920404a96ee3478a9701c06d1cb2f4309c3c275 Mon Sep 17 00:00:00 2001 From: Rashmi Shyamasundar Date: Tue, 18 Jun 2013 16:45:55 +0530 Subject: [PATCH] [Title] GraphicsContextState should have a data member lineJoin [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 | 1 + .../WebCore/platform/graphics/GraphicsContext.cpp | 3 +++ Source/WebCore/platform/graphics/GraphicsContext.h | 9 ++++++++ .../graphics/cairo/GraphicsContextCairo.cpp | 27 ++++++++++++++++++++++ 4 files changed, 40 insertions(+) mode change 100644 => 100755 Source/WebCore/platform/graphics/GraphicsContext.h mode change 100644 => 100755 Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 8a52ed6..10db9d4 100755 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -441,6 +441,7 @@ #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 */ #define ENABLE_TIZEN_ON_AUTHENTICATION_REQUESTED 1 /* Sungman Kim(ssungmai.kim@samsung.com) : Implement to requested authentication signal handling method */ diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index f8155b7..6cfdaa8 100755 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -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 diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h old mode 100644 new mode 100755 index b443729..64da126 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -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; diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp old mode 100644 new mode 100755 index 0c7593f..4e868ad --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -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) -- 2.7.4