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