Skip to content

Commit 39cd837

Browse files
nrxusCobrand
authored andcommitted
remove TextureOwner trait
1 parent f5a6c75 commit 39cd837

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/sdl2/render.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'s> RenderTarget for Surface<'s> {
254254
type Context = SurfaceContext<'s>;
255255
}
256256

257-
impl<'r, 't, TC: TextureOwner> RenderTarget for TextureTarget<'r, 't, TC> {
257+
impl<'r, 't, TC> RenderTarget for TextureTarget<'r, 't, TC> {
258258
type Context = TC;
259259
}
260260

@@ -440,9 +440,7 @@ impl Canvas<Window> {
440440
}
441441
}
442442

443-
impl<T: RenderTarget> Canvas<T>
444-
where T::Context: TextureOwner
445-
{
443+
impl<T: RenderTarget> Canvas<T> {
446444
/// Determine whether a window supports the use of render targets.
447445
pub fn render_target_supported(&self) -> bool {
448446
unsafe { ll::SDL_RenderTargetSupported(self.context.raw) == 1 }
@@ -720,24 +718,15 @@ impl<T> TextureCreator<T> {
720718
}
721719
}
722720

723-
pub struct TextureTarget<'r, 't, TC: TextureOwner> {
721+
pub struct TextureTarget<'r, 't, TC> {
724722
raw_renderer: &'r *mut ll::SDL_Renderer,
725723
_texture_marker: PhantomData<&'t ()>,
726724
// unfortunately there is no way to know which kind of Renderer we have here at compile time,
727725
// so this PhantomData is here to keep track of that.
728726
_texture_target: PhantomData<TC>,
729727
}
730728

731-
/// Represents structs that are the "source" of the Renderer.
732-
///
733-
/// You should *not* implement this trait outside of this crate.
734-
pub trait TextureOwner {}
735-
736-
impl<'s> TextureOwner for SurfaceContext<'s> {}
737-
738-
impl TextureOwner for WindowContext {}
739-
740-
impl<'r, 't, TC: TextureOwner> Drop for TextureTarget<'r, 't, TC> {
729+
impl<'r, 't, TC> Drop for TextureTarget<'r, 't, TC> {
741730
// `Drop` cannot be specialized. Get around this through run-time check of Target Kind
742731
fn drop(&mut self) {
743732
unsafe {
@@ -1192,7 +1181,7 @@ impl<T: RenderTarget> Canvas<T> {
11921181
/// ```
11931182
pub type TextureCanvas<'r, 't, TC> = Canvas<TextureTarget<'r, 't, TC>>;
11941183

1195-
impl<'r, 't, TC: TextureOwner> Canvas<TextureTarget<'r, 't, TC>> {
1184+
impl<'r, 't, TC> Canvas<TextureTarget<'r, 't, TC>> {
11961185
/// Replace the target of the `TextureCanvas` with a different `Texture`
11971186
///
11981187
/// Returns the new `TextureCanvas` and releases the `&mut` borrow on the old `Texture`

0 commit comments

Comments
 (0)