* Allocate a buffer. * @param width Width of the matrix. * @param height Height of the matrix. * @param external_buffer If not \c null, use the provided buffer, else make a new one. */
| 75 | * @param external_buffer If not \c null, use the provided buffer, else make a new one. |
| 76 | */ |
| 77 | void allocate(int width, int height, unsigned char *external_buffer = 0) |
| 78 | { |
| 79 | this->width_ = width; |
| 80 | this->height_ = height; |
| 81 | x_step = sizeof(ScalarT); |
| 82 | y_step = width * x_step; |
| 83 | |
| 84 | owns_buffer = external_buffer == 0; |
| 85 | |
| 86 | if(owns_buffer) |
| 87 | { |
| 88 | buffer_ = new unsigned char[y_step * height]; |
| 89 | } |
| 90 | else |
| 91 | { |
| 92 | buffer_ = external_buffer; |
| 93 | } |
| 94 | buffer_end_ = buffer_ + (y_step * height); |
| 95 | } |
| 96 | |
| 97 | void deallocate() |
| 98 | { |
nothing calls this directly
no outgoing calls
no test coverage detected