buffer.h: use stride_ instead of stride()

Change-Id: Ib51231349bf0ff3e23672762dc7bfa49b5fe4083
This commit is contained in:
Johann 2017-06-30 07:37:20 -07:00
parent ce5b17f9ad
commit c2044fda1d

View File

@ -149,7 +149,7 @@ class Buffer {
template <typename T> template <typename T>
T *Buffer<T>::TopLeftPixel() const { T *Buffer<T>::TopLeftPixel() const {
if (!raw_buffer_) return NULL; if (!raw_buffer_) return NULL;
return raw_buffer_ + (top_padding_ * stride()) + left_padding_; return raw_buffer_ + (top_padding_ * stride_) + left_padding_;
} }
template <typename T> template <typename T>
@ -160,7 +160,7 @@ void Buffer<T>::Set(const T value) {
for (int width = 0; width < width_; ++width) { for (int width = 0; width < width_; ++width) {
src[width] = value; src[width] = value;
} }
src += stride(); src += stride_;
} }
} }
@ -172,7 +172,7 @@ void Buffer<T>::Set(ACMRandom *rand_class, T (ACMRandom::*rand_func)()) {
for (int width = 0; width < width_; ++width) { for (int width = 0; width < width_; ++width) {
src[width] = (*rand_class.*rand_func)(); src[width] = (*rand_class.*rand_func)();
} }
src += stride(); src += stride_;
} }
} }
@ -215,8 +215,8 @@ void Buffer<T>::DumpBuffer() const {
if (!raw_buffer_) return; if (!raw_buffer_) return;
for (int height = 0; height < height_ + top_padding_ + bottom_padding_; for (int height = 0; height < height_ + top_padding_ + bottom_padding_;
++height) { ++height) {
for (int width = 0; width < stride(); ++width) { for (int width = 0; width < stride_; ++width) {
printf("%4d", raw_buffer_[height + width * stride()]); printf("%4d", raw_buffer_[height + width * stride_]);
} }
printf("\n"); printf("\n");
} }
@ -289,7 +289,7 @@ bool Buffer<T>::CheckValues(const T value) const {
return false; return false;
} }
} }
src += stride(); src += stride_;
} }
return true; return true;
} }
@ -301,7 +301,7 @@ bool Buffer<T>::CheckPadding() const {
// Top padding. // Top padding.
T const *top = raw_buffer_; T const *top = raw_buffer_;
for (int i = 0; i < stride() * top_padding_; ++i) { for (int i = 0; i < stride_ * top_padding_; ++i) {
if (padding_value_ != top[i]) { if (padding_value_ != top[i]) {
return false; return false;
} }
@ -315,7 +315,7 @@ bool Buffer<T>::CheckPadding() const {
return false; return false;
} }
} }
left += stride(); left += stride_;
} }
// Right padding. // Right padding.
@ -326,12 +326,12 @@ bool Buffer<T>::CheckPadding() const {
return false; return false;
} }
} }
right += stride(); right += stride_;
} }
// Bottom padding // Bottom padding
T const *bottom = raw_buffer_ + (top_padding_ + height_) * stride(); T const *bottom = raw_buffer_ + (top_padding_ + height_) * stride_;
for (int i = 0; i < stride() * bottom_padding_; ++i) { for (int i = 0; i < stride_ * bottom_padding_; ++i) {
if (padding_value_ != bottom[i]) { if (padding_value_ != bottom[i]) {
return false; return false;
} }