Skip to content

Commit 8ce388e

Browse files
authored
Auto merge of #4835 - moz-gfx:github-sync, r=auto
Sync changes from mozilla-central gfx/wr None
2 parents b0e4bdd + edef1db commit 8ce388e

File tree

6 files changed

+88
-8
lines changed

6 files changed

+88
-8
lines changed

webrender/src/clip.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ impl From<ClipItemKey> for ClipNode {
894894
// Flags that are attached to instances of clip nodes.
895895
#[cfg_attr(feature = "capture", derive(Serialize))]
896896
#[cfg_attr(feature = "replay", derive(Deserialize))]
897-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
897+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
898898
pub struct ClipNodeFlags(u8);
899899

900900
bitflags! {
@@ -905,6 +905,16 @@ bitflags! {
905905
}
906906
}
907907

908+
impl core::fmt::Debug for ClipNodeFlags {
909+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
910+
if self.is_empty() {
911+
write!(f, "{:#x}", Self::empty().bits())
912+
} else {
913+
bitflags::parser::to_writer(self, f)
914+
}
915+
}
916+
}
917+
908918
// When a clip node is found to be valid for a
909919
// clip chain instance, it's stored in an index
910920
// buffer style structure. This struct contains

webrender/src/gpu_types.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ pub struct MaskInstance {
612612
/// code should process this instance.
613613
#[cfg_attr(feature = "capture", derive(Serialize))]
614614
#[cfg_attr(feature = "replay", derive(Deserialize))]
615-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
615+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
616616
pub struct BrushFlags(u16);
617617

618618
bitflags! {
@@ -646,6 +646,16 @@ bitflags! {
646646
}
647647
}
648648

649+
impl core::fmt::Debug for BrushFlags {
650+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
651+
if self.is_empty() {
652+
write!(f, "{:#x}", Self::empty().bits())
653+
} else {
654+
bitflags::parser::to_writer(self, f)
655+
}
656+
}
657+
}
658+
649659
/// Convenience structure to encode into PrimitiveInstanceData.
650660
pub struct BrushInstance {
651661
pub prim_header_index: PrimitiveHeaderIndex,

webrender/src/segment.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const MAX_SEGMENTS: usize = 64;
7070
/// `write_transform_vertex()` function.
7171
#[cfg_attr(feature = "capture", derive(Serialize))]
7272
#[cfg_attr(feature = "replay", derive(Deserialize))]
73-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
73+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, MallocSizeOf)]
7474
pub struct EdgeAaSegmentMask(u8);
7575

7676
bitflags! {
@@ -86,6 +86,16 @@ bitflags! {
8686
}
8787
}
8888

89+
impl core::fmt::Debug for EdgeAaSegmentMask {
90+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
91+
if self.is_empty() {
92+
write!(f, "{:#x}", Self::empty().bits())
93+
} else {
94+
bitflags::parser::to_writer(self, f)
95+
}
96+
}
97+
}
98+
8999
bitflags! {
90100
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
91101
pub struct ItemFlags: u8 {

webrender_api/src/display_item.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub type ItemTag = (u64, u16);
3535
pub type ItemKey = u16;
3636

3737
#[repr(C)]
38-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
38+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
3939
pub struct PrimitiveFlags(u8);
4040

4141
bitflags! {
@@ -59,6 +59,16 @@ bitflags! {
5959
}
6060
}
6161

62+
impl core::fmt::Debug for PrimitiveFlags {
63+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
64+
if self.is_empty() {
65+
write!(f, "{:#x}", Self::empty().bits())
66+
} else {
67+
bitflags::parser::to_writer(self, f)
68+
}
69+
}
70+
}
71+
6272
impl Default for PrimitiveFlags {
6373
fn default() -> Self {
6474
PrimitiveFlags::IS_BACKFACE_VISIBLE
@@ -933,7 +943,7 @@ impl Hash for RasterSpace {
933943
}
934944

935945
#[repr(C)]
936-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
946+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
937947
pub struct StackingContextFlags(u8);
938948

939949
bitflags! {
@@ -948,6 +958,16 @@ bitflags! {
948958
}
949959
}
950960

961+
impl core::fmt::Debug for StackingContextFlags {
962+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
963+
if self.is_empty() {
964+
write!(f, "{:#x}", Self::empty().bits())
965+
} else {
966+
bitflags::parser::to_writer(self, f)
967+
}
968+
}
969+
}
970+
951971
impl Default for StackingContextFlags {
952972
fn default() -> Self {
953973
StackingContextFlags::empty()

webrender_api/src/font.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl Default for GlyphOptions {
182182
}
183183

184184
#[repr(C)]
185-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
185+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Deserialize, MallocSizeOf, Serialize, PeekPoke)]
186186
pub struct FontInstanceFlags(u32);
187187

188188
bitflags! {
@@ -220,6 +220,16 @@ bitflags! {
220220
}
221221
}
222222

223+
impl core::fmt::Debug for FontInstanceFlags {
224+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
225+
if self.is_empty() {
226+
write!(f, "{:#x}", Self::empty().bits())
227+
} else {
228+
bitflags::parser::to_writer(self, f)
229+
}
230+
}
231+
}
232+
223233
impl Default for FontInstanceFlags {
224234
#[cfg(target_os = "windows")]
225235
fn default() -> FontInstanceFlags {

webrender_api/src/lib.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ pub enum IntParameter {
595595

596596
/// Flags to track why we are rendering.
597597
#[repr(C)]
598-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
598+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
599599
pub struct RenderReasons(u32);
600600

601601
bitflags! {
@@ -633,13 +633,23 @@ bitflags! {
633633
}
634634
}
635635

636+
impl core::fmt::Debug for RenderReasons {
637+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
638+
if self.is_empty() {
639+
write!(f, "{:#x}", Self::empty().bits())
640+
} else {
641+
bitflags::parser::to_writer(self, f)
642+
}
643+
}
644+
}
645+
636646
impl RenderReasons {
637647
pub const NUM_BITS: u32 = 17;
638648
}
639649

640650
/// Flags to enable/disable various builtin debugging tools.
641651
#[repr(C)]
642-
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
652+
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash, Default, Deserialize, MallocSizeOf, Serialize)]
643653
pub struct DebugFlags(u32);
644654

645655
bitflags! {
@@ -713,6 +723,16 @@ bitflags! {
713723
}
714724
}
715725

726+
impl core::fmt::Debug for DebugFlags {
727+
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
728+
if self.is_empty() {
729+
write!(f, "{:#x}", Self::empty().bits())
730+
} else {
731+
bitflags::parser::to_writer(self, f)
732+
}
733+
}
734+
}
735+
716736
/// Information specific to a primitive type that
717737
/// uniquely identifies a primitive template by key.
718738
#[derive(Debug, Clone, Eq, MallocSizeOf, PartialEq, Hash, Serialize, Deserialize)]

0 commit comments

Comments
 (0)