From 464da09474ddadd09076ba34d784b0a252dd5961 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 20 May 2013 17:28:38 -0400 Subject: [PATCH] compilation fixes --- include/mitsuba/core/bitmap.h | 2 +- src/libcore/bitmap.cpp | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/mitsuba/core/bitmap.h b/include/mitsuba/core/bitmap.h index 7856ca58..68f96aeb 100644 --- a/include/mitsuba/core/bitmap.h +++ b/include/mitsuba/core/bitmap.h @@ -700,7 +700,7 @@ public: void flipVertically(); /// Perform the specified rotatation & flip operation - void rotateFlip(ERotateFlipType type) const; + ref rotateFlip(ERotateFlipType type) const; /** * \brief Accumulate the contents of another bitmap into the diff --git a/src/libcore/bitmap.cpp b/src/libcore/bitmap.cpp index e269d91b..83053eae 100644 --- a/src/libcore/bitmap.cpp +++ b/src/libcore/bitmap.cpp @@ -427,8 +427,7 @@ ref Bitmap::rotateFlip(ERotateFlipType type) const { if (m_componentFormat == EBitmask) Log(EError, "Transformations involving bitmasks are currently not supported!"); - int width = m_width, height = m_height; - int bypp = getBytesPerPixel(); + int width = m_size.x, height = m_size.y; bool flip_x = (type & 6) == 2 || (type & 6) == 4; bool flip_y = (type & 3) == 1 || (type & 3) == 2; bool rotate_90 = type & 1; @@ -436,21 +435,23 @@ ref Bitmap::rotateFlip(ERotateFlipType type) const { if (rotate_90) std::swap(width, height); - ref result = new Bitmap(width, height); + ref result = new Bitmap(m_pixelFormat, m_componentFormat, + Vector2i(width, height), m_channelCount); - int src_stride = m_width * bypp, - dst_stride = width * bypp; + ssize_t bypp = getBytesPerPixel(), + src_stride = m_size.x * bypp, + dst_stride = width * bypp; uint8_t *dst = result->getUInt8Data(); + uint8_t *dst_row = dst, *src_row = m_data; - uint8_t *dst_row = dst, *src_row = src; if (flip_x) - src_row += bypp * (m_width - 1); + src_row += bypp * (m_size.x - 1); if (flip_y) - src_row += src_stride * (m_height - 1); + src_row += src_stride * (m_size.y - 1); - int src_x_step, src_y_step; + ssize_t src_x_step, src_y_step; if (rotate_90) { src_x_step = flip_y ? -src_stride : src_stride; src_y_step = flip_x ? -bypp : bypp; @@ -459,11 +460,11 @@ ref Bitmap::rotateFlip(ERotateFlipType type) const { src_y_step = flip_y ? -src_stride : src_stride; } - for (size_t y=0; y Bitmap::rotateFlip(ERotateFlipType type) const { src_row += src_y_step; dst_row += dst_stride; } -} + return result; +} void Bitmap::accumulate(const Bitmap *bitmap, Point2i sourceOffset, Point2i targetOffset, Vector2i size) {