| 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 OffscreenCanvasRenderingContext2D_h | 5 #ifndef OffscreenCanvasRenderingContext2D_h |
| 6 #define OffscreenCanvasRenderingContext2D_h | 6 #define OffscreenCanvasRenderingContext2D_h |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include "core/html/canvas/CanvasContextCreationAttributes.h" | 9 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| 9 #include "core/html/canvas/CanvasRenderingContext.h" | 10 #include "core/html/canvas/CanvasRenderingContext.h" |
| 10 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 11 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 11 #include "modules/canvas2d/BaseRenderingContext2D.h" | 12 #include "modules/canvas2d/BaseRenderingContext2D.h" |
| 12 #include <memory> | 13 #include "modules/webgl/WebGLTexture.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final | 17 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final |
| 17 : public CanvasRenderingContext, | 18 : public CanvasRenderingContext, |
| 18 public BaseRenderingContext2D { | 19 public BaseRenderingContext2D { |
| 19 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
| 20 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); | 21 USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); |
| 21 | 22 |
| 22 public: | 23 public: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 bool OriginClean() const final; | 68 bool OriginClean() const final; |
| 68 void SetOriginTainted() final; | 69 void SetOriginTainted() final; |
| 69 bool WouldTaintOrigin(CanvasImageSource*, ExecutionContext*) final; | 70 bool WouldTaintOrigin(CanvasImageSource*, ExecutionContext*) final; |
| 70 | 71 |
| 71 int Width() const final; | 72 int Width() const final; |
| 72 int Height() const final; | 73 int Height() const final; |
| 73 | 74 |
| 74 bool HasImageBuffer() const final; | 75 bool HasImageBuffer() const final; |
| 75 ImageBuffer* GetImageBuffer() const final; | 76 ImageBuffer* GetImageBuffer() const final; |
| 76 | 77 |
| 78 ImageBuffer* CreateTextureImageBuffer(); |
| 79 |
| 77 bool ParseColorOrCurrentColor(Color&, const String& color_string) const final; | 80 bool ParseColorOrCurrentColor(Color&, const String& color_string) const final; |
| 78 | 81 |
| 79 PaintCanvas* DrawingCanvas() const final; | 82 PaintCanvas* DrawingCanvas() const final; |
| 80 PaintCanvas* ExistingDrawingCanvas() const final; | 83 PaintCanvas* ExistingDrawingCanvas() const final; |
| 81 void DisableDeferral(DisableDeferralReason) final; | 84 void DisableDeferral(DisableDeferralReason) final; |
| 82 | 85 |
| 83 AffineTransform BaseTransform() const final; | 86 AffineTransform BaseTransform() const final; |
| 84 void DidDraw(const SkIRect& dirty_rect) final; // overrides | 87 void DidDraw(const SkIRect& dirty_rect) final; // overrides |
| 85 // BaseRenderingContext2D and | 88 // BaseRenderingContext2D and |
| 86 // CanvasRenderingContext | 89 // CanvasRenderingContext |
| (...skipping 23 matching lines...) Expand all Loading... |
| 110 } | 113 } |
| 111 | 114 |
| 112 private: | 115 private: |
| 113 bool IsPaintable() const final; | 116 bool IsPaintable() const final; |
| 114 | 117 |
| 115 RefPtr<StaticBitmapImage> TransferToStaticBitmapImage(); | 118 RefPtr<StaticBitmapImage> TransferToStaticBitmapImage(); |
| 116 | 119 |
| 117 CanvasColorSpace ColorSpace() const override; | 120 CanvasColorSpace ColorSpace() const override; |
| 118 String ColorSpaceAsString() const override; | 121 String ColorSpaceAsString() const override; |
| 119 CanvasPixelFormat PixelFormat() const override; | 122 CanvasPixelFormat PixelFormat() const override; |
| 123 |
| 124 Member<WebGLTexture> webgl_texture_; |
| 125 std::unique_ptr<ImageBuffer> texture_image_buffer_; |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, | 128 DEFINE_TYPE_CASTS(OffscreenCanvasRenderingContext2D, |
| 123 CanvasRenderingContext, | 129 CanvasRenderingContext, |
| 124 context, | 130 context, |
| 125 context->Is2d() && context->host(), | 131 context->Is2d() && context->host(), |
| 126 context.Is2d() && context.host()); | 132 context.Is2d() && context.host()); |
| 127 | 133 |
| 128 } // namespace blink | 134 } // namespace blink |
| 129 | 135 |
| 130 #endif // OffscreenCanvasRenderingContext2D_h | 136 #endif // OffscreenCanvasRenderingContext2D_h |
| OLD | NEW |