fidl_fuchsia_accessibility__common/
fidl_fuchsia_accessibility__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Specifies color correction mode.
12#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
13#[repr(u32)]
14pub enum ColorCorrectionMode {
15    /// No color correction.
16    Disabled = 0,
17    /// Color correction for protanomaly (red-green -- reduced sensitivity to red light).
18    CorrectProtanomaly = 1,
19    /// Color correction for deuteranomaly (red-green -- reduced sensitivity to green light).
20    CorrectDeuteranomaly = 2,
21    /// Color correction for tritanomaly (blue-yellow -- reduced sensitivity to blue light).
22    CorrectTritanomaly = 3,
23}
24
25impl ColorCorrectionMode {
26    #[inline]
27    pub fn from_primitive(prim: u32) -> Option<Self> {
28        match prim {
29            0 => Some(Self::Disabled),
30            1 => Some(Self::CorrectProtanomaly),
31            2 => Some(Self::CorrectDeuteranomaly),
32            3 => Some(Self::CorrectTritanomaly),
33            _ => None,
34        }
35    }
36
37    #[inline]
38    pub const fn into_primitive(self) -> u32 {
39        self as u32
40    }
41}
42
43#[derive(Clone, Debug, PartialEq)]
44pub struct ColorTransformHandlerSetColorTransformConfigurationRequest {
45    pub configuration: ColorTransformConfiguration,
46}
47
48impl fidl::Persistable for ColorTransformHandlerSetColorTransformConfigurationRequest {}
49
50#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
51pub struct MagnificationHandlerSetClipSpaceTransformRequest {
52    pub x: f32,
53    pub y: f32,
54    pub scale: f32,
55}
56
57impl fidl::Persistable for MagnificationHandlerSetClipSpaceTransformRequest {}
58
59/// The current configuration for accessibility color transforms, which includes color inversion and
60/// color correction. This always includes the matrix required to apply the appropriate transforms.
61/// Color correction and color inversion may be active simultaneously.
62///
63/// For original RGB value (r, g, b) (each component ranged between 0 and 1), the RGB value of
64/// corrected color (r', g', b') is
65///   (r', g', b') = color_adjustment_post_offset
66///                + color_adjustment_matrix . ((r, g, b) + color_adjustment_pre_offset).
67#[derive(Clone, Debug, Default, PartialEq)]
68pub struct ColorTransformConfiguration {
69    /// When color_inversion_enabled is true, certain colors are inverted across the entire screen.
70    /// If this field is omitted behavior should remain unchanged.
71    pub color_inversion_enabled: Option<bool>,
72    /// When color_correction is set to DISABLED, colors are displayed normally. When
73    /// color_correction has different value, colors are modified to correct for the specified type
74    /// of color blindness. If this field is omitted behavior should remain unchanged.
75    pub color_correction: Option<ColorCorrectionMode>,
76    /// 3x3 Matrix in row-major form which will be used by root presenter to apply color correction
77    /// and color inversion, or a combination fo the two. This field should always be set.
78    pub color_adjustment_matrix: Option<[f32; 9]>,
79    /// 3x1 vector which is used by root presenter as an offset added to the original RGB color,
80    /// before it multiplies with the |color_adjustment_matrix|. This field should always be set.
81    pub color_adjustment_pre_offset: Option<[f32; 3]>,
82    /// 3x1 vector which is used by root presenter as an offset added to the multiplied result
83    /// of |color_adjustment_matrix| and original RGB color. This field should always be set.
84    pub color_adjustment_post_offset: Option<[f32; 3]>,
85    #[doc(hidden)]
86    pub __source_breaking: fidl::marker::SourceBreaking,
87}
88
89impl fidl::Persistable for ColorTransformConfiguration {}
90
91pub mod color_transform_ordinals {
92    pub const REGISTER_COLOR_TRANSFORM_HANDLER: u64 = 0x49ff3b83fcb05b88;
93}
94
95pub mod color_transform_handler_ordinals {
96    pub const SET_COLOR_TRANSFORM_CONFIGURATION: u64 = 0x747ad9d676318dc6;
97}
98
99pub mod magnification_handler_ordinals {
100    pub const SET_CLIP_SPACE_TRANSFORM: u64 = 0x71e54bab8b9f7357;
101}
102
103pub mod magnifier_ordinals {
104    pub const REGISTER_HANDLER: u64 = 0x36559e34eb45d161;
105}
106
107mod internal {
108    use super::*;
109    unsafe impl fidl::encoding::TypeMarker for ColorCorrectionMode {
110        type Owned = Self;
111
112        #[inline(always)]
113        fn inline_align(_context: fidl::encoding::Context) -> usize {
114            std::mem::align_of::<u32>()
115        }
116
117        #[inline(always)]
118        fn inline_size(_context: fidl::encoding::Context) -> usize {
119            std::mem::size_of::<u32>()
120        }
121
122        #[inline(always)]
123        fn encode_is_copy() -> bool {
124            true
125        }
126
127        #[inline(always)]
128        fn decode_is_copy() -> bool {
129            false
130        }
131    }
132
133    impl fidl::encoding::ValueTypeMarker for ColorCorrectionMode {
134        type Borrowed<'a> = Self;
135        #[inline(always)]
136        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
137            *value
138        }
139    }
140
141    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
142        for ColorCorrectionMode
143    {
144        #[inline]
145        unsafe fn encode(
146            self,
147            encoder: &mut fidl::encoding::Encoder<'_, D>,
148            offset: usize,
149            _depth: fidl::encoding::Depth,
150        ) -> fidl::Result<()> {
151            encoder.debug_check_bounds::<Self>(offset);
152            encoder.write_num(self.into_primitive(), offset);
153            Ok(())
154        }
155    }
156
157    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorCorrectionMode {
158        #[inline(always)]
159        fn new_empty() -> Self {
160            Self::Disabled
161        }
162
163        #[inline]
164        unsafe fn decode(
165            &mut self,
166            decoder: &mut fidl::encoding::Decoder<'_, D>,
167            offset: usize,
168            _depth: fidl::encoding::Depth,
169        ) -> fidl::Result<()> {
170            decoder.debug_check_bounds::<Self>(offset);
171            let prim = decoder.read_num::<u32>(offset);
172
173            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
174            Ok(())
175        }
176    }
177
178    impl fidl::encoding::ValueTypeMarker
179        for ColorTransformHandlerSetColorTransformConfigurationRequest
180    {
181        type Borrowed<'a> = &'a Self;
182        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
183            value
184        }
185    }
186
187    unsafe impl fidl::encoding::TypeMarker
188        for ColorTransformHandlerSetColorTransformConfigurationRequest
189    {
190        type Owned = Self;
191
192        #[inline(always)]
193        fn inline_align(_context: fidl::encoding::Context) -> usize {
194            8
195        }
196
197        #[inline(always)]
198        fn inline_size(_context: fidl::encoding::Context) -> usize {
199            16
200        }
201    }
202
203    unsafe impl<D: fidl::encoding::ResourceDialect>
204        fidl::encoding::Encode<ColorTransformHandlerSetColorTransformConfigurationRequest, D>
205        for &ColorTransformHandlerSetColorTransformConfigurationRequest
206    {
207        #[inline]
208        unsafe fn encode(
209            self,
210            encoder: &mut fidl::encoding::Encoder<'_, D>,
211            offset: usize,
212            _depth: fidl::encoding::Depth,
213        ) -> fidl::Result<()> {
214            encoder
215                .debug_check_bounds::<ColorTransformHandlerSetColorTransformConfigurationRequest>(
216                    offset,
217                );
218            // Delegate to tuple encoding.
219            fidl::encoding::Encode::<ColorTransformHandlerSetColorTransformConfigurationRequest, D>::encode(
220                (
221                    <ColorTransformConfiguration as fidl::encoding::ValueTypeMarker>::borrow(&self.configuration),
222                ),
223                encoder, offset, _depth
224            )
225        }
226    }
227    unsafe impl<
228            D: fidl::encoding::ResourceDialect,
229            T0: fidl::encoding::Encode<ColorTransformConfiguration, D>,
230        > fidl::encoding::Encode<ColorTransformHandlerSetColorTransformConfigurationRequest, D>
231        for (T0,)
232    {
233        #[inline]
234        unsafe fn encode(
235            self,
236            encoder: &mut fidl::encoding::Encoder<'_, D>,
237            offset: usize,
238            depth: fidl::encoding::Depth,
239        ) -> fidl::Result<()> {
240            encoder
241                .debug_check_bounds::<ColorTransformHandlerSetColorTransformConfigurationRequest>(
242                    offset,
243                );
244            // Zero out padding regions. There's no need to apply masks
245            // because the unmasked parts will be overwritten by fields.
246            // Write the fields.
247            self.0.encode(encoder, offset + 0, depth)?;
248            Ok(())
249        }
250    }
251
252    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
253        for ColorTransformHandlerSetColorTransformConfigurationRequest
254    {
255        #[inline(always)]
256        fn new_empty() -> Self {
257            Self { configuration: fidl::new_empty!(ColorTransformConfiguration, D) }
258        }
259
260        #[inline]
261        unsafe fn decode(
262            &mut self,
263            decoder: &mut fidl::encoding::Decoder<'_, D>,
264            offset: usize,
265            _depth: fidl::encoding::Depth,
266        ) -> fidl::Result<()> {
267            decoder.debug_check_bounds::<Self>(offset);
268            // Verify that padding bytes are zero.
269            fidl::decode!(
270                ColorTransformConfiguration,
271                D,
272                &mut self.configuration,
273                decoder,
274                offset + 0,
275                _depth
276            )?;
277            Ok(())
278        }
279    }
280
281    impl fidl::encoding::ValueTypeMarker for MagnificationHandlerSetClipSpaceTransformRequest {
282        type Borrowed<'a> = &'a Self;
283        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
284            value
285        }
286    }
287
288    unsafe impl fidl::encoding::TypeMarker for MagnificationHandlerSetClipSpaceTransformRequest {
289        type Owned = Self;
290
291        #[inline(always)]
292        fn inline_align(_context: fidl::encoding::Context) -> usize {
293            4
294        }
295
296        #[inline(always)]
297        fn inline_size(_context: fidl::encoding::Context) -> usize {
298            12
299        }
300    }
301
302    unsafe impl<D: fidl::encoding::ResourceDialect>
303        fidl::encoding::Encode<MagnificationHandlerSetClipSpaceTransformRequest, D>
304        for &MagnificationHandlerSetClipSpaceTransformRequest
305    {
306        #[inline]
307        unsafe fn encode(
308            self,
309            encoder: &mut fidl::encoding::Encoder<'_, D>,
310            offset: usize,
311            _depth: fidl::encoding::Depth,
312        ) -> fidl::Result<()> {
313            encoder.debug_check_bounds::<MagnificationHandlerSetClipSpaceTransformRequest>(offset);
314            // Delegate to tuple encoding.
315            fidl::encoding::Encode::<MagnificationHandlerSetClipSpaceTransformRequest, D>::encode(
316                (
317                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
318                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
319                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
320                ),
321                encoder,
322                offset,
323                _depth,
324            )
325        }
326    }
327    unsafe impl<
328            D: fidl::encoding::ResourceDialect,
329            T0: fidl::encoding::Encode<f32, D>,
330            T1: fidl::encoding::Encode<f32, D>,
331            T2: fidl::encoding::Encode<f32, D>,
332        > fidl::encoding::Encode<MagnificationHandlerSetClipSpaceTransformRequest, D>
333        for (T0, T1, T2)
334    {
335        #[inline]
336        unsafe fn encode(
337            self,
338            encoder: &mut fidl::encoding::Encoder<'_, D>,
339            offset: usize,
340            depth: fidl::encoding::Depth,
341        ) -> fidl::Result<()> {
342            encoder.debug_check_bounds::<MagnificationHandlerSetClipSpaceTransformRequest>(offset);
343            // Zero out padding regions. There's no need to apply masks
344            // because the unmasked parts will be overwritten by fields.
345            // Write the fields.
346            self.0.encode(encoder, offset + 0, depth)?;
347            self.1.encode(encoder, offset + 4, depth)?;
348            self.2.encode(encoder, offset + 8, depth)?;
349            Ok(())
350        }
351    }
352
353    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
354        for MagnificationHandlerSetClipSpaceTransformRequest
355    {
356        #[inline(always)]
357        fn new_empty() -> Self {
358            Self {
359                x: fidl::new_empty!(f32, D),
360                y: fidl::new_empty!(f32, D),
361                scale: fidl::new_empty!(f32, D),
362            }
363        }
364
365        #[inline]
366        unsafe fn decode(
367            &mut self,
368            decoder: &mut fidl::encoding::Decoder<'_, D>,
369            offset: usize,
370            _depth: fidl::encoding::Depth,
371        ) -> fidl::Result<()> {
372            decoder.debug_check_bounds::<Self>(offset);
373            // Verify that padding bytes are zero.
374            fidl::decode!(f32, D, &mut self.x, decoder, offset + 0, _depth)?;
375            fidl::decode!(f32, D, &mut self.y, decoder, offset + 4, _depth)?;
376            fidl::decode!(f32, D, &mut self.scale, decoder, offset + 8, _depth)?;
377            Ok(())
378        }
379    }
380
381    impl ColorTransformConfiguration {
382        #[inline(always)]
383        fn max_ordinal_present(&self) -> u64 {
384            if let Some(_) = self.color_adjustment_post_offset {
385                return 5;
386            }
387            if let Some(_) = self.color_adjustment_pre_offset {
388                return 4;
389            }
390            if let Some(_) = self.color_adjustment_matrix {
391                return 3;
392            }
393            if let Some(_) = self.color_correction {
394                return 2;
395            }
396            if let Some(_) = self.color_inversion_enabled {
397                return 1;
398            }
399            0
400        }
401    }
402
403    impl fidl::encoding::ValueTypeMarker for ColorTransformConfiguration {
404        type Borrowed<'a> = &'a Self;
405        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
406            value
407        }
408    }
409
410    unsafe impl fidl::encoding::TypeMarker for ColorTransformConfiguration {
411        type Owned = Self;
412
413        #[inline(always)]
414        fn inline_align(_context: fidl::encoding::Context) -> usize {
415            8
416        }
417
418        #[inline(always)]
419        fn inline_size(_context: fidl::encoding::Context) -> usize {
420            16
421        }
422    }
423
424    unsafe impl<D: fidl::encoding::ResourceDialect>
425        fidl::encoding::Encode<ColorTransformConfiguration, D> for &ColorTransformConfiguration
426    {
427        unsafe fn encode(
428            self,
429            encoder: &mut fidl::encoding::Encoder<'_, D>,
430            offset: usize,
431            mut depth: fidl::encoding::Depth,
432        ) -> fidl::Result<()> {
433            encoder.debug_check_bounds::<ColorTransformConfiguration>(offset);
434            // Vector header
435            let max_ordinal: u64 = self.max_ordinal_present();
436            encoder.write_num(max_ordinal, offset);
437            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
438            // Calling encoder.out_of_line_offset(0) is not allowed.
439            if max_ordinal == 0 {
440                return Ok(());
441            }
442            depth.increment()?;
443            let envelope_size = 8;
444            let bytes_len = max_ordinal as usize * envelope_size;
445            #[allow(unused_variables)]
446            let offset = encoder.out_of_line_offset(bytes_len);
447            let mut _prev_end_offset: usize = 0;
448            if 1 > max_ordinal {
449                return Ok(());
450            }
451
452            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
453            // are envelope_size bytes.
454            let cur_offset: usize = (1 - 1) * envelope_size;
455
456            // Zero reserved fields.
457            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
458
459            // Safety:
460            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
461            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
462            //   envelope_size bytes, there is always sufficient room.
463            fidl::encoding::encode_in_envelope_optional::<bool, D>(
464                self.color_inversion_enabled
465                    .as_ref()
466                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
467                encoder,
468                offset + cur_offset,
469                depth,
470            )?;
471
472            _prev_end_offset = cur_offset + envelope_size;
473            if 2 > max_ordinal {
474                return Ok(());
475            }
476
477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
478            // are envelope_size bytes.
479            let cur_offset: usize = (2 - 1) * envelope_size;
480
481            // Zero reserved fields.
482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
483
484            // Safety:
485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
487            //   envelope_size bytes, there is always sufficient room.
488            fidl::encoding::encode_in_envelope_optional::<ColorCorrectionMode, D>(
489                self.color_correction
490                    .as_ref()
491                    .map(<ColorCorrectionMode as fidl::encoding::ValueTypeMarker>::borrow),
492                encoder,
493                offset + cur_offset,
494                depth,
495            )?;
496
497            _prev_end_offset = cur_offset + envelope_size;
498            if 3 > max_ordinal {
499                return Ok(());
500            }
501
502            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
503            // are envelope_size bytes.
504            let cur_offset: usize = (3 - 1) * envelope_size;
505
506            // Zero reserved fields.
507            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
508
509            // Safety:
510            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
511            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
512            //   envelope_size bytes, there is always sufficient room.
513            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 9>, D>(
514                self.color_adjustment_matrix.as_ref().map(
515                    <fidl::encoding::Array<f32, 9> as fidl::encoding::ValueTypeMarker>::borrow,
516                ),
517                encoder,
518                offset + cur_offset,
519                depth,
520            )?;
521
522            _prev_end_offset = cur_offset + envelope_size;
523            if 4 > max_ordinal {
524                return Ok(());
525            }
526
527            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
528            // are envelope_size bytes.
529            let cur_offset: usize = (4 - 1) * envelope_size;
530
531            // Zero reserved fields.
532            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
533
534            // Safety:
535            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
536            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
537            //   envelope_size bytes, there is always sufficient room.
538            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 3>, D>(
539                self.color_adjustment_pre_offset.as_ref().map(
540                    <fidl::encoding::Array<f32, 3> as fidl::encoding::ValueTypeMarker>::borrow,
541                ),
542                encoder,
543                offset + cur_offset,
544                depth,
545            )?;
546
547            _prev_end_offset = cur_offset + envelope_size;
548            if 5 > max_ordinal {
549                return Ok(());
550            }
551
552            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
553            // are envelope_size bytes.
554            let cur_offset: usize = (5 - 1) * envelope_size;
555
556            // Zero reserved fields.
557            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
558
559            // Safety:
560            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
561            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
562            //   envelope_size bytes, there is always sufficient room.
563            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 3>, D>(
564                self.color_adjustment_post_offset.as_ref().map(
565                    <fidl::encoding::Array<f32, 3> as fidl::encoding::ValueTypeMarker>::borrow,
566                ),
567                encoder,
568                offset + cur_offset,
569                depth,
570            )?;
571
572            _prev_end_offset = cur_offset + envelope_size;
573
574            Ok(())
575        }
576    }
577
578    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
579        for ColorTransformConfiguration
580    {
581        #[inline(always)]
582        fn new_empty() -> Self {
583            Self::default()
584        }
585
586        unsafe fn decode(
587            &mut self,
588            decoder: &mut fidl::encoding::Decoder<'_, D>,
589            offset: usize,
590            mut depth: fidl::encoding::Depth,
591        ) -> fidl::Result<()> {
592            decoder.debug_check_bounds::<Self>(offset);
593            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
594                None => return Err(fidl::Error::NotNullable),
595                Some(len) => len,
596            };
597            // Calling decoder.out_of_line_offset(0) is not allowed.
598            if len == 0 {
599                return Ok(());
600            };
601            depth.increment()?;
602            let envelope_size = 8;
603            let bytes_len = len * envelope_size;
604            let offset = decoder.out_of_line_offset(bytes_len)?;
605            // Decode the envelope for each type.
606            let mut _next_ordinal_to_read = 0;
607            let mut next_offset = offset;
608            let end_offset = offset + bytes_len;
609            _next_ordinal_to_read += 1;
610            if next_offset >= end_offset {
611                return Ok(());
612            }
613
614            // Decode unknown envelopes for gaps in ordinals.
615            while _next_ordinal_to_read < 1 {
616                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
617                _next_ordinal_to_read += 1;
618                next_offset += envelope_size;
619            }
620
621            let next_out_of_line = decoder.next_out_of_line();
622            let handles_before = decoder.remaining_handles();
623            if let Some((inlined, num_bytes, num_handles)) =
624                fidl::encoding::decode_envelope_header(decoder, next_offset)?
625            {
626                let member_inline_size =
627                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
628                if inlined != (member_inline_size <= 4) {
629                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
630                }
631                let inner_offset;
632                let mut inner_depth = depth.clone();
633                if inlined {
634                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
635                    inner_offset = next_offset;
636                } else {
637                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
638                    inner_depth.increment()?;
639                }
640                let val_ref =
641                    self.color_inversion_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
642                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
643                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
644                {
645                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
646                }
647                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
648                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
649                }
650            }
651
652            next_offset += envelope_size;
653            _next_ordinal_to_read += 1;
654            if next_offset >= end_offset {
655                return Ok(());
656            }
657
658            // Decode unknown envelopes for gaps in ordinals.
659            while _next_ordinal_to_read < 2 {
660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
661                _next_ordinal_to_read += 1;
662                next_offset += envelope_size;
663            }
664
665            let next_out_of_line = decoder.next_out_of_line();
666            let handles_before = decoder.remaining_handles();
667            if let Some((inlined, num_bytes, num_handles)) =
668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
669            {
670                let member_inline_size =
671                    <ColorCorrectionMode as fidl::encoding::TypeMarker>::inline_size(
672                        decoder.context,
673                    );
674                if inlined != (member_inline_size <= 4) {
675                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
676                }
677                let inner_offset;
678                let mut inner_depth = depth.clone();
679                if inlined {
680                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
681                    inner_offset = next_offset;
682                } else {
683                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
684                    inner_depth.increment()?;
685                }
686                let val_ref = self
687                    .color_correction
688                    .get_or_insert_with(|| fidl::new_empty!(ColorCorrectionMode, D));
689                fidl::decode!(ColorCorrectionMode, D, val_ref, decoder, inner_offset, inner_depth)?;
690                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
691                {
692                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
693                }
694                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
695                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
696                }
697            }
698
699            next_offset += envelope_size;
700            _next_ordinal_to_read += 1;
701            if next_offset >= end_offset {
702                return Ok(());
703            }
704
705            // Decode unknown envelopes for gaps in ordinals.
706            while _next_ordinal_to_read < 3 {
707                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
708                _next_ordinal_to_read += 1;
709                next_offset += envelope_size;
710            }
711
712            let next_out_of_line = decoder.next_out_of_line();
713            let handles_before = decoder.remaining_handles();
714            if let Some((inlined, num_bytes, num_handles)) =
715                fidl::encoding::decode_envelope_header(decoder, next_offset)?
716            {
717                let member_inline_size =
718                    <fidl::encoding::Array<f32, 9> as fidl::encoding::TypeMarker>::inline_size(
719                        decoder.context,
720                    );
721                if inlined != (member_inline_size <= 4) {
722                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
723                }
724                let inner_offset;
725                let mut inner_depth = depth.clone();
726                if inlined {
727                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
728                    inner_offset = next_offset;
729                } else {
730                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
731                    inner_depth.increment()?;
732                }
733                let val_ref = self
734                    .color_adjustment_matrix
735                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 9>, D));
736                fidl::decode!(fidl::encoding::Array<f32, 9>, D, val_ref, decoder, inner_offset, inner_depth)?;
737                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
738                {
739                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
740                }
741                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
742                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
743                }
744            }
745
746            next_offset += envelope_size;
747            _next_ordinal_to_read += 1;
748            if next_offset >= end_offset {
749                return Ok(());
750            }
751
752            // Decode unknown envelopes for gaps in ordinals.
753            while _next_ordinal_to_read < 4 {
754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
755                _next_ordinal_to_read += 1;
756                next_offset += envelope_size;
757            }
758
759            let next_out_of_line = decoder.next_out_of_line();
760            let handles_before = decoder.remaining_handles();
761            if let Some((inlined, num_bytes, num_handles)) =
762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
763            {
764                let member_inline_size =
765                    <fidl::encoding::Array<f32, 3> as fidl::encoding::TypeMarker>::inline_size(
766                        decoder.context,
767                    );
768                if inlined != (member_inline_size <= 4) {
769                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
770                }
771                let inner_offset;
772                let mut inner_depth = depth.clone();
773                if inlined {
774                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
775                    inner_offset = next_offset;
776                } else {
777                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
778                    inner_depth.increment()?;
779                }
780                let val_ref = self
781                    .color_adjustment_pre_offset
782                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 3>, D));
783                fidl::decode!(fidl::encoding::Array<f32, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
784                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
785                {
786                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
787                }
788                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
789                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
790                }
791            }
792
793            next_offset += envelope_size;
794            _next_ordinal_to_read += 1;
795            if next_offset >= end_offset {
796                return Ok(());
797            }
798
799            // Decode unknown envelopes for gaps in ordinals.
800            while _next_ordinal_to_read < 5 {
801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
802                _next_ordinal_to_read += 1;
803                next_offset += envelope_size;
804            }
805
806            let next_out_of_line = decoder.next_out_of_line();
807            let handles_before = decoder.remaining_handles();
808            if let Some((inlined, num_bytes, num_handles)) =
809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
810            {
811                let member_inline_size =
812                    <fidl::encoding::Array<f32, 3> as fidl::encoding::TypeMarker>::inline_size(
813                        decoder.context,
814                    );
815                if inlined != (member_inline_size <= 4) {
816                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
817                }
818                let inner_offset;
819                let mut inner_depth = depth.clone();
820                if inlined {
821                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
822                    inner_offset = next_offset;
823                } else {
824                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
825                    inner_depth.increment()?;
826                }
827                let val_ref = self
828                    .color_adjustment_post_offset
829                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 3>, D));
830                fidl::decode!(fidl::encoding::Array<f32, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
831                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
832                {
833                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
834                }
835                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
836                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
837                }
838            }
839
840            next_offset += envelope_size;
841
842            // Decode the remaining unknown envelopes.
843            while next_offset < end_offset {
844                _next_ordinal_to_read += 1;
845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
846                next_offset += envelope_size;
847            }
848
849            Ok(())
850        }
851    }
852}