| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "core/html/canvas/Canvas2DContextAttributes.h" | 29 #include "core/html/canvas/Canvas2DContextAttributes.h" |
| 30 #include "core/html/canvas/CanvasPathMethods.h" | 30 #include "core/html/canvas/CanvasPathMethods.h" |
| 31 #include "core/html/canvas/CanvasRenderingContext.h" | 31 #include "core/html/canvas/CanvasRenderingContext.h" |
| 32 #include "core/platform/graphics/Color.h" | 32 #include "core/platform/graphics/Color.h" |
| 33 #include "core/platform/graphics/FloatSize.h" | 33 #include "core/platform/graphics/FloatSize.h" |
| 34 #include "core/platform/graphics/Font.h" | 34 #include "core/platform/graphics/Font.h" |
| 35 #include "core/platform/graphics/GraphicsTypes.h" | 35 #include "core/platform/graphics/GraphicsTypes.h" |
| 36 #include "core/platform/graphics/ImageBuffer.h" | 36 #include "core/platform/graphics/ImageBuffer.h" |
| 37 #include "core/platform/graphics/Path.h" | 37 #include "core/platform/graphics/Path.h" |
| 38 #include "core/platform/graphics/transforms/AffineTransform.h" | 38 #include "core/platform/graphics/transforms/AffineTransform.h" |
| 39 #include "core/svg/SVGMatrix.h" |
| 40 #include "core/svg/properties/SVGPropertyTearOff.h" |
| 39 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
| 40 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 41 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 42 | 44 |
| 43 namespace WebKit { class WebLayer; } | 45 namespace WebKit { class WebLayer; } |
| 44 | 46 |
| 45 namespace WebCore { | 47 namespace WebCore { |
| 46 | 48 |
| 47 class CanvasGradient; | 49 class CanvasGradient; |
| 48 class CanvasPattern; | 50 class CanvasPattern; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 112 |
| 111 float globalAlpha() const; | 113 float globalAlpha() const; |
| 112 void setGlobalAlpha(float); | 114 void setGlobalAlpha(float); |
| 113 | 115 |
| 114 String globalCompositeOperation() const; | 116 String globalCompositeOperation() const; |
| 115 void setGlobalCompositeOperation(const String&); | 117 void setGlobalCompositeOperation(const String&); |
| 116 | 118 |
| 117 void save() { ++m_unrealizedSaveCount; } | 119 void save() { ++m_unrealizedSaveCount; } |
| 118 void restore(); | 120 void restore(); |
| 119 | 121 |
| 122 // TODO(dshwang): Need to clean up currentTransform binding methods via impr
oving binding generator script. |
| 123 // The binding code generated by 'attribute SVGMatix foo' in idl requires fo
o() and updateFoo(), |
| 124 // because SVGTransform.idl needs to return the reference of SVGMatrix. |
| 125 // When JS changes the return value, SVGTransform is applied immediately. |
| 126 // However, CanvanRenderingContext2D doesn't need the implicit update. |
| 127 // So updateCurrentTransform() does nothing. |
| 128 SVGMatrix& currentTransform() |
| 129 { |
| 130 m_dummyCurrentTransform = SVGMatrix(state().m_transform); |
| 131 return m_dummyCurrentTransform; |
| 132 } |
| 133 void updateCurrentTransform() { } |
| 134 void setCurrentTransform(SVGPropertyTearOff<SVGMatrix>*, ExceptionState&); |
| 135 |
| 120 void scale(float sx, float sy); | 136 void scale(float sx, float sy); |
| 121 void rotate(float angleInRadians); | 137 void rotate(float angleInRadians); |
| 122 void translate(float tx, float ty); | 138 void translate(float tx, float ty); |
| 123 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); | 139 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); |
| 124 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); | 140 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); |
| 125 void resetTransform(); | 141 void resetTransform(); |
| 126 | 142 |
| 127 void setStrokeColor(const String& color); | 143 void setStrokeColor(const String& color); |
| 128 void setStrokeColor(float grayLevel); | 144 void setStrokeColor(float grayLevel); |
| 129 void setStrokeColor(const String& color, float alpha); | 145 void setStrokeColor(const String& color, float alpha); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 339 |
| 324 virtual bool isTransformInvertible() const { return state().m_invertibleCTM;
} | 340 virtual bool isTransformInvertible() const { return state().m_invertibleCTM;
} |
| 325 | 341 |
| 326 virtual WebKit::WebLayer* platformLayer() const OVERRIDE; | 342 virtual WebKit::WebLayer* platformLayer() const OVERRIDE; |
| 327 | 343 |
| 328 Vector<State, 1> m_stateStack; | 344 Vector<State, 1> m_stateStack; |
| 329 unsigned m_unrealizedSaveCount; | 345 unsigned m_unrealizedSaveCount; |
| 330 bool m_usesCSSCompatibilityParseMode; | 346 bool m_usesCSSCompatibilityParseMode; |
| 331 bool m_hasAlpha; | 347 bool m_hasAlpha; |
| 332 MutableStylePropertyMap m_fetchedFonts; | 348 MutableStylePropertyMap m_fetchedFonts; |
| 349 SVGMatrix m_dummyCurrentTransform; |
| 333 }; | 350 }; |
| 334 | 351 |
| 335 } // namespace WebCore | 352 } // namespace WebCore |
| 336 | 353 |
| 337 #endif | 354 #endif |
| OLD | NEW |