Introduce Skia is renderer queries
Add query functions to determine if a renderer variant that uses Skia
is in use. This is in preparation for enabling Skia and AGG renderers
to coexist in a single build and for the renderer to be selectable at
runtime.
These query functions enable tests to be incrementally refactored to
always include Skia and AGG definitions in a test build, and to select
at runtime which results to use for expectations.
For now these new queries are predictably a direct match of the Skia
defines. Enabling this to be runtime-driven based on a variable will
come as more changes to the underlying renderer support are filled in.
Bug: pdfium:1878
Change-Id: Ie3e74b3ac4355ad90cb478d707356331af52bee7
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/96733
Commit-Queue: Alan Screen <awscreen@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/core/fxge/cfx_defaultrenderdevice.cpp b/core/fxge/cfx_defaultrenderdevice.cpp
index 0345964..4cecac5 100644
--- a/core/fxge/cfx_defaultrenderdevice.cpp
+++ b/core/fxge/cfx_defaultrenderdevice.cpp
@@ -8,6 +8,28 @@
#include "core/fxge/dib/cfx_dibitmap.h"
+// static
+bool CFX_DefaultRenderDevice::SkiaIsDefaultRenderer() {
+#if defined(_SKIA_SUPPORT_)
+ // TODO(crbug.com/pdfium/1878) This will become variable-based once a method
+ // is provided to set the default at runtime.
+ return true;
+#else
+ return false;
+#endif
+}
+
+// static
+bool CFX_DefaultRenderDevice::SkiaPathsIsDefaultRenderer() {
+#if defined(_SKIA_SUPPORT_PATHS_)
+ // TODO(crbug.com/pdfium/1878) This will become variable-based once a method
+ // is provided to set the default at runtime.
+ return true;
+#else
+ return false;
+#endif
+}
+
bool CFX_DefaultRenderDevice::Attach(RetainPtr<CFX_DIBitmap> pBitmap) {
return AttachWithRgbByteOrder(std::move(pBitmap), false);
}
diff --git a/core/fxge/cfx_defaultrenderdevice.h b/core/fxge/cfx_defaultrenderdevice.h
index 7e2c55e..2e92c22 100644
--- a/core/fxge/cfx_defaultrenderdevice.h
+++ b/core/fxge/cfx_defaultrenderdevice.h
@@ -43,6 +43,12 @@
BlendMode blend_type) override;
#endif
+ // Runtime check to see if Skia is the renderer variant in use.
+ static bool SkiaIsDefaultRenderer();
+
+ // Runtime check to see if SkiaPaths is the renderer variant in use.
+ static bool SkiaPathsIsDefaultRenderer();
+
private:
bool AttachImpl(RetainPtr<CFX_DIBitmap> pBitmap,
bool bRgbByteOrder,