OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class CanvasImageSource; | 44 class CanvasImageSource; |
45 class HTMLCanvasElement; | 45 class HTMLCanvasElement; |
46 class ImageData; | 46 class ImageData; |
47 class ImageBitmap; | 47 class ImageBitmap; |
48 class WebLayer; | 48 class WebLayer; |
49 | 49 |
50 enum CanvasColorSpace { | 50 enum CanvasColorSpace { |
51 kLegacyCanvasColorSpace, | 51 kLegacyCanvasColorSpace, |
52 kSRGBCanvasColorSpace, | 52 kSRGBCanvasColorSpace, |
53 kLinearRGBCanvasColorSpace, | |
54 kRec2020CanvasColorSpace, | 53 kRec2020CanvasColorSpace, |
55 kP3CanvasColorSpace, | 54 kP3CanvasColorSpace, |
56 }; | 55 }; |
57 | 56 |
| 57 enum CanvasPixelFormat { |
| 58 kRGBA8CanvasPixelFormat, |
| 59 kRGB10A2CanvasPixelFormat, |
| 60 kRGBA12CanvasPixelFormat, |
| 61 kF16CanvasPixelFormat, |
| 62 }; |
| 63 |
58 class CORE_EXPORT CanvasRenderingContext | 64 class CORE_EXPORT CanvasRenderingContext |
59 : public GarbageCollectedFinalized<CanvasRenderingContext>, | 65 : public GarbageCollectedFinalized<CanvasRenderingContext>, |
60 public ScriptWrappable, | 66 public ScriptWrappable, |
61 public WebThread::TaskObserver { | 67 public WebThread::TaskObserver { |
62 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); | 68 WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); |
63 USING_PRE_FINALIZER(CanvasRenderingContext, dispose); | 69 USING_PRE_FINALIZER(CanvasRenderingContext, dispose); |
64 | 70 |
65 public: | 71 public: |
66 virtual ~CanvasRenderingContext() {} | 72 virtual ~CanvasRenderingContext() {} |
67 | 73 |
(...skipping 13 matching lines...) Expand all Loading... |
81 ContextTypeCount, | 87 ContextTypeCount, |
82 }; | 88 }; |
83 | 89 |
84 static ContextType contextTypeFromId(const String& id); | 90 static ContextType contextTypeFromId(const String& id); |
85 static ContextType resolveContextTypeAliases(ContextType); | 91 static ContextType resolveContextTypeAliases(ContextType); |
86 | 92 |
87 HTMLCanvasElement* canvas() const { return m_canvas; } | 93 HTMLCanvasElement* canvas() const { return m_canvas; } |
88 | 94 |
89 CanvasColorSpace colorSpace() const { return m_colorSpace; }; | 95 CanvasColorSpace colorSpace() const { return m_colorSpace; }; |
90 WTF::String colorSpaceAsString() const; | 96 WTF::String colorSpaceAsString() const; |
| 97 CanvasPixelFormat pixelFormat() const { return m_pixelFormat; }; |
| 98 WTF::String pixelFormatAsString() const; |
| 99 bool linearPixelMath() const { return m_linearPixelMath; }; |
| 100 |
91 // The color space in which the the content should be interpreted by the | 101 // The color space in which the the content should be interpreted by the |
92 // compositor. This is always defined. | 102 // compositor. This is always defined. |
93 gfx::ColorSpace gfxColorSpace() const; | 103 gfx::ColorSpace gfxColorSpace() const; |
94 // The color space that should be used for SkSurface creation. This may | 104 // The color space that should be used for SkSurface creation. This may |
95 // be nullptr. | 105 // be nullptr. |
96 sk_sp<SkColorSpace> skSurfaceColorSpace() const; | 106 sk_sp<SkColorSpace> skSurfaceColorSpace() const; |
97 SkColorType colorType() const; | 107 SkColorType colorType() const; |
98 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const; | 108 ColorBehavior colorBehaviorForMediaDrawnToCanvas() const; |
99 bool skSurfacesUseColorSpace() const; | 109 bool skSurfacesUseColorSpace() const; |
100 | 110 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 virtual void stop() = 0; | 212 virtual void stop() = 0; |
203 | 213 |
204 private: | 214 private: |
205 void dispose(); | 215 void dispose(); |
206 | 216 |
207 Member<HTMLCanvasElement> m_canvas; | 217 Member<HTMLCanvasElement> m_canvas; |
208 Member<OffscreenCanvas> m_offscreenCanvas; | 218 Member<OffscreenCanvas> m_offscreenCanvas; |
209 HashSet<String> m_cleanURLs; | 219 HashSet<String> m_cleanURLs; |
210 HashSet<String> m_dirtyURLs; | 220 HashSet<String> m_dirtyURLs; |
211 CanvasColorSpace m_colorSpace; | 221 CanvasColorSpace m_colorSpace; |
| 222 CanvasPixelFormat m_pixelFormat; |
| 223 bool m_linearPixelMath = false; |
212 CanvasContextCreationAttributes m_creationAttributes; | 224 CanvasContextCreationAttributes m_creationAttributes; |
213 bool m_finalizeFrameScheduled = false; | 225 bool m_finalizeFrameScheduled = false; |
214 }; | 226 }; |
215 | 227 |
216 } // namespace blink | 228 } // namespace blink |
217 | 229 |
218 #endif | 230 #endif |
OLD | NEW |