OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef OffscreenCanvasRenderingContext2D_h |
| 6 #define OffscreenCanvasRenderingContext2D_h |
| 7 |
| 8 #include "core/html/canvas/CanvasContextCreationAttributes.h" |
| 9 #include "modules/canvas2d/BaseRenderingContext2D.h" |
| 10 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h" |
| 11 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public OffscreenC
anvasRenderingContext, public BaseRenderingContext2D { |
| 16 DEFINE_WRAPPERTYPEINFO(); |
| 17 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); |
| 18 public: |
| 19 class Factory : public OffscreenCanvasRenderingContextFactory { |
| 20 public: |
| 21 Factory() {} |
| 22 ~Factory() override {} |
| 23 |
| 24 OffscreenCanvasRenderingContext* create(OffscreenCanvas* canvas, const C
anvasContextCreationAttributes& attrs) override |
| 25 { |
| 26 return new OffscreenCanvasRenderingContext2D(canvas, attrs); |
| 27 } |
| 28 |
| 29 OffscreenCanvasRenderingContext::ContextType contextType() const overrid
e |
| 30 { |
| 31 return OffscreenCanvasRenderingContext::Context2d; |
| 32 } |
| 33 |
| 34 void onError(OffscreenCanvas* canvas, const String& error) override {} |
| 35 }; |
| 36 |
| 37 // OffscreenCanvasRenderingContext implementation |
| 38 ~OffscreenCanvasRenderingContext2D() override; |
| 39 ContextType contextType() const override { return Context2d; } |
| 40 bool is2d() const override { return true; } |
| 41 |
| 42 // BaseRenderingContext2D implementation |
| 43 bool originClean() const final; |
| 44 void setOriginTainted() final; |
| 45 bool wouldTaintOrigin(CanvasImageSource*) final; |
| 46 |
| 47 int width() const final; |
| 48 int height() const final; |
| 49 |
| 50 bool hasImageBuffer() const final; |
| 51 ImageBuffer* imageBuffer() const final; |
| 52 |
| 53 bool parseColorOrCurrentColor(Color&, const String& colorString) const final
; |
| 54 |
| 55 SkCanvas* drawingCanvas() const final; |
| 56 SkCanvas* existingDrawingCanvas() const final; |
| 57 void disableDeferral(DisableDeferralReason) final; |
| 58 |
| 59 AffineTransform baseTransform() const final; |
| 60 void didDraw(const SkIRect& dirtyRect) final; |
| 61 |
| 62 bool stateHasFilter() final; |
| 63 SkImageFilter* stateGetFilter() final; |
| 64 |
| 65 void validateStateStack() final; |
| 66 |
| 67 bool hasAlpha() const override { return m_hasAlpha; } |
| 68 bool isContextLost() const override; |
| 69 |
| 70 protected: |
| 71 OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreat
ionAttributes& attrs); |
| 72 DECLARE_VIRTUAL_TRACE(); |
| 73 |
| 74 private: |
| 75 bool m_hasAlpha; |
| 76 }; |
| 77 |
| 78 } // namespace blink |
| 79 |
| 80 #endif // OffscreenCanvasRenderingContext2D_h |
OLD | NEW |