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

Smart pointer for IDriverDependantBitmap #2342

Open
ivan-mogilko opened this issue Mar 1, 2024 · 0 comments
Open

Smart pointer for IDriverDependantBitmap #2342

ivan-mogilko opened this issue Mar 1, 2024 · 0 comments
Labels
context: code fixing/improving existing code: refactor, optimise, tidy... type: enhancement a suggestion or necessity to have something improved

Comments

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Mar 1, 2024

  1. Implement a custom smart pointer type for IDriverDependantBitmap pointer, which calls IGraphicsDriver::DestroyDDB in deleter. This may be just typedefs of std::unique_ptr and std::shared_ptr, with custom deleter.
  2. IGraphicsDriver::CreateDDB* should return this smart pointer instead of a raw ptr.
  3. Replace all instances of raw IDriverDependantBitmap* ptr around the engine code. Simplify DDB disposal to simply a call to smart pointer's "reset" method, or leave this for automatic destruction where possible to simplify the code.

NOTES.
It's possible, but not good to address a graphics driver through the global pointer which we unfortunately have now in the engine code. Instead the smart pointer could wrap this driver's pointer too (or DDB could).

@ivan-mogilko ivan-mogilko added type: enhancement a suggestion or necessity to have something improved context: code fixing/improving existing code: refactor, optimise, tidy... labels Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context: code fixing/improving existing code: refactor, optimise, tidy... type: enhancement a suggestion or necessity to have something improved
Projects
None yet
Development

No branches or pull requests

1 participant