GRAPHICS: Add two new methods to change 'pixels' of a Surface.
One method is a simpler setter for 'pixels'. The other one can be used to setup a Surface with custom data.
This commit is contained in:
parent
767f0d8ca9
commit
260ec7a430
2 changed files with 31 additions and 0 deletions
|
@ -82,6 +82,14 @@ void Surface::free() {
|
|||
format = PixelFormat();
|
||||
}
|
||||
|
||||
void Surface::init(uint16 width, uint16 height, uint16 newPitch, void *newPixels, const PixelFormat &f) {
|
||||
w = width;
|
||||
h = height;
|
||||
pitch = newPitch;
|
||||
pixels = newPixels;
|
||||
format = f;
|
||||
}
|
||||
|
||||
void Surface::copyFrom(const Surface &surf) {
|
||||
create(surf.w, surf.h, surf.format);
|
||||
if (surf.pitch == pitch) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue