diff --git a/renderer/HardwareBaseGPU.cpp b/renderer/HardwareBaseGPU.cpp index 812f5955a..fda7d4075 100644 --- a/renderer/HardwareBaseGPU.cpp +++ b/renderer/HardwareBaseGPU.cpp @@ -284,25 +284,12 @@ void rend_DrawChunkedBitmap(chunked_bitmap *chunk, int x, int y, uint8_t alpha) int piece_w = bm_w(bm_array[0], 0); int piece_h = bm_h(bm_array[0], 0); int screen_w, screen_h; - int i, t; rend_SetZBufferState(0); rend_GetProjectionParameters(&screen_w, &screen_h); - for (i = 0; i < h; i++) { - for (t = 0; t < w; t++) { + for (int i = 0; i < h; i++) { + for (int t = 0; t < w; t++) { int dx = x + (piece_w * t); int dy = y + (piece_h * i); - int dw, dh; - if ((dx + piece_w) > screen_w) - dw = piece_w - ((dx + piece_w) - screen_w); - else - dw = piece_w; - if ((dy + piece_h) > screen_h) - dh = piece_h - ((dy + piece_h) - screen_h); - else - dh = piece_h; - - float u2 = (float)dw / (float)piece_w; - float v2 = (float)dh / (float)piece_h; rend_DrawSimpleBitmap(bm_array[i * w + t], dx, dy); } } diff --git a/renderer/HardwareOpenGL.cpp b/renderer/HardwareOpenGL.cpp index fac46c4eb..0fbff8f45 100644 --- a/renderer/HardwareOpenGL.cpp +++ b/renderer/HardwareOpenGL.cpp @@ -268,9 +268,9 @@ int opengl_MakeTextureObject(int tn) { int opengl_InitCache() { - OpenGL_bitmap_remap = (uint16_t *)mem_malloc(MAX_BITMAPS * 2); + OpenGL_bitmap_remap = mem_rmalloc(MAX_BITMAPS); ASSERT(OpenGL_bitmap_remap); - OpenGL_lightmap_remap = (uint16_t *)mem_malloc(MAX_LIGHTMAPS * 2); + OpenGL_lightmap_remap = mem_rmalloc(MAX_LIGHTMAPS); ASSERT(OpenGL_lightmap_remap); OpenGL_bitmap_states = mem_rmalloc(MAX_BITMAPS); @@ -573,9 +573,9 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { opengl_InitCache(); if (OpenGL_packed_pixels) { - opengl_packed_Upload_data = (uint16_t *)mem_malloc(2048 * 2048 * 2); - opengl_packed_Translate_table = (uint16_t *)mem_malloc(65536 * 2); - opengl_packed_4444_translate_table = (uint16_t *)mem_malloc(65536 * 2); + opengl_packed_Upload_data = mem_rmalloc(2048 * 2048); + opengl_packed_Translate_table = mem_rmalloc(65536); + opengl_packed_4444_translate_table = mem_rmalloc(65536); ASSERT(opengl_packed_Upload_data); ASSERT(opengl_packed_Translate_table); @@ -620,9 +620,9 @@ int opengl_Init(oeApplication *app, renderer_preferred_state *pref_state) { opengl_packed_4444_translate_table[i] = INTEL_INT(pix); } } else { - opengl_Upload_data = (uint32_t *)mem_malloc(2048 * 2048 * 4); - opengl_Translate_table = (uint32_t *)mem_malloc(65536 * 4); - opengl_4444_translate_table = (uint32_t *)mem_malloc(65536 * 4); + opengl_Upload_data = mem_rmalloc(2048 * 2048); + opengl_Translate_table = mem_rmalloc(65536); + opengl_4444_translate_table = mem_rmalloc(65536); ASSERT(opengl_Upload_data); ASSERT(opengl_Translate_table); @@ -1683,10 +1683,6 @@ void rend_DrawSpecialLine(g3Point *p0, g3Point *p1) { // Takes a screenshot of the current frame and puts it into the handle passed std::unique_ptr rend_Screenshot() { - uint16_t *dest_data; - uint32_t *temp_data; - - int total = gpu_state.screen_width * gpu_state.screen_height; auto result = std::make_unique(gpu_state.screen_width, gpu_state.screen_height, PixelDataFormat::RGBA32, true); if (!result || result->getData() == nullptr) { @@ -1712,8 +1708,8 @@ void rend_Screenshot(int bm_handle) { uint16_t* dest_data = bm_data(bm_handle, 0); - for (int i = 0; i < h; i++) { - for (int t = 0; t < w; t++) { + for (std::size_t i = 0; i < h; i++) { + for (std::size_t t = 0; t < w; t++) { uint32_t spix = temp_data[i * w + t]; int r = spix & 0xff; diff --git a/renderer/ShaderProgram.h b/renderer/ShaderProgram.h index 90ce5acb1..3bdb52293 100644 --- a/renderer/ShaderProgram.h +++ b/renderer/ShaderProgram.h @@ -67,7 +67,7 @@ struct VertexBuffer { initialData, bufferType); - for (GLint i{}; i < attribs.size(); i++) { + for (std::size_t i{}; i < attribs.size(); i++) { dglEnableVertexAttribArray(i); dglVertexAttribPointer(i, attribs[i].size,