Bug 1583998 - Implement a pref to obscure images. r=gw

This approach does have some stacking issues. The way to fix this would
be to instrument the brush_image shader rather than adding debug rects.

Something like: #ifdef WR_FEATURE_SFW frag.color = vec4(0,1,1,1); #endif

That's slightly more involved though, so I'm going to leave it for now.

Differential Revision: https://phabricator.services.mozilla.com/D47155

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bobby Holley 2019-09-25 21:48:35 +00:00
parent d599cb6095
commit 585847b17a
4 changed files with 14 additions and 0 deletions

View File

@ -597,6 +597,8 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
GFX_WEBRENDER_DEBUG(".disable-text-prims", wr::DebugFlags_DISABLE_TEXT_PRIMS)
GFX_WEBRENDER_DEBUG(".disable-gradient-prims",
wr::DebugFlags_DISABLE_GRADIENT_PRIMS)
GFX_WEBRENDER_DEBUG(".obscure-images",
wr::DebugFlags_OBSCURE_IMAGES)
#undef GFX_WEBRENDER_DEBUG
gfx::gfxVars::SetWebRenderDebugFlags(flags.bits);

View File

@ -2230,6 +2230,16 @@ impl PrimitiveStore {
let debug_rect = clipped_world_rect * frame_context.global_device_pixel_scale;
frame_state.scratch.push_debug_rect(debug_rect, debug_color, debug_color.scale_alpha(0.5));
}
} else if frame_context.debug_flags.contains(::api::DebugFlags::OBSCURE_IMAGES) {
if matches!(prim_instance.kind, PrimitiveInstanceKind::Image { .. } |
PrimitiveInstanceKind::YuvImage { .. })
{
// We allow "small" images, since they're generally UI elements.
let rect = clipped_world_rect * frame_context.global_device_pixel_scale;
if rect.size.width > 70.0 && rect.size.height > 70.0 {
frame_state.scratch.push_debug_rect(rect, debug_colors::PURPLE, debug_colors::PURPLE);
}
}
}
let vis_index = PrimitiveVisibilityIndex(frame_state.scratch.prim_info.len() as u32);

View File

@ -1087,6 +1087,7 @@ bitflags! {
const DISABLE_CLIP_MASKS = 1 << 21;
const DISABLE_TEXT_PRIMS = 1 << 22;
const DISABLE_GRADIENT_PRIMS = 1 << 23;
const OBSCURE_IMAGES = 1 << 24;
}
}

View File

@ -668,6 +668,7 @@ pref("gfx.webrender.debug.slow-frame-indicator", false);
pref("gfx.webrender.debug.picture-caching", false);
pref("gfx.webrender.debug.primitives", false);
pref("gfx.webrender.debug.small-screen", false);
pref("gfx.webrender.debug.obscure-images", false);
pref("accessibility.warn_on_browsewithcaret", true);