From b72fcb69e2f051b572f200d23c99dc49077e160a Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Sun, 31 May 2020 01:08:44 +0800 Subject: [PATCH] driving.cc: Pass ModelDataRaw by reference (#1600) * pass ModelDataRaw by reference * pass NVGpaint by refer old-commit-hash: af36aa28abeb55a4445cbc1ff13ac55993d989d9 --- selfdrive/modeld/models/driving.cc | 4 ++-- selfdrive/modeld/models/driving.h | 4 ++-- selfdrive/ui/paint.cc | 2 +- selfdrive/ui/ui.hpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/selfdrive/modeld/models/driving.cc b/selfdrive/modeld/models/driving.cc index 817fe85662..3b14199867 100644 --- a/selfdrive/modeld/models/driving.cc +++ b/selfdrive/modeld/models/driving.cc @@ -247,7 +247,7 @@ void fill_longi(cereal::ModelData::LongitudinalData::Builder longi, const float } void model_publish(PubMaster &pm, uint32_t frame_id, - const ModelDataRaw net_outputs, uint64_t timestamp_eof) { + const ModelDataRaw &net_outputs, uint64_t timestamp_eof) { // make msg capnp::MallocMessageBuilder msg; cereal::Event::Builder event = msg.initRoot(); @@ -296,7 +296,7 @@ void model_publish(PubMaster &pm, uint32_t frame_id, } void posenet_publish(PubMaster &pm, uint32_t frame_id, - const ModelDataRaw net_outputs, uint64_t timestamp_eof) { + const ModelDataRaw &net_outputs, uint64_t timestamp_eof) { capnp::MallocMessageBuilder msg; cereal::Event::Builder event = msg.initRoot(); event.setLogMonoTime(nanos_since_boot()); diff --git a/selfdrive/modeld/models/driving.h b/selfdrive/modeld/models/driving.h index a852db4022..223a540b37 100644 --- a/selfdrive/modeld/models/driving.h +++ b/selfdrive/modeld/models/driving.h @@ -72,7 +72,7 @@ void model_free(ModelState* s); void poly_fit(float *in_pts, float *in_stds, float *out); void model_publish(PubMaster &pm, uint32_t frame_id, - const ModelDataRaw data, uint64_t timestamp_eof); + const ModelDataRaw &data, uint64_t timestamp_eof); void posenet_publish(PubMaster &pm, uint32_t frame_id, - const ModelDataRaw data, uint64_t timestamp_eof); + const ModelDataRaw &data, uint64_t timestamp_eof); #endif diff --git a/selfdrive/ui/paint.cc b/selfdrive/ui/paint.cc index b1d2133bf5..8e40314e3d 100644 --- a/selfdrive/ui/paint.cc +++ b/selfdrive/ui/paint.cc @@ -791,7 +791,7 @@ void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGcolor c } } -void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGpaint paint, float r){ +void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGpaint &paint, float r){ nvgBeginPath(vg); r > 0? nvgRoundedRect(vg, x, y, w, h, r) : nvgRect(vg, x, y, w, h); nvgFillPaint(vg, paint); diff --git a/selfdrive/ui/ui.hpp b/selfdrive/ui/ui.hpp index 3cab8ee668..25215fe08b 100644 --- a/selfdrive/ui/ui.hpp +++ b/selfdrive/ui/ui.hpp @@ -292,7 +292,7 @@ void ui_draw(UIState *s); void ui_draw_sidebar(UIState *s); void ui_draw_image(NVGcontext *vg, float x, float y, float w, float h, int image, float alpha); void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGcolor color, float r = 0, int width = 0); -void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGpaint paint, float r = 0); +void ui_draw_rect(NVGcontext *vg, float x, float y, float w, float h, NVGpaint &paint, float r = 0); void ui_nvg_init(UIState *s); #endif