Skip to content
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

Allow updating images that are not raw buffers #1004

Merged
merged 4 commits into from Mar 29, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Replace an if/else expression by a match.

  • Loading branch information
nical committed Mar 24, 2017
commit e2fc85e31be881e58362be762c80ea933544f414
@@ -722,27 +722,30 @@ impl TextureCache {
panic!("The vector image should have been rasterized into a raw image.");
}
ImageData::Raw(bytes) => {
if let Some(dirty) = dirty_rect {
let stride = descriptor.compute_stride();
let offset = descriptor.offset + dirty.origin.y * stride + dirty.origin.x;
TextureUpdateOp::Update {
page_pos_x: existing_item.allocated_rect.origin.x + dirty.origin.x,
page_pos_y: existing_item.allocated_rect.origin.y + dirty.origin.y,
width: dirty.size.width,
height: dirty.size.height,
data: bytes,
stride: Some(stride),
offset: offset,
match dirty_rect {
Some(dirty) => {
let stride = descriptor.compute_stride();
let offset = descriptor.offset + dirty.origin.y * stride + dirty.origin.x;
TextureUpdateOp::Update {
page_pos_x: existing_item.allocated_rect.origin.x + dirty.origin.x,
page_pos_y: existing_item.allocated_rect.origin.y + dirty.origin.y,
width: dirty.size.width,
height: dirty.size.height,
data: bytes,
stride: Some(stride),
offset: offset,
}
}
} else {
TextureUpdateOp::Update {
page_pos_x: existing_item.allocated_rect.origin.x,
page_pos_y: existing_item.allocated_rect.origin.y,
width: descriptor.width,
height: descriptor.height,
data: bytes,
stride: descriptor.stride,
offset: descriptor.offset,
None => {
TextureUpdateOp::Update {
page_pos_x: existing_item.allocated_rect.origin.x,
page_pos_y: existing_item.allocated_rect.origin.y,
width: descriptor.width,
height: descriptor.height,
data: bytes,
stride: descriptor.stride,
offset: descriptor.offset,
}
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.