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
//! Direct2D / DirectWrite layout helper for
//! [`crate::primitives::chart::Chart`] (issue #26).
//!
//! Painting moved to the shared [`crate::primitives::chart::paint`]
//! (#810, PaintSurface Phase 2c) — see that fn's doc for the
//! divergences resolved while unifying `gtk::chart::draw_chart`,
//! `macos::chart::draw_chart` and `win::chart::draw_chart` into one
//! implementation, including the quadraui#791 clip this backend never
//! had before. This module now only carries [`win_chart_layout`], the
//! DIP-unit layout query used for both hit-testing
//! (`WinBackend::chart_layout`) and painting (`WinBackend::draw_chart`).
//!
//! Only compiled on `target_os = "windows"` — see `super::mod`'s
//! `#[cfg(target_os = "windows")] mod chart;` and `backend.rs`'s module
//! docs.
use crate::event::Rect;
use crate::primitives::chart::{Chart, ChartLayout};
use crate::primitives::layout_metrics::pixel_chart_layout;
/// Compute a [`Chart`]'s layout without painting — the DirectWrite twin
/// of `gtk_chart_layout`/`mac_chart_layout`, via [`pixel_chart_layout`]
/// (issue #1079).
pub fn win_chart_layout(
chart: &Chart,
rect: Rect,
char_width: f32,
line_height: f32,
) -> ChartLayout {
pixel_chart_layout(
chart,
rect.x,
rect.y,
rect.width,
rect.height,
line_height,
char_width,
)
}