Do a memset for padding.
This commit is contained in:
parent
237ed00689
commit
723cd88d56
2
Makefile
2
Makefile
|
@ -9,7 +9,7 @@ SRC = rotation.cpp \
|
|||
HEADERS = image.h \
|
||||
pnm.h
|
||||
OBJS = $(patsubst %.cpp,%.o,$(SRC))
|
||||
IMG = img/lena_64.pgm
|
||||
IMG = img/lena_1024.pgm
|
||||
|
||||
all: $(OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(LFLAGS) $(OBJS) -o $(BUILD_DIR)/rotation
|
||||
|
|
18
rotation.cpp
18
rotation.cpp
|
@ -600,12 +600,9 @@ Image* rotate(Image const& src, double angle)
|
|||
}
|
||||
|
||||
// Left padding
|
||||
for (int x = 0; x < left_padding; ++x, ++buffer_index)
|
||||
{
|
||||
// Set to black value
|
||||
// TODO: memset
|
||||
buffer[buffer_index] = 50;
|
||||
}
|
||||
// TODO: set to background value
|
||||
memset(buffer + buffer_index, 50, left_padding * sizeof (pvalue_t));
|
||||
buffer_index += left_padding;
|
||||
|
||||
// Border
|
||||
for (int x = 0; x < left_border; ++x, ++buffer_index)
|
||||
|
@ -654,12 +651,9 @@ Image* rotate(Image const& src, double angle)
|
|||
}
|
||||
|
||||
// Right padding
|
||||
for (int x = 0; x < right_padding; ++x, ++buffer_index)
|
||||
{
|
||||
// Set to black value
|
||||
// TODO: memset
|
||||
buffer[buffer_index] = 100;
|
||||
}
|
||||
// TODO: set to background value
|
||||
memset(buffer + buffer_index, 100, right_padding * sizeof (pvalue_t));
|
||||
buffer_index += right_padding;
|
||||
|
||||
src_rotated_origin += qdy;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue