| 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 ImageBitmapRenderingContext_h | 5 #ifndef ImageBitmapRenderingContext_h |
| 6 #define ImageBitmapRenderingContext_h | 6 #define ImageBitmapRenderingContext_h |
| 7 | 7 |
| 8 #include "core/html/canvas/CanvasRenderingContext.h" | 8 #include "core/html/canvas/CanvasRenderingContext.h" |
| 9 #include "core/html/canvas/CanvasRenderingContextFactory.h" | 9 #include "core/html/canvas/CanvasRenderingContextFactory.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 // Script API | 30 // Script API |
| 31 void transferFromImageBitmap(ImageBitmap*); | 31 void transferFromImageBitmap(ImageBitmap*); |
| 32 | 32 |
| 33 // CanvasRenderingContext implementation | 33 // CanvasRenderingContext implementation |
| 34 ContextType getContextType() const override { return CanvasRenderingContext:
:ContextImageBitmap; } | 34 ContextType getContextType() const override { return CanvasRenderingContext:
:ContextImageBitmap; } |
| 35 void setIsHidden(bool) override { } | 35 void setIsHidden(bool) override { } |
| 36 bool isContextLost() const override { return false; } | 36 bool isContextLost() const override { return false; } |
| 37 bool paint(GraphicsContext&, const IntRect&) override; | 37 bool paint(GraphicsContext&, const IntRect&) override; |
| 38 void setCanvasGetContextResult(RenderingContext&) final; | 38 void setCanvasGetContextResult(RenderingContext&) final; |
| 39 PassRefPtr<Image> getImage(SnapshotReason) const final { return m_image.get(
); } | 39 PassRefPtr<Image> getImage(AccelerationHint, SnapshotReason) const final { r
eturn m_image.get(); } |
| 40 | 40 |
| 41 // TODO(junov): Implement GPU accelerated rendering using a layer bridge | 41 // TODO(junov): Implement GPU accelerated rendering using a layer bridge |
| 42 WebLayer* platformLayer() const override { return nullptr; } | 42 WebLayer* platformLayer() const override { return nullptr; } |
| 43 // TODO(junov): handle lost contexts when content is GPU-backed | 43 // TODO(junov): handle lost contexts when content is GPU-backed |
| 44 void loseContext(LostContextMode) override { } | 44 void loseContext(LostContextMode) override { } |
| 45 | 45 |
| 46 void stop() override; | 46 void stop() override; |
| 47 | 47 |
| 48 bool isPaintable() const final { return m_image.get(); } | 48 bool isPaintable() const final { return m_image.get(); } |
| 49 | 49 |
| 50 virtual ~ImageBitmapRenderingContext(); | 50 virtual ~ImageBitmapRenderingContext(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 ImageBitmapRenderingContext(HTMLCanvasElement*, const CanvasContextCreationA
ttributes&, Document&); | 53 ImageBitmapRenderingContext(HTMLCanvasElement*, const CanvasContextCreationA
ttributes&, Document&); |
| 54 | 54 |
| 55 RefPtr<Image> m_image; | 55 RefPtr<Image> m_image; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 DEFINE_TYPE_CASTS(ImageBitmapRenderingContext, CanvasRenderingContext, context, | 58 DEFINE_TYPE_CASTS(ImageBitmapRenderingContext, CanvasRenderingContext, context, |
| 59 context->getContextType() == CanvasRenderingContext::ContextImageBitmap, | 59 context->getContextType() == CanvasRenderingContext::ContextImageBitmap, |
| 60 context.getContextType() == CanvasRenderingContext::ContextImageBitmap); | 60 context.getContextType() == CanvasRenderingContext::ContextImageBitmap); |
| 61 | 61 |
| 62 } // blink | 62 } // blink |
| 63 | 63 |
| 64 #endif | 64 #endif |
| OLD | NEW |