render: fix sampling of transformed buffers with crop
This commit is contained in:
parent
ae87b3ef7a
commit
73c5010e4e
1 changed files with 36 additions and 6 deletions
|
|
@ -72,13 +72,43 @@ impl SampleRect {
|
|||
let y2 = self.y2;
|
||||
match self.buffer_transform {
|
||||
None => [[x2, y1], [x1, y1], [x2, y2], [x1, y2]],
|
||||
Rotate90 => [[y1, x1], [y1, x2], [y2, x1], [y2, x2]],
|
||||
Rotate180 => [[x1, y2], [x2, y2], [x1, y1], [x2, y1]],
|
||||
Rotate270 => [[y2, x2], [y2, x1], [y1, x2], [y1, x1]],
|
||||
Flip => [[x1, y1], [x2, y1], [x1, y2], [x2, y2]],
|
||||
Rotate90 => [
|
||||
[y1, 1.0 - x2],
|
||||
[y1, 1.0 - x1],
|
||||
[y2, 1.0 - x2],
|
||||
[y2, 1.0 - x1],
|
||||
],
|
||||
Rotate180 => [
|
||||
[1.0 - x2, 1.0 - y1],
|
||||
[1.0 - x1, 1.0 - y1],
|
||||
[1.0 - x2, 1.0 - y2],
|
||||
[1.0 - x1, 1.0 - y2],
|
||||
],
|
||||
Rotate270 => [
|
||||
[1.0 - y1, x2],
|
||||
[1.0 - y1, x1],
|
||||
[1.0 - y2, x2],
|
||||
[1.0 - y2, x1],
|
||||
],
|
||||
Flip => [
|
||||
[1.0 - x2, y1],
|
||||
[1.0 - x1, y1],
|
||||
[1.0 - x2, y2],
|
||||
[1.0 - x1, y2],
|
||||
],
|
||||
FlipRotate90 => [[y1, x2], [y1, x1], [y2, x2], [y2, x1]],
|
||||
FlipRotate180 => [[x2, y2], [x1, y2], [x2, y1], [x1, y1]],
|
||||
FlipRotate270 => [[y2, x1], [y2, x2], [y1, x1], [y1, x2]],
|
||||
FlipRotate180 => [
|
||||
[x2, 1.0 - y1],
|
||||
[x1, 1.0 - y1],
|
||||
[x2, 1.0 - y2],
|
||||
[x1, 1.0 - y2],
|
||||
],
|
||||
FlipRotate270 => [
|
||||
[1.0 - y1, 1.0 - x2],
|
||||
[1.0 - y1, 1.0 - x1],
|
||||
[1.0 - y2, 1.0 - x2],
|
||||
[1.0 - y2, 1.0 - x1],
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue