| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2012, 2013 Adobe Systems Incorporated. All rights reserved. |
| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 24 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 25 * SUCH DAMAGE. | 25 * SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef Path2D_h | 28 #ifndef Path2D_h |
| 29 #define Path2D_h | 29 #define Path2D_h |
| 30 | 30 |
| 31 #include "bindings/core/v8/ScriptWrappable.h" | 31 #include "bindings/core/v8/ScriptWrappable.h" |
| 32 #include "core/svg/SVGMatrixTearOff.h" | 32 #include "core/svg/SVGMatrixTearOff.h" |
| 33 #include "core/svg/SVGPathUtilities.h" | 33 #include "core/svg/SVGPathUtilities.h" |
| 34 #include "modules/canvas2d/CanvasPathMethods.h" | 34 #include "modules/canvas2d/CanvasPath.h" |
| 35 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 36 #include "platform/transforms/AffineTransform.h" | 36 #include "platform/transforms/AffineTransform.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class MODULES_EXPORT Path2D final : public GarbageCollectedFinalized<Path2D>, | 40 class MODULES_EXPORT Path2D final : public GarbageCollectedFinalized<Path2D>, |
| 41 public CanvasPathMethods, | 41 public CanvasPath, |
| 42 public ScriptWrappable { | 42 public ScriptWrappable { |
| 43 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
| 44 WTF_MAKE_NONCOPYABLE(Path2D); | 44 WTF_MAKE_NONCOPYABLE(Path2D); |
| 45 | 45 |
| 46 public: | 46 public: |
| 47 static Path2D* Create() { return new Path2D; } | 47 static Path2D* Create() { return new Path2D; } |
| 48 static Path2D* Create(const String& path_data) { | 48 static Path2D* Create(const String& path_data) { |
| 49 return new Path2D(path_data); | 49 return new Path2D(path_data); |
| 50 } | 50 } |
| 51 static Path2D* Create(Path2D* path) { return new Path2D(path); } | 51 static Path2D* Create(Path2D* path) { return new Path2D(path); } |
| 52 static Path2D* Create(const Path& path) { return new Path2D(path); } | 52 static Path2D* Create(const Path& path) { return new Path2D(path); } |
| 53 | 53 |
| 54 const Path& GetPath() const { return path_; } | 54 const Path& GetPath() const { return path_; } |
| 55 | 55 |
| 56 void addPath(Path2D* path) { addPath(path, 0); } | 56 void addPath(Path2D* path) { addPath(path, 0); } |
| 57 | 57 |
| 58 void addPath(Path2D* path, SVGMatrixTearOff* transform) { | 58 void addPath(Path2D* path, SVGMatrixTearOff* transform) { |
| 59 Path src = path->GetPath(); | 59 Path src = path->GetPath(); |
| 60 path_.AddPath(src, transform ? transform->Value() | 60 path_.AddPath(src, transform ? transform->Value() |
| 61 : AffineTransform(1, 0, 0, 1, 0, 0)); | 61 : AffineTransform(1, 0, 0, 1, 0, 0)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ~Path2D() override {} | 64 ~Path2D() override {} |
| 65 DEFINE_INLINE_TRACE() {} | 65 DEFINE_INLINE_TRACE() {} |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 Path2D() : CanvasPathMethods() {} | 68 Path2D() : CanvasPath() {} |
| 69 | 69 |
| 70 Path2D(const Path& path) : CanvasPathMethods(path) {} | 70 Path2D(const Path& path) : CanvasPath(path) {} |
| 71 | 71 |
| 72 Path2D(Path2D* path) : CanvasPathMethods(path->GetPath()) {} | 72 Path2D(Path2D* path) : CanvasPath(path->GetPath()) {} |
| 73 | 73 |
| 74 Path2D(const String& path_data) : CanvasPathMethods() { | 74 Path2D(const String& path_data) : CanvasPath() { |
| 75 BuildPathFromString(path_data, path_); | 75 BuildPathFromString(path_data, path_); |
| 76 } | 76 } |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace blink | 79 } // namespace blink |
| 80 | 80 |
| 81 #endif // Path2D_h | 81 #endif // Path2D_h |
| OLD | NEW |