1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! macOS text-selection highlight painting.
//!
//! [`draw_selection_highlight`] is the CoreGraphics twin of
//! `GtkBackend::apply_selection_highlight`'s Cairo `fill()` call and
//! `WinBackend::apply_selection_highlight`'s Direct2D `FillRectangle`
//! call — the one piece of the shared `crate::text_selection` adoption
//! pattern that has no portable shape (real toolkit paint code). See
//! that module's doc for what stays shared (the region registry, the
//! active-selection state machine, the pixel↔cell row/column math) vs.
//! what each pixel-based backend owns itself.
//!
//! [`super::backend::MacBackend::apply_selection_highlight`] resolves the
//! active selection all the way to pixel-space `Rect`s via
//! [`crate::backend_core::BackendCore::selection_highlight_rects`]
//! and hands them, plus a colour resolved from
//! [`crate::theme::Theme::text_selection_highlight`], to
//! [`draw_selection_highlight`] — mirroring every other `draw_*` method
//! on `MacBackend`, which resolves geometry itself and delegates the
//! actual CG calls to a per-primitive submodule. This module now owns
//! only the real `CGContextFillRect` calls, which have no portable
//! shape.
use ;
use CGContextRef;
use crateRect;
use crateColor;
/// Paint one translucent-blue rectangle per already-resolved pixel-space
/// `rect` — mirrors `WinBackend::apply_selection_highlight`'s identical
/// loop over Direct2D `FillRectangle` calls. The row/column → pixel-rect
/// resolution itself (`region_bounds` + cell ranges → `rects`) lives
/// in [`crate::backend_core::BackendCore::selection_highlight_rects`],
/// shared with the GTK/Win-GUI twins — this function only owns
/// the real `CGContextFillRect` calls, which have no portable shape.
///
/// `color` comes from [`crate::theme::Theme::text_selection_highlight`].
/// CG's fill-colour API takes floats directly, so it's converted from
/// `Color`'s 0-255 channels here.
///
/// # Safety
///
/// `ctx` must be a valid, non-null `CGContextRef` borrowed for the
/// duration of this call — i.e. called from inside
/// [`super::backend::MacBackend::enter_frame_scope`], same contract as
/// every other CG-calling function in `macos/`.
pub unsafe
extern "C"