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