fix HeadlessView::readPixels return value, ref #480
This commit is contained in:
@@ -97,17 +97,17 @@ void HeadlessView::resize(uint16_t width, uint16_t height, float pixelRatio) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const std::unique_ptr<uint32_t[]>* HeadlessView::readPixels() {
|
||||
const std::unique_ptr<uint32_t[]> HeadlessView::readPixels() {
|
||||
const unsigned int w = width_ * pixelRatio_;
|
||||
const unsigned int h = height_ * pixelRatio_;
|
||||
|
||||
const std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
|
||||
std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
|
||||
|
||||
make_active();
|
||||
glReadPixels(0, 0, width_, height_, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
|
||||
make_inactive();
|
||||
|
||||
return &pixels;
|
||||
return pixels;
|
||||
}
|
||||
|
||||
void HeadlessView::clear_buffers() {
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
void createContext();
|
||||
|
||||
void resize(uint16_t width, uint16_t height, float pixelRatio);
|
||||
const std::unique_ptr<uint32_t[]>* readPixels();
|
||||
const std::unique_ptr<uint32_t[]> readPixels();
|
||||
|
||||
void notify_map_change(MapChange change, timestamp delay = 0);
|
||||
void make_active();
|
||||
|
||||
@@ -98,7 +98,7 @@ TEST_P(HeadlessTest, render) {
|
||||
const unsigned int w = width * pixelRatio;
|
||||
const unsigned int h = height * pixelRatio;
|
||||
|
||||
const std::string image = util::compress_png(w, h, view.readPixels()->get(), true);
|
||||
const std::string image = util::compress_png(w, h, view.readPixels().get(), true);
|
||||
util::write_file(actual_image, image);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user