Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Side by Side Diff: third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.h

Issue 1598923002: Add ImageBitmapRenderingContext (experimental) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another missing adoptRef Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698