| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SKY_ENGINE_CORE_PAINTING_CANVAS_H_ | 5 #ifndef SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
| 6 #define SKY_ENGINE_CORE_PAINTING_CANVAS_H_ | 6 #define SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
| 7 | 7 |
| 8 #include "sky/engine/bindings/exception_state.h" | 8 #include "sky/engine/bindings/exception_state.h" |
| 9 #include "sky/engine/core/painting/CanvasPath.h" | 9 #include "sky/engine/core/painting/CanvasPath.h" |
| 10 #include "sky/engine/core/painting/Drawable.h" |
| 10 #include "sky/engine/core/painting/Offset.h" | 11 #include "sky/engine/core/painting/Offset.h" |
| 11 #include "sky/engine/core/painting/Paint.h" | 12 #include "sky/engine/core/painting/Paint.h" |
| 12 #include "sky/engine/core/painting/Picture.h" | 13 #include "sky/engine/core/painting/Picture.h" |
| 13 #include "sky/engine/core/painting/PictureRecorder.h" | 14 #include "sky/engine/core/painting/PictureRecorder.h" |
| 14 #include "sky/engine/core/painting/Point.h" | 15 #include "sky/engine/core/painting/Point.h" |
| 15 #include "sky/engine/core/painting/RRect.h" | 16 #include "sky/engine/core/painting/RRect.h" |
| 16 #include "sky/engine/core/painting/Rect.h" | 17 #include "sky/engine/core/painting/Rect.h" |
| 17 #include "sky/engine/core/painting/Size.h" | 18 #include "sky/engine/core/painting/Size.h" |
| 18 #include "sky/engine/platform/graphics/DisplayList.h" | 19 #include "sky/engine/platform/graphics/DisplayList.h" |
| 19 #include "sky/engine/tonic/dart_wrappable.h" | 20 #include "sky/engine/tonic/dart_wrappable.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void scale(float sx, float sy); | 66 void scale(float sx, float sy); |
| 66 void rotate(float radians); | 67 void rotate(float radians); |
| 67 void skew(float sx, float sy); | 68 void skew(float sx, float sy); |
| 68 void concat(const Float32List& matrix4); | 69 void concat(const Float32List& matrix4); |
| 69 | 70 |
| 70 void clipRect(const Rect& rect); | 71 void clipRect(const Rect& rect); |
| 71 void clipRRect(const RRect* rrect); | 72 void clipRRect(const RRect* rrect); |
| 72 void clipPath(const CanvasPath* path); | 73 void clipPath(const CanvasPath* path); |
| 73 | 74 |
| 74 void drawLine(const Point& p1, const Point& p2, const Paint* paint); | 75 void drawLine(const Point& p1, const Point& p2, const Paint* paint); |
| 75 void drawPicture(Picture* picture); | |
| 76 void drawPaint(const Paint* paint); | 76 void drawPaint(const Paint* paint); |
| 77 void drawRect(const Rect& rect, const Paint* paint); | 77 void drawRect(const Rect& rect, const Paint* paint); |
| 78 void drawRRect(const RRect* rrect, const Paint* paint); | 78 void drawRRect(const RRect* rrect, const Paint* paint); |
| 79 void drawOval(const Rect& rect, const Paint* paint); | 79 void drawOval(const Rect& rect, const Paint* paint); |
| 80 void drawCircle(const Point& c, float radius, const Paint* paint); | 80 void drawCircle(const Point& c, float radius, const Paint* paint); |
| 81 void drawPath(const CanvasPath* path, const Paint* paint); | 81 void drawPath(const CanvasPath* path, const Paint* paint); |
| 82 void drawImage(const CanvasImage* image, const Point& p, const Paint* paint)
; | 82 void drawImage(const CanvasImage* image, const Point& p, const Paint* paint)
; |
| 83 void drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, Paint* pa
int); | 83 void drawImageRect(const CanvasImage* image, Rect& src, Rect& dst, Paint* pa
int); |
| 84 void drawPicture(Picture* picture); |
| 85 void drawDrawable(Drawable* drawable); |
| 84 | 86 |
| 85 SkCanvas* skCanvas() { return m_canvas; } | 87 SkCanvas* skCanvas() { return m_canvas; } |
| 86 void clearSkCanvas() { m_canvas = nullptr; } | 88 void clearSkCanvas() { m_canvas = nullptr; } |
| 87 bool isRecording() const { return !!m_canvas; } | 89 bool isRecording() const { return !!m_canvas; } |
| 88 | 90 |
| 89 protected: | 91 protected: |
| 90 explicit Canvas(SkCanvas* skCanvas); | 92 explicit Canvas(SkCanvas* skCanvas); |
| 91 | 93 |
| 92 private: | 94 private: |
| 93 // The SkCanvas is supplied by a call to SkPictureRecorder::beginRecording, | 95 // The SkCanvas is supplied by a call to SkPictureRecorder::beginRecording, |
| 94 // which does not transfer ownership. For this reason, we hold a raw | 96 // which does not transfer ownership. For this reason, we hold a raw |
| 95 // pointer and manually set the SkCanvas to null in clearSkCanvas. | 97 // pointer and manually set the SkCanvas to null in clearSkCanvas. |
| 96 SkCanvas* m_canvas; | 98 SkCanvas* m_canvas; |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 } // namespace blink | 101 } // namespace blink |
| 100 | 102 |
| 101 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ | 103 #endif // SKY_ENGINE_CORE_PAINTING_CANVAS_H_ |
| OLD | NEW |