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 ImageBitmapRenderingContext_h |
| 6 #define ImageBitmapRenderingContext_h |
| 7 |
| 8 #include "core/html/canvas/CanvasRenderingContext.h" |
| 9 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 10 #include "modules/ModulesExport.h" |
| 11 #include "wtf/RefPtr.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class ImageBitmap; |
| 16 |
| 17 class MODULES_EXPORT ImageBitmapRenderingContext final : public CanvasRenderingC
ontext { |
| 18 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: |
| 20 class Factory : public CanvasRenderingContextFactory { |
| 21 WTF_MAKE_NONCOPYABLE(Factory); |
| 22 public: |
| 23 Factory() {} |
| 24 ~Factory() override {} |
| 25 |
| 26 PassOwnPtrWillBeRawPtr<CanvasRenderingContext> create(HTMLCanvasElement*
, const CanvasContextCreationAttributes&, Document&) override; |
| 27 CanvasRenderingContext::ContextType contextType() const override { retur
n CanvasRenderingContext::ContextImageBitmap; } |
| 28 void onError(HTMLCanvasElement*, const String& error) override { } |
| 29 }; |
| 30 |
| 31 // Script API |
| 32 void transferImageBitmap(ImageBitmap*); |
| 33 |
| 34 // CanvasRenderingContext implementation |
| 35 ContextType contextType() const override { return CanvasRenderingContext::Co
ntextImageBitmap; } |
| 36 bool hasAlpha() const override { return m_hasAlpha; } |
| 37 void setIsHidden(bool) override { } |
| 38 bool isContextLost() const override { return false; } |
| 39 bool paint(GraphicsContext&, const IntRect&) override; |
| 40 |
| 41 // TODO(junov): Implement GPU accelerated rendering using a layer bridge |
| 42 WebLayer* platformLayer() const override { return nullptr; } |
| 43 // TODO(junov): handle lost contexts when content is GPU-backed |
| 44 void loseContext(LostContextMode) override { } |
| 45 |
| 46 void stop() override; |
| 47 |
| 48 virtual ~ImageBitmapRenderingContext(); |
| 49 |
| 50 private: |
| 51 ImageBitmapRenderingContext(HTMLCanvasElement*, CanvasContextCreationAttribu
tes, Document&); |
| 52 |
| 53 bool m_hasAlpha; |
| 54 RefPtr<Image> m_image; |
| 55 }; |
| 56 |
| 57 } // blink |
| 58 |
| 59 #endif |
OLD | NEW |