Title: [290848] trunk/Source/WebCore
- Revision
- 290848
- Author
- simon.fra...@apple.com
- Date
- 2022-03-04 14:43:58 -0800 (Fri, 04 Mar 2022)
Log Message
Use an OptionSet<> for GraphicsContextCGFlags
https://bugs.webkit.org/show_bug.cgi?id=237482
Reviewed by Wenson Hsieh.
Mechanical change to use an OptionSet<> for GraphicsContextCG::m_contextFlags.
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::setIsCALayerContext):
(WebCore::GraphicsContextCG::isCALayerContext const):
(WebCore::GraphicsContextCG::setIsAcceleratedContext):
(WebCore::GraphicsContextCG::renderingMode const):
* platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
(WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
(): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (290847 => 290848)
--- trunk/Source/WebCore/ChangeLog 2022-03-04 22:12:04 UTC (rev 290847)
+++ trunk/Source/WebCore/ChangeLog 2022-03-04 22:43:58 UTC (rev 290848)
@@ -1,3 +1,21 @@
+2022-03-04 Simon Fraser <simon.fra...@apple.com>
+
+ Use an OptionSet<> for GraphicsContextCGFlags
+ https://bugs.webkit.org/show_bug.cgi?id=237482
+
+ Reviewed by Wenson Hsieh.
+
+ Mechanical change to use an OptionSet<> for GraphicsContextCG::m_contextFlags.
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContextCG::setIsCALayerContext):
+ (WebCore::GraphicsContextCG::isCALayerContext const):
+ (WebCore::GraphicsContextCG::setIsAcceleratedContext):
+ (WebCore::GraphicsContextCG::renderingMode const):
+ * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h:
+ (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate):
+ (): Deleted.
+
2022-03-04 Dan Glastonbury <d...@apple.com>
Support constants in IDL namespaces.
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (290847 => 290848)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2022-03-04 22:12:04 UTC (rev 290847)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2022-03-04 22:43:58 UTC (rev 290848)
@@ -1390,30 +1390,23 @@
void GraphicsContextCG::setIsCALayerContext(bool isLayerContext)
{
// Should be called for CA Context.
- ASSERT(m_data);
- if (isLayerContext)
- m_data->m_contextFlags |= IsLayerCGContext;
- else
- m_data->m_contextFlags &= ~IsLayerCGContext;
+ m_data->m_contextFlags.set(GraphicsContextCGFlag::IsLayerCGContext, isLayerContext);
}
bool GraphicsContextCG::isCALayerContext() const
{
- return m_data && (m_data->m_contextFlags & IsLayerCGContext);
+ return m_data && m_data->m_contextFlags.contains(GraphicsContextCGFlag::IsLayerCGContext);
}
void GraphicsContextCG::setIsAcceleratedContext(bool isAccelerated)
{
// Should be called for CA Context.
- if (isAccelerated)
- m_data->m_contextFlags |= IsAcceleratedCGContext;
- else
- m_data->m_contextFlags &= ~IsAcceleratedCGContext;
+ m_data->m_contextFlags.set(GraphicsContextCGFlag::IsAcceleratedCGContext, isAccelerated);
}
RenderingMode GraphicsContextCG::renderingMode() const
{
- return m_data->m_contextFlags & IsAcceleratedCGContext ? RenderingMode::Accelerated : RenderingMode::Unaccelerated;
+ return m_data->m_contextFlags.contains(GraphicsContextCGFlag::IsAcceleratedCGContext) ? RenderingMode::Accelerated : RenderingMode::Unaccelerated;
}
void GraphicsContextCG::applyDeviceScaleFactor(float deviceScaleFactor)
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h (290847 => 290848)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h 2022-03-04 22:12:04 UTC (rev 290847)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h 2022-03-04 22:43:58 UTC (rev 290848)
@@ -31,17 +31,15 @@
namespace WebCore {
-enum GraphicsContextCGFlag {
- IsLayerCGContext = 1 << 0,
- IsAcceleratedCGContext = 1 << 1
+enum class GraphicsContextCGFlag : uint8_t {
+ IsLayerCGContext = 1 << 0,
+ IsAcceleratedCGContext = 1 << 1
};
-typedef unsigned GraphicsContextCGFlags;
-
class GraphicsContextPlatformPrivate {
WTF_MAKE_FAST_ALLOCATED;
public:
- GraphicsContextPlatformPrivate(RetainPtr<CGContextRef>&& cgContext, GraphicsContextCGFlags flags = 0)
+ GraphicsContextPlatformPrivate(RetainPtr<CGContextRef>&& cgContext, OptionSet<GraphicsContextCGFlag> flags = { })
: m_cgContext(WTFMove(cgContext))
#if PLATFORM(WIN)
, m_hdc(0)
@@ -83,7 +81,7 @@
RetainPtr<CGContextRef> m_cgContext;
bool m_userToDeviceTransformKnownToBeIdentity;
- GraphicsContextCGFlags m_contextFlags;
+ OptionSet<GraphicsContextCGFlag> m_contextFlags;
};
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes