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

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

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 3 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
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 14 matching lines...) Expand all
25 25
26 CanvasRenderingContext* create(HTMLCanvasElement*, const CanvasContextCr eationAttributes&, Document&) override; 26 CanvasRenderingContext* create(HTMLCanvasElement*, const CanvasContextCr eationAttributes&, Document&) override;
27 CanvasRenderingContext::ContextType getContextType() const override { re turn CanvasRenderingContext::ContextImageBitmap; } 27 CanvasRenderingContext::ContextType getContextType() const override { re turn CanvasRenderingContext::ContextImageBitmap; }
28 }; 28 };
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 bool hasAlpha() const override { return m_hasAlpha; }
36 void setIsHidden(bool) override { } 35 void setIsHidden(bool) override { }
37 bool isContextLost() const override { return false; } 36 bool isContextLost() const override { return false; }
38 bool paint(GraphicsContext&, const IntRect&) override; 37 bool paint(GraphicsContext&, const IntRect&) override;
39 void setCanvasGetContextResult(RenderingContext&) final; 38 void setCanvasGetContextResult(RenderingContext&) final;
40 PassRefPtr<Image> getImage() const final { return m_image.get(); } 39 PassRefPtr<Image> getImage() const final { return m_image.get(); }
41 40
42 // TODO(junov): Implement GPU accelerated rendering using a layer bridge 41 // TODO(junov): Implement GPU accelerated rendering using a layer bridge
43 WebLayer* platformLayer() const override { return nullptr; } 42 WebLayer* platformLayer() const override { return nullptr; }
44 // TODO(junov): handle lost contexts when content is GPU-backed 43 // TODO(junov): handle lost contexts when content is GPU-backed
45 void loseContext(LostContextMode) override { } 44 void loseContext(LostContextMode) override { }
46 45
47 void stop() override; 46 void stop() override;
48 47
49 virtual ~ImageBitmapRenderingContext(); 48 virtual ~ImageBitmapRenderingContext();
50 49
51 private: 50 private:
52 ImageBitmapRenderingContext(HTMLCanvasElement*, CanvasContextCreationAttribu tes, Document&); 51 ImageBitmapRenderingContext(HTMLCanvasElement*, const CanvasContextCreationA ttributes&, Document&);
53 52
54 bool m_hasAlpha;
55 RefPtr<Image> m_image; 53 RefPtr<Image> m_image;
56 54
57 bool isPaintable() const final { return m_image.get(); } 55 bool isPaintable() const final { return m_image.get(); }
58 }; 56 };
59 57
60 DEFINE_TYPE_CASTS(ImageBitmapRenderingContext, CanvasRenderingContext, context, 58 DEFINE_TYPE_CASTS(ImageBitmapRenderingContext, CanvasRenderingContext, context,
61 context->getContextType() == CanvasRenderingContext::ContextImageBitmap, 59 context->getContextType() == CanvasRenderingContext::ContextImageBitmap,
62 context.getContextType() == CanvasRenderingContext::ContextImageBitmap); 60 context.getContextType() == CanvasRenderingContext::ContextImageBitmap);
63 61
64 } // blink 62 } // blink
65 63
66 #endif 64 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698