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

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.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, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
index 7ab03585c0b4df9ea1dea9f3860a042cb3be5c99..ae6df2e2c766902e98be7b79233c49dfe2830676 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h
@@ -28,22 +28,29 @@
#include "core/CoreExport.h"
#include "core/html/HTMLCanvasElement.h"
+#include "core/html/canvas/CanvasContextCreationAttributes.h"
#include "core/layout/HitTestCanvasResult.h"
#include "core/offscreencanvas/OffscreenCanvas.h"
+#include "third_party/skia/include/core/SkColorSpace.h"
#include "wtf/HashSet.h"
#include "wtf/Noncopyable.h"
#include "wtf/text/StringHash.h"
class SkCanvas;
-namespace blink { class WebLayer; }
-
namespace blink {
class CanvasImageSource;
class HTMLCanvasElement;
class ImageData;
class ImageBitmap;
+class WebLayer;
+
+enum CanvasColorSpace {
+ kLegacyCanvasColorSpace,
+ kSRGBCanvasColorSpace,
+ kLinearRGBCanvasColorSpace,
+};
class CORE_EXPORT CanvasRenderingContext : public GarbageCollectedFinalized<CanvasRenderingContext>, public ScriptWrappable {
WTF_MAKE_NONCOPYABLE(CanvasRenderingContext);
@@ -70,10 +77,13 @@ public:
HTMLCanvasElement* canvas() const { return m_canvas; }
+ CanvasColorSpace colorSpace() const { return m_colorSpace; };
+ WTF::String colorSpaceAsString() const;
+ sk_sp<SkColorSpace> skColorSpace() const;
+
virtual ContextType getContextType() const = 0;
virtual bool isAccelerated() const { return false; }
virtual bool shouldAntialias() const { return false; }
- virtual bool hasAlpha() const { return true; }
virtual void setIsHidden(bool) = 0;
virtual bool isContextLost() const { return true; }
virtual void setCanvasGetContextResult(RenderingContext&) { NOTREACHED(); };
@@ -138,8 +148,10 @@ public:
void detachCanvas() { m_canvas = nullptr; }
+ const CanvasContextCreationAttributes& creationAttributes() const { return m_creationAttributes; }
+
protected:
- CanvasRenderingContext(HTMLCanvasElement* = nullptr, OffscreenCanvas* = nullptr);
+ CanvasRenderingContext(HTMLCanvasElement*, OffscreenCanvas*, const CanvasContextCreationAttributes&);
DECLARE_VIRTUAL_TRACE();
virtual void stop() = 0;
@@ -150,6 +162,8 @@ private:
Member<OffscreenCanvas> m_offscreenCanvas;
HashSet<String> m_cleanURLs;
HashSet<String> m_dirtyURLs;
+ CanvasColorSpace m_colorSpace;
+ CanvasContextCreationAttributes m_creationAttributes;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698