OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "bindings/v8/ExceptionMessages.h" | 37 #include "bindings/v8/ExceptionMessages.h" |
38 #include "bindings/v8/ExceptionState.h" | 38 #include "bindings/v8/ExceptionState.h" |
39 #include "bindings/v8/ExceptionStatePlaceholder.h" | 39 #include "bindings/v8/ExceptionStatePlaceholder.h" |
40 #include "core/accessibility/AXObjectCache.h" | 40 #include "core/accessibility/AXObjectCache.h" |
41 #include "core/css/CSSFontSelector.h" | 41 #include "core/css/CSSFontSelector.h" |
42 #include "core/css/parser/BisonCSSParser.h" | 42 #include "core/css/parser/BisonCSSParser.h" |
43 #include "core/css/StylePropertySet.h" | 43 #include "core/css/StylePropertySet.h" |
44 #include "core/css/resolver/StyleResolver.h" | 44 #include "core/css/resolver/StyleResolver.h" |
45 #include "core/dom/ExceptionCode.h" | 45 #include "core/dom/ExceptionCode.h" |
46 #include "core/fetch/ImageResource.h" | 46 #include "core/fetch/ImageResource.h" |
| 47 #include "core/frame/ImageBitmap.h" |
47 #include "core/html/HTMLCanvasElement.h" | 48 #include "core/html/HTMLCanvasElement.h" |
48 #include "core/html/HTMLImageElement.h" | 49 #include "core/html/HTMLImageElement.h" |
49 #include "core/html/HTMLMediaElement.h" | 50 #include "core/html/HTMLMediaElement.h" |
50 #include "core/html/HTMLVideoElement.h" | 51 #include "core/html/HTMLVideoElement.h" |
51 #include "core/html/ImageData.h" | 52 #include "core/html/ImageData.h" |
52 #include "core/html/TextMetrics.h" | 53 #include "core/html/TextMetrics.h" |
53 #include "core/html/canvas/CanvasGradient.h" | 54 #include "core/html/canvas/CanvasGradient.h" |
54 #include "core/html/canvas/CanvasPattern.h" | 55 #include "core/html/canvas/CanvasPattern.h" |
55 #include "core/html/canvas/CanvasStyle.h" | 56 #include "core/html/canvas/CanvasStyle.h" |
56 #include "core/html/canvas/DOMPath.h" | 57 #include "core/html/canvas/DOMPath2D.h" |
57 #include "core/frame/ImageBitmap.h" | |
58 #include "core/rendering/RenderImage.h" | 58 #include "core/rendering/RenderImage.h" |
59 #include "core/rendering/RenderLayer.h" | 59 #include "core/rendering/RenderLayer.h" |
60 #include "core/rendering/RenderTheme.h" | 60 #include "core/rendering/RenderTheme.h" |
61 #include "platform/fonts/FontCache.h" | 61 #include "platform/fonts/FontCache.h" |
62 #include "platform/geometry/FloatQuad.h" | 62 #include "platform/geometry/FloatQuad.h" |
63 #include "platform/graphics/GraphicsContextStateSaver.h" | 63 #include "platform/graphics/GraphicsContextStateSaver.h" |
64 #include "platform/graphics/DrawLooper.h" | 64 #include "platform/graphics/DrawLooper.h" |
65 #include "platform/text/TextRun.h" | 65 #include "platform/text/TextRun.h" |
66 #include "platform/weborigin/SecurityOrigin.h" | 66 #include "platform/weborigin/SecurityOrigin.h" |
67 #include "wtf/CheckedArithmetic.h" | 67 #include "wtf/CheckedArithmetic.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 if (state().m_fillStyle && state().m_fillStyle->isEquivalentCMYKA(c, m, y, k
, a)) | 810 if (state().m_fillStyle && state().m_fillStyle->isEquivalentCMYKA(c, m, y, k
, a)) |
811 return; | 811 return; |
812 setFillStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a)); | 812 setFillStyle(CanvasStyle::createFromCMYKAChannels(c, m, y, k, a)); |
813 } | 813 } |
814 | 814 |
815 void CanvasRenderingContext2D::beginPath() | 815 void CanvasRenderingContext2D::beginPath() |
816 { | 816 { |
817 m_path.clear(); | 817 m_path.clear(); |
818 } | 818 } |
819 | 819 |
820 PassRefPtr<DOMPath> CanvasRenderingContext2D::currentPath() | 820 PassRefPtr<DOMPath2D> CanvasRenderingContext2D::currentPath() |
821 { | 821 { |
822 return DOMPath::create(m_path); | 822 return DOMPath2D::create(m_path); |
823 } | 823 } |
824 | 824 |
825 void CanvasRenderingContext2D::setCurrentPath(DOMPath* path) | 825 void CanvasRenderingContext2D::setCurrentPath(DOMPath2D* path) |
826 { | 826 { |
827 if (!path) | 827 if (!path) |
828 return; | 828 return; |
829 m_path = path->path(); | 829 m_path = path->path(); |
830 } | 830 } |
831 | 831 |
832 static bool validateRectForCanvas(float& x, float& y, float& width, float& heigh
t) | 832 static bool validateRectForCanvas(float& x, float& y, float& width, float& heigh
t) |
833 { | 833 { |
834 if (!std::isfinite(x) | !std::isfinite(y) | !std::isfinite(width) | !std::is
finite(height)) | 834 if (!std::isfinite(x) | !std::isfinite(y) | !std::isfinite(width) | !std::is
finite(height)) |
835 return false; | 835 return false; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 } | 916 } |
917 | 917 |
918 c->setFillRule(windRule); | 918 c->setFillRule(windRule); |
919 } | 919 } |
920 | 920 |
921 void CanvasRenderingContext2D::fill(const String& windingRuleString) | 921 void CanvasRenderingContext2D::fill(const String& windingRuleString) |
922 { | 922 { |
923 fillInternal(m_path, windingRuleString); | 923 fillInternal(m_path, windingRuleString); |
924 } | 924 } |
925 | 925 |
926 void CanvasRenderingContext2D::fill(DOMPath* domPath, const String& windingRuleS
tring) | 926 void CanvasRenderingContext2D::fill(DOMPath2D* domPath, const String& windingRul
eString) |
927 { | 927 { |
928 fillInternal(domPath->path(), windingRuleString); | 928 fillInternal(domPath->path(), windingRuleString); |
929 } | 929 } |
930 | 930 |
931 void CanvasRenderingContext2D::strokeInternal(const Path& path) | 931 void CanvasRenderingContext2D::strokeInternal(const Path& path) |
932 { | 932 { |
933 if (path.isEmpty()) { | 933 if (path.isEmpty()) { |
934 return; | 934 return; |
935 } | 935 } |
936 GraphicsContext* c = drawingContext(); | 936 GraphicsContext* c = drawingContext(); |
(...skipping 17 matching lines...) Expand all Loading... |
954 c->strokePath(path); | 954 c->strokePath(path); |
955 didDraw(dirtyRect); | 955 didDraw(dirtyRect); |
956 } | 956 } |
957 } | 957 } |
958 | 958 |
959 void CanvasRenderingContext2D::stroke() | 959 void CanvasRenderingContext2D::stroke() |
960 { | 960 { |
961 strokeInternal(m_path); | 961 strokeInternal(m_path); |
962 } | 962 } |
963 | 963 |
964 void CanvasRenderingContext2D::stroke(DOMPath* domPath) | 964 void CanvasRenderingContext2D::stroke(DOMPath2D* domPath) |
965 { | 965 { |
966 strokeInternal(domPath->path()); | 966 strokeInternal(domPath->path()); |
967 } | 967 } |
968 | 968 |
969 void CanvasRenderingContext2D::clipInternal(const Path& path, const String& wind
ingRuleString) | 969 void CanvasRenderingContext2D::clipInternal(const Path& path, const String& wind
ingRuleString) |
970 { | 970 { |
971 GraphicsContext* c = drawingContext(); | 971 GraphicsContext* c = drawingContext(); |
972 if (!c) { | 972 if (!c) { |
973 return; | 973 return; |
974 } | 974 } |
975 if (!state().m_invertibleCTM) { | 975 if (!state().m_invertibleCTM) { |
976 return; | 976 return; |
977 } | 977 } |
978 | 978 |
979 WindRule newWindRule = RULE_NONZERO; | 979 WindRule newWindRule = RULE_NONZERO; |
980 if (!parseWinding(windingRuleString, newWindRule)) { | 980 if (!parseWinding(windingRuleString, newWindRule)) { |
981 return; | 981 return; |
982 } | 982 } |
983 | 983 |
984 realizeSaves(); | 984 realizeSaves(); |
985 c->canvasClip(path, newWindRule); | 985 c->canvasClip(path, newWindRule); |
986 } | 986 } |
987 | 987 |
988 void CanvasRenderingContext2D::clip(const String& windingRuleString) | 988 void CanvasRenderingContext2D::clip(const String& windingRuleString) |
989 { | 989 { |
990 clipInternal(m_path, windingRuleString); | 990 clipInternal(m_path, windingRuleString); |
991 } | 991 } |
992 | 992 |
993 void CanvasRenderingContext2D::clip(DOMPath* domPath, const String& windingRuleS
tring) | 993 void CanvasRenderingContext2D::clip(DOMPath2D* domPath, const String& windingRul
eString) |
994 { | 994 { |
995 clipInternal(domPath->path(), windingRuleString); | 995 clipInternal(domPath->path(), windingRuleString); |
996 } | 996 } |
997 | 997 |
998 bool CanvasRenderingContext2D::isPointInPath(const float x, const float y, const
String& windingRuleString) | 998 bool CanvasRenderingContext2D::isPointInPath(const float x, const float y, const
String& windingRuleString) |
999 { | 999 { |
1000 GraphicsContext* c = drawingContext(); | 1000 GraphicsContext* c = drawingContext(); |
1001 if (!c) | 1001 if (!c) |
1002 return false; | 1002 return false; |
1003 if (!state().m_invertibleCTM) | 1003 if (!state().m_invertibleCTM) |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 const int focusRingWidth = 5; | 2435 const int focusRingWidth = 5; |
2436 const int focusRingOutline = 0; | 2436 const int focusRingOutline = 0; |
2437 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2437 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2438 | 2438 |
2439 c->restore(); | 2439 c->restore(); |
2440 | 2440 |
2441 didDraw(dirtyRect); | 2441 didDraw(dirtyRect); |
2442 } | 2442 } |
2443 | 2443 |
2444 } // namespace WebCore | 2444 } // namespace WebCore |
OLD | NEW |