Draw a texture handle as the primitive it is
`Painter::primitive` takes `impl PrimitiveLike`: a primitive, or something that yields one and does whatever else drawing it needs. A `&TextureHandle` yields a `TexturePrimitive` and retains its share on the way through, so `texture`, `texture_within` and `texture_at` are gone and an image is drawn like anything else. I said last round that the blanket impl would collide with the one for `&TextureHandle` under coherence. It does not: `Primitive` is ours, so no crate can add the impl that would overlap, and rustc accepts both. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
01a9b8633d
commit
23fb71ee56
3 files changed
+31
-20
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ pub struct Image {
|
||||
|
||||
impl Widget for Image {
|
||||
fn draw(&mut self, painter: &mut Painter) {
|
||||
painter.texture(&self.handle);
|
||||
painter.primitive(&self.handle);
|
||||
}
|
||||
|
||||
fn desired_width(&mut self, _: &mut SizeCtx) -> Len {
|
||||
|
||||
Reference in new issue
Block a user