-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encode path_data
and draw_data
directly as u32
#817
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,31 +270,35 @@ impl Resolver { | |
extend, | ||
} => { | ||
if pos < *draw_data_offset { | ||
data.extend_from_slice(&encoding.draw_data[pos..*draw_data_offset]); | ||
data.extend_from_slice(bytemuck::cast_slice( | ||
&encoding.draw_data[pos..*draw_data_offset], | ||
)); | ||
} | ||
let index_mode = (ramp_id << 2) | *extend as u32; | ||
data.extend_from_slice(bytemuck::bytes_of(&index_mode)); | ||
pos = *draw_data_offset + 4; | ||
pos = *draw_data_offset + 1; | ||
} | ||
ResolvedPatch::GlyphRun { .. } => {} | ||
ResolvedPatch::Image { | ||
index, | ||
draw_data_offset, | ||
} => { | ||
if pos < *draw_data_offset { | ||
data.extend_from_slice(&encoding.draw_data[pos..*draw_data_offset]); | ||
data.extend_from_slice(bytemuck::cast_slice( | ||
&encoding.draw_data[pos..*draw_data_offset], | ||
)); | ||
} | ||
if let Some((x, y)) = self.pending_images[*index].xy { | ||
let xy = (x << 16) | y; | ||
data.extend_from_slice(bytemuck::bytes_of(&xy)); | ||
pos = *draw_data_offset + 4; | ||
pos = *draw_data_offset + 1; | ||
} else { | ||
// If we get here, we failed to allocate a slot for this image in the atlas. | ||
// In this case, let's zero out the dimensions so we don't attempt to render | ||
// anything. | ||
// TODO: a better strategy: texture array? downsample large images? | ||
data.extend_from_slice(&[0_u8; 8]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is slightly confusing then being There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes... I don't think there's really a cleaner way to express this, because There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree this is somewhat confusing, but am also not sure there's a great way around it. |
||
pos = *draw_data_offset + 8; | ||
pos = *draw_data_offset + 2; | ||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, I think.