diff options
author | rubidium <rubidium@openttd.org> | 2011-11-12 08:26:30 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-12 08:26:30 +0000 |
commit | 4f87d2e88c4b42f4ae4a5c7956f2287740ef174b (patch) | |
tree | d390107524182c8276e616c20612708f9c893f7d /src/blitter | |
parent | bd64bf6372399bad1a92565ae7d3c243658d241f (diff) | |
download | openttd-4f87d2e88c4b42f4ae4a5c7956f2287740ef174b.tar.xz |
(svn r23194) -Codechange: don't cast away const needlessly
Diffstat (limited to 'src/blitter')
-rw-r--r-- | src/blitter/32bpp_anim.cpp | 12 | ||||
-rw-r--r-- | src/blitter/32bpp_base.cpp | 8 | ||||
-rw-r--r-- | src/blitter/32bpp_base.hpp | 2 | ||||
-rw-r--r-- | src/blitter/32bpp_optimized.cpp | 4 | ||||
-rw-r--r-- | src/blitter/8bpp_base.cpp | 8 | ||||
-rw-r--r-- | src/blitter/8bpp_base.hpp | 2 | ||||
-rw-r--r-- | src/blitter/base.hpp | 2 | ||||
-rw-r--r-- | src/blitter/null.hpp | 2 |
8 files changed, 20 insertions, 20 deletions
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index 17ea0af72..be8c26f6c 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -44,7 +44,7 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px); src_px++; - const uint8 *src_n_ln = src_n + *(uint32 *)src_n; + const uint8 *src_n_ln = src_n + *(const uint32 *)src_n; src_n += 4; uint32 *dst_end = dst + bp->skip_left; @@ -296,7 +296,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, assert(!_screen_disable_anim); assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); uint32 *dst = (uint32 *)video; - uint32 *usrc = (uint32 *)src; + const uint32 *usrc = (const uint32 *)src; uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; for (; height > 0; height--) { @@ -309,7 +309,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width, dst += _screen.pitch; /* Copy back the anim-buffer */ memcpy(anim_line, usrc, width * sizeof(uint8)); - usrc = (uint32 *)((uint8 *)usrc + width); + usrc = (const uint32 *)((const uint8 *)usrc + width); anim_line += this->anim_buf_width; /* Okay, it is *very* likely that the image we stored is using @@ -336,12 +336,12 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in assert(!_screen_disable_anim); assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch); uint32 *udst = (uint32 *)dst; - uint32 *src = (uint32 *)video; - uint8 *anim_line; + const uint32 *src = (const uint32 *)video; + const uint8 *anim_line; if (this->anim_buf == NULL) return; - anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; + anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf; for (; height > 0; height--) { memcpy(udst, src, width * sizeof(uint32)); diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 0499f5712..01b3c7d6e 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -12,7 +12,7 @@ #include "../stdafx.h" #include "32bpp_base.hpp" -void *Blitter_32bppBase::MoveTo(const void *video, int x, int y) +void *Blitter_32bppBase::MoveTo(void *video, int x, int y) { return (uint32 *)video + x + y * _screen.pitch; } @@ -39,7 +39,7 @@ void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colou void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height) { uint32 *dst = (uint32 *)video; - uint32 *usrc = (uint32 *)src; + const uint32 *usrc = (const uint32 *)src; for (; height > 0; height--) { memcpy(dst, usrc, width * sizeof(uint32)); @@ -51,7 +51,7 @@ void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, int height) { uint32 *udst = (uint32 *)dst; - uint32 *src = (uint32 *)video; + const uint32 *src = (const uint32 *)video; for (; height > 0; height--) { memcpy(udst, src, width * sizeof(uint32)); @@ -63,7 +63,7 @@ void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, in void Blitter_32bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) { uint32 *udst = (uint32 *)dst; - uint32 *src = (uint32 *)video; + const uint32 *src = (const uint32 *)video; for (; height > 0; height--) { memcpy(udst, src, width * sizeof(uint32)); diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp index 1c9d331b6..ed3c24549 100644 --- a/src/blitter/32bpp_base.hpp +++ b/src/blitter/32bpp_base.hpp @@ -20,7 +20,7 @@ class Blitter_32bppBase : public Blitter { public: /* virtual */ uint8 GetScreenDepth() { return 32; } - /* virtual */ void *MoveTo(const void *video, int x, int y); + /* virtual */ void *MoveTo(void *video, int x, int y); /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour); /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour); /* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height); diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp index 91e04c02a..acbf91b0f 100644 --- a/src/blitter/32bpp_optimized.cpp +++ b/src/blitter/32bpp_optimized.cpp @@ -40,7 +40,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL /* skip upper lines in src_px and src_n */ for (uint i = bp->skip_top; i != 0; i--) { src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px); - src_n += *(uint32 *)src_n; + src_n += *(const uint32 *)src_n; } /* skip lines in dst */ @@ -58,7 +58,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL src_px++; /* next src_n line begins here */ - const uint8 *src_n_ln = src_n + *(uint32 *)src_n; + const uint8 *src_n_ln = src_n + *(const uint32 *)src_n; src_n += 4; /* we will end this line when we reach this point */ diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index 6371e3a8d..eecf63f02 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -23,7 +23,7 @@ void Blitter_8bppBase::DrawColourMappingRect(void *dst, int width, int height, P } while (--height); } -void *Blitter_8bppBase::MoveTo(const void *video, int x, int y) +void *Blitter_8bppBase::MoveTo(void *video, int x, int y) { return (uint8 *)video + x + y * _screen.pitch; } @@ -44,7 +44,7 @@ void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height) { uint8 *dst = (uint8 *)video; - uint8 *usrc = (uint8 *)src; + const uint8 *usrc = (const uint8 *)src; for (; height > 0; height--) { memcpy(dst, usrc, width * sizeof(uint8)); @@ -56,7 +56,7 @@ void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, i void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int height) { uint8 *udst = (uint8 *)dst; - uint8 *src = (uint8 *)video; + const uint8 *src = (const uint8 *)video; for (; height > 0; height--) { memcpy(udst, src, width * sizeof(uint8)); @@ -68,7 +68,7 @@ void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int void Blitter_8bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) { uint8 *udst = (uint8 *)dst; - uint8 *src = (uint8 *)video; + const uint8 *src = (const uint8 *)video; for (; height > 0; height--) { memcpy(udst, src, width * sizeof(uint8)); diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp index 03f194763..f6dbdcc09 100644 --- a/src/blitter/8bpp_base.hpp +++ b/src/blitter/8bpp_base.hpp @@ -19,7 +19,7 @@ class Blitter_8bppBase : public Blitter { public: /* virtual */ uint8 GetScreenDepth() { return 8; } /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal); - /* virtual */ void *MoveTo(const void *video, int x, int y); + /* virtual */ void *MoveTo(void *video, int x, int y); /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour); /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour); /* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height); diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp index 21d42d64c..f52f414f1 100644 --- a/src/blitter/base.hpp +++ b/src/blitter/base.hpp @@ -87,7 +87,7 @@ public: * @param y How much you want to scroll to the bottom. * @return A new destination pointer moved the the requested place. */ - virtual void *MoveTo(const void *video, int x, int y) = 0; + virtual void *MoveTo(void *video, int x, int y) = 0; /** * Draw a pixel with a given colour on the video-buffer. diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp index e9e157d72..af49d485e 100644 --- a/src/blitter/null.hpp +++ b/src/blitter/null.hpp @@ -21,7 +21,7 @@ public: /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) {}; /* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) {}; /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator); - /* virtual */ void *MoveTo(const void *video, int x, int y) { return NULL; }; + /* virtual */ void *MoveTo(void *video, int x, int y) { return NULL; }; /* virtual */ void SetPixel(void *video, int x, int y, uint8 colour) {}; /* virtual */ void DrawRect(void *video, int width, int height, uint8 colour) {}; /* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width) {}; |