mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 19:33:49 +08:00
convert framebuffer to class (#19800)
* class FrameBuffer * fix build error * remove bootlog
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "framebuffer.h"
|
||||
#include "util.h"
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include <ui/DisplayInfo.h>
|
||||
@@ -32,7 +32,7 @@ struct FramebufferState {
|
||||
EGLContext context;
|
||||
};
|
||||
|
||||
void framebuffer_swap(FramebufferState *s) {
|
||||
void FrameBuffer::swap() {
|
||||
eglSwapBuffers(s->display, s->surface);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
@@ -43,17 +43,15 @@ bool set_brightness(int brightness) {
|
||||
return 0 == write_file("/sys/class/leds/lcd-backlight/brightness", bright, strlen(bright));
|
||||
}
|
||||
|
||||
void framebuffer_set_power(FramebufferState *s, int mode) {
|
||||
void FrameBuffer::set_power(int mode) {
|
||||
SurfaceComposerClient::setDisplayPowerMode(s->dtoken, mode);
|
||||
}
|
||||
|
||||
FramebufferState* framebuffer_init(
|
||||
const char* name, int32_t layer, int alpha,
|
||||
int *out_w, int *out_h) {
|
||||
FrameBuffer::FrameBuffer(const char *name, uint32_t layer, int alpha, int *out_w, int *out_h) {
|
||||
status_t status;
|
||||
int success;
|
||||
|
||||
FramebufferState *s = new FramebufferState;
|
||||
s = new FramebufferState;
|
||||
|
||||
s->session = new SurfaceComposerClient();
|
||||
assert(s->session != NULL);
|
||||
@@ -141,6 +139,11 @@ FramebufferState* framebuffer_init(
|
||||
|
||||
if (out_w) *out_w = w;
|
||||
if (out_h) *out_h = h;
|
||||
}
|
||||
|
||||
return s;
|
||||
FrameBuffer::~FrameBuffer() {
|
||||
eglDestroyContext(s->display, s->context);
|
||||
eglDestroySurface(s->display, s->surface);
|
||||
eglTerminate(s->display);
|
||||
delete s;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user