MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / render

Method render

player/NymphCastPlayer/litehtml/src/el_image.cpp:48–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48int litehtml::el_image::render( int x, int y, int max_width, bool second_pass )
49{
50 int parent_width = max_width;
51
52 calc_outlines(parent_width);
53
54 m_pos.move_to(x, y);
55
56 document::ptr doc = get_document();
57
58 litehtml::size sz;
59 doc->container()->get_image_size(m_src.c_str(), 0, sz);
60
61 m_pos.width = sz.width;
62 m_pos.height = sz.height;
63
64 if(m_css_height.is_predefined() && m_css_width.is_predefined())
65 {
66 m_pos.height = sz.height;
67 m_pos.width = sz.width;
68
69 // check for max-width
70 if(!m_css_max_width.is_predefined())
71 {
72 int max_width = doc->cvt_units(m_css_max_width, m_font_size, parent_width);
73 if(m_pos.width > max_width)
74 {
75 m_pos.width = max_width;
76 }
77 if(sz.width)
78 {
79 m_pos.height = (int) ((float) m_pos.width * (float) sz.height / (float)sz.width);
80 } else
81 {
82 m_pos.height = sz.height;
83 }
84 }
85
86 // check for max-height
87 if(!m_css_max_height.is_predefined())
88 {
89 int max_height = calc_max_height(sz.height);
90 if(m_pos.height > max_height)
91 {
92 m_pos.height = max_height;
93 }
94 if(sz.height)
95 {
96 m_pos.width = (int) (m_pos.height * (float)sz.width / (float)sz.height);
97 } else
98 {
99 m_pos.width = sz.width;
100 }
101 }
102 } else if(!m_css_height.is_predefined() && m_css_width.is_predefined())
103 {
104 if (!get_predefined_height(m_pos.height))
105 {

Callers

nothing calls this directly

Calls 8

move_toMethod · 0.80
get_image_sizeMethod · 0.80
containerMethod · 0.80
c_strMethod · 0.80
is_predefinedMethod · 0.80
cvt_unitsMethod · 0.80
valMethod · 0.80
calc_percentMethod · 0.80

Tested by

no test coverage detected