Chromium Code Reviews| 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/ModulesExport.h" | |
| 10 #include "modules/canvas2d/BaseRenderingContext2D.h" | |
| 11 #include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h" | |
| 12 #include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class MODULES_EXPORT OffscreenCanvasRenderingContext2D final : public OffscreenC anvasRenderingContext, public BaseRenderingContext2D { | |
| 17 DEFINE_WRAPPERTYPEINFO(); | |
| 18 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(OffscreenCanvasRenderingContext2D); | |
| 19 public: | |
| 20 class Factory : public OffscreenCanvasRenderingContextFactory { | |
| 21 WTF_MAKE_NONCOPYABLE(Factory); | |
|
haraken
2016/03/04 16:22:15
This won't be needed since the parent class has th
xlai (Olivia)
2016/03/06 22:47:35
Done for here and elsewhere.
| |
| 22 | |
| 23 public: | |
| 24 Factory() {} | |
| 25 ~Factory() override {} | |
| 26 | |
| 27 OffscreenCanvasRenderingContext* create(OffscreenCanvas* canvas, const C anvasContextCreationAttributes& attrs) override | |
| 28 { | |
| 29 return new OffscreenCanvasRenderingContext2D(canvas, attrs); | |
| 30 } | |
| 31 | |
| 32 OffscreenCanvasRenderingContext::ContextType contextType() const overrid e | |
| 33 { | |
| 34 return OffscreenCanvasRenderingContext::Context2d; | |
| 35 } | |
| 36 | |
| 37 void onError(OffscreenCanvas* canvas, const String& error) override {} | |
| 38 }; | |
| 39 | |
| 40 // OffscreenCanvasRenderingContext implementation | |
| 41 ~OffscreenCanvasRenderingContext2D() override; | |
| 42 ContextType contextType() const override { return Context2d; } | |
| 43 bool is2d() const override { return true; } | |
| 44 | |
| 45 // BaseRenderingContext2D implementation | |
| 46 bool originClean() const final; | |
| 47 void setOriginTainted() final; | |
| 48 bool wouldTaintOrigin(CanvasImageSource*) final; | |
| 49 | |
| 50 int width() const final; | |
| 51 int height() const final; | |
| 52 | |
| 53 bool hasImageBuffer() const final; | |
| 54 ImageBuffer* imageBuffer() const final; | |
| 55 | |
| 56 bool parseColorOrCurrentColor(Color&, const String& colorString) const final ; | |
| 57 | |
| 58 SkCanvas* drawingCanvas() const final; | |
| 59 SkCanvas* existingDrawingCanvas() const final; | |
| 60 void disableDeferral(DisableDeferralReason) final; | |
| 61 | |
| 62 AffineTransform baseTransform() const final; | |
| 63 void didDraw(const SkIRect& dirtyRect) final; | |
| 64 | |
| 65 bool stateHasFilter() final; | |
| 66 SkImageFilter* stateGetFilter() final; | |
| 67 | |
| 68 void validateStateStack() final; | |
| 69 | |
| 70 bool hasAlpha() const override { return m_hasAlpha; } | |
| 71 bool isContextLost() const override; | |
| 72 | |
| 73 protected: | |
| 74 OffscreenCanvasRenderingContext2D(OffscreenCanvas*, const CanvasContextCreat ionAttributes& attrs); | |
| 75 DECLARE_VIRTUAL_TRACE(); | |
| 76 | |
| 77 private: | |
| 78 bool m_hasAlpha; | |
| 79 }; | |
| 80 | |
| 81 } // namespace blink | |
| 82 | |
| 83 #endif // OffscreenCanvasRenderingContext2D_h | |
| OLD | NEW |