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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 2212163002: Add some plumbing for the color management of canvases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor corrections 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved.
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
10 * 10 *
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (c) 102 if (c)
103 c->restoreToCount(m_saveCount); 103 c->restoreToCount(m_saveCount);
104 m_context->validateStateStack(); 104 m_context->validateStateStack();
105 } 105 }
106 private: 106 private:
107 Member<CanvasRenderingContext2D> m_context; 107 Member<CanvasRenderingContext2D> m_context;
108 int m_saveCount; 108 int m_saveCount;
109 }; 109 };
110 110
111 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co nst CanvasContextCreationAttributes& attrs, Document& document) 111 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co nst CanvasContextCreationAttributes& attrs, Document& document)
112 : CanvasRenderingContext(canvas) 112 : CanvasRenderingContext(canvas, nullptr, attrs.colorSpace())
113 , m_hasAlpha(attrs.alpha()) 113 , m_hasAlpha(attrs.alpha())
114 , m_contextLostMode(NotLostContext) 114 , m_contextLostMode(NotLostContext)
115 , m_contextRestorable(true) 115 , m_contextRestorable(true)
116 , m_tryRestoreContextAttemptCount(0) 116 , m_tryRestoreContextAttemptCount(0)
117 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC ontextLostEvent) 117 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC ontextLostEvent)
118 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa tchContextRestoredEvent) 118 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa tchContextRestoredEvent)
119 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC ontextEvent) 119 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC ontextEvent)
120 , m_pruneLocalFontCacheScheduled(false) 120 , m_pruneLocalFontCacheScheduled(false)
121 { 121 {
122 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab led()) 122 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab led())
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 } 904 }
905 905
906 WebLayer* CanvasRenderingContext2D::platformLayer() const 906 WebLayer* CanvasRenderingContext2D::platformLayer() const
907 { 907 {
908 return canvas()->buffer() ? canvas()->buffer()->platformLayer() : 0; 908 return canvas()->buffer() ? canvas()->buffer()->platformLayer() : 0;
909 } 909 }
910 910
911 void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& a ttrs) const 911 void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& a ttrs) const
912 { 912 {
913 attrs.setAlpha(m_hasAlpha); 913 attrs.setAlpha(m_hasAlpha);
914 attrs.setColorSpace(colorSpaceAsString());
Stephen White 2016/08/11 20:41:27 Shouldn't the base class be responsible for this?
Justin Novosad 2016/08/12 17:40:18 Nope. The base class is in core, so it can't know
914 } 915 }
915 916
916 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element) 917 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element)
917 { 918 {
918 drawFocusIfNeededInternal(m_path, element); 919 drawFocusIfNeededInternal(m_path, element);
919 } 920 }
920 921
921 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen t) 922 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen t)
922 { 923 {
923 drawFocusIfNeededInternal(path2d->path(), element); 924 drawFocusIfNeededInternal(path2d->path(), element);
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 return true; 1090 return true;
1090 } 1091 }
1091 1092
1092 void CanvasRenderingContext2D::resetUsageTracking() 1093 void CanvasRenderingContext2D::resetUsageTracking()
1093 { 1094 {
1094 UsageCounters newCounters; 1095 UsageCounters newCounters;
1095 m_usageCounters = newCounters; 1096 m_usageCounters = newCounters;
1096 } 1097 }
1097 1098
1098 } // namespace blink 1099 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698