OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 PaintRenderingContext2D_h | 5 #ifndef PaintRenderingContext2D_h |
6 #define PaintRenderingContext2D_h | 6 #define PaintRenderingContext2D_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "modules/canvas2d/BaseRenderingContext2D.h" | 10 #include "modules/canvas2d/BaseRenderingContext2D.h" |
11 #include "platform/graphics/ImageBuffer.h" | 11 #include "platform/graphics/ImageBuffer.h" |
| 12 #include <memory> |
12 | 13 |
13 class SkCanvas; | 14 class SkCanvas; |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class CanvasImageSource; | 18 class CanvasImageSource; |
18 class Color; | 19 class Color; |
19 | 20 |
20 class MODULES_EXPORT PaintRenderingContext2D : public BaseRenderingContext2D, pu
blic GarbageCollectedFinalized<PaintRenderingContext2D>, public ScriptWrappable
{ | 21 class MODULES_EXPORT PaintRenderingContext2D : public BaseRenderingContext2D, pu
blic GarbageCollectedFinalized<PaintRenderingContext2D>, public ScriptWrappable
{ |
21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
22 USING_GARBAGE_COLLECTED_MIXIN(PaintRenderingContext2D); | 23 USING_GARBAGE_COLLECTED_MIXIN(PaintRenderingContext2D); |
23 WTF_MAKE_NONCOPYABLE(PaintRenderingContext2D); | 24 WTF_MAKE_NONCOPYABLE(PaintRenderingContext2D); |
24 public: | 25 public: |
25 static PaintRenderingContext2D* create(PassOwnPtr<ImageBuffer> imageBuffer) | 26 static PaintRenderingContext2D* create(std::unique_ptr<ImageBuffer> imageBuf
fer) |
26 { | 27 { |
27 return new PaintRenderingContext2D(std::move(imageBuffer)); | 28 return new PaintRenderingContext2D(std::move(imageBuffer)); |
28 } | 29 } |
29 | 30 |
30 // BaseRenderingContext2D | 31 // BaseRenderingContext2D |
31 | 32 |
32 // PaintRenderingContext2D doesn't have any pixel readback so the origin | 33 // PaintRenderingContext2D doesn't have any pixel readback so the origin |
33 // is always clean, and unable to taint it. | 34 // is always clean, and unable to taint it. |
34 bool originClean() const final { return true; } | 35 bool originClean() const final { return true; } |
35 void setOriginTainted() final { } | 36 void setOriginTainted() final { } |
(...skipping 24 matching lines...) Expand all Loading... |
60 void snapshotStateForFilter() final { } | 61 void snapshotStateForFilter() final { } |
61 | 62 |
62 void validateStateStack() final; | 63 void validateStateStack() final; |
63 | 64 |
64 bool hasAlpha() const final { return true; } | 65 bool hasAlpha() const final { return true; } |
65 | 66 |
66 // PaintRenderingContext2D cannot lose it's context. | 67 // PaintRenderingContext2D cannot lose it's context. |
67 bool isContextLost() const final { return false; } | 68 bool isContextLost() const final { return false; } |
68 | 69 |
69 private: | 70 private: |
70 explicit PaintRenderingContext2D(PassOwnPtr<ImageBuffer>); | 71 explicit PaintRenderingContext2D(std::unique_ptr<ImageBuffer>); |
71 | 72 |
72 OwnPtr<ImageBuffer> m_imageBuffer; | 73 std::unique_ptr<ImageBuffer> m_imageBuffer; |
73 }; | 74 }; |
74 | 75 |
75 } // namespace blink | 76 } // namespace blink |
76 | 77 |
77 #endif // PaintRenderingContext2D_h | 78 #endif // PaintRenderingContext2D_h |
OLD | NEW |