1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:07:35 +00:00

LibPDF: Add debug settings for clipping paths and images

This commit is contained in:
Nico Weber 2024-01-16 20:45:12 -05:00 committed by Sam Atkins
parent 2d8a22f4b4
commit 1845a406ea
2 changed files with 10 additions and 3 deletions

View file

@ -312,13 +312,15 @@ void Renderer::deactivate_clip()
void Renderer::begin_path_paint() void Renderer::begin_path_paint()
{ {
activate_clip(); if (m_rendering_preferences.clip_paths)
activate_clip();
} }
void Renderer::end_path_paint() void Renderer::end_path_paint()
{ {
m_current_path.clear(); m_current_path.clear();
deactivate_clip(); if (m_rendering_preferences.clip_paths)
deactivate_clip();
} }
RENDERER_HANDLER(path_stroke) RENDERER_HANDLER(path_stroke)
@ -1238,7 +1240,9 @@ PDFErrorOr<void> Renderer::show_image(NonnullRefPtr<StreamObject> image)
Renderer& m_renderer; Renderer& m_renderer;
}; };
ClipRAII clip_raii(*this); OwnPtr<ClipRAII> clip_raii;
if (m_rendering_preferences.clip_images)
clip_raii = make<ClipRAII>(*this);
if (!m_rendering_preferences.show_images) { if (!m_rendering_preferences.show_images) {
show_empty_image(width, height); show_empty_image(width, height);

View file

@ -90,6 +90,9 @@ struct RenderingPreferences {
bool show_clipping_paths { false }; bool show_clipping_paths { false };
bool show_images { true }; bool show_images { true };
bool clip_paths { true };
bool clip_images { true };
unsigned hash() const unsigned hash() const
{ {
return static_cast<unsigned>(show_clipping_paths) | static_cast<unsigned>(show_images) << 1; return static_cast<unsigned>(show_clipping_paths) | static_cast<unsigned>(show_images) << 1;