Skip to content

Commit

Permalink
style: IndentCaseLabels
Browse files Browse the repository at this point in the history
Former-commit-id: 8f50d6b [formerly 2bf4d1a]
Former-commit-id: eb87883
  • Loading branch information
ronag committed Feb 4, 2018
1 parent 77c5b48 commit 699823c
Show file tree
Hide file tree
Showing 36 changed files with 2,341 additions and 2,133 deletions.
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ IncludeCategories:
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
Expand Down
110 changes: 55 additions & 55 deletions accelerator/cpu/image/image_mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,62 +294,62 @@ struct image_mixer::impl : boost::noncopyable
}

switch (pix_desc.format) {
case core::pixel_format::abgr:
in_frame->format = AV_PIX_FMT_ABGR;
break;
case core::pixel_format::bgra:
in_frame->format = AV_PIX_FMT_BGRA;
break;
case core::pixel_format::rgba:
in_frame->format = AV_PIX_FMT_RGBA;
break;
case core::pixel_format::argb:
in_frame->format = AV_PIX_FMT_ARGB;
break;
case core::pixel_format::ycbcr: {
int y_w = pix_desc.planes[0].width;
int y_h = pix_desc.planes[0].height;
int c_w = pix_desc.planes[1].width;
int c_h = pix_desc.planes[1].height;

if (c_h == y_h && c_w == y_w)
in_frame->format = AV_PIX_FMT_YUV444P;
else if (c_h == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUV422P;
else if (c_h == y_h && c_w * 4 == y_w)
in_frame->format = AV_PIX_FMT_YUV411P;
else if (c_h * 2 == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUV420P;
else if (c_h * 2 == y_h && c_w * 4 == y_w)
in_frame->format = AV_PIX_FMT_YUV410P;
else
return;

break;
}
case core::pixel_format::ycbcra: {
int y_w = pix_desc.planes[0].width;
int y_h = pix_desc.planes[0].height;
int c_w = pix_desc.planes[1].width;
int c_h = pix_desc.planes[1].height;

if (c_h == y_h && c_w == y_w)
in_frame->format = AV_PIX_FMT_YUVA444P;
else if (c_h == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUVA422P;
else if (c_h == y_h && c_w * 4 == y_w)
return;
else if (c_h * 2 == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUVA420P;
else if (c_h * 2 == y_h && c_w * 4 == y_w)
return;
else
case core::pixel_format::abgr:
in_frame->format = AV_PIX_FMT_ABGR;
break;
case core::pixel_format::bgra:
in_frame->format = AV_PIX_FMT_BGRA;
break;
case core::pixel_format::rgba:
in_frame->format = AV_PIX_FMT_RGBA;
break;
case core::pixel_format::argb:
in_frame->format = AV_PIX_FMT_ARGB;
break;
case core::pixel_format::ycbcr: {
int y_w = pix_desc.planes[0].width;
int y_h = pix_desc.planes[0].height;
int c_w = pix_desc.planes[1].width;
int c_h = pix_desc.planes[1].height;

if (c_h == y_h && c_w == y_w)
in_frame->format = AV_PIX_FMT_YUV444P;
else if (c_h == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUV422P;
else if (c_h == y_h && c_w * 4 == y_w)
in_frame->format = AV_PIX_FMT_YUV411P;
else if (c_h * 2 == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUV420P;
else if (c_h * 2 == y_h && c_w * 4 == y_w)
in_frame->format = AV_PIX_FMT_YUV410P;
else
return;

break;
}
case core::pixel_format::ycbcra: {
int y_w = pix_desc.planes[0].width;
int y_h = pix_desc.planes[0].height;
int c_w = pix_desc.planes[1].width;
int c_h = pix_desc.planes[1].height;

if (c_h == y_h && c_w == y_w)
in_frame->format = AV_PIX_FMT_YUVA444P;
else if (c_h == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUVA422P;
else if (c_h == y_h && c_w * 4 == y_w)
return;
else if (c_h * 2 == y_h && c_w * 2 == y_w)
in_frame->format = AV_PIX_FMT_YUVA420P;
else if (c_h * 2 == y_h && c_w * 4 == y_w)
return;
else
return;

break;
}
default:
return;

break;
}
default:
return;
}

in_frame->width = pix_desc.planes[0].width;
Expand Down
82 changes: 41 additions & 41 deletions accelerator/ogl/image/image_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ struct image_kernel::impl
GL(glEnable(GL_BLEND));

switch (params.keyer) {
case keyer::additive:
GL(glBlendFunc(GL_ONE, GL_ONE));
break;
case keyer::linear:
GL(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
break;
case keyer::additive:
GL(glBlendFunc(GL_ONE, GL_ONE));
break;
case keyer::linear:
GL(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
break;
}
} else {
params.background->bind(static_cast<int>(texture_id::background));
Expand Down Expand Up @@ -390,43 +390,43 @@ struct image_kernel::impl

// Draw
switch (params.geometry.type()) {
case core::frame_geometry::geometry_type::quad:
case core::frame_geometry::geometry_type::quad_list: {
glClientActiveTexture(GL_TEXTURE0);

glDisableClientState(GL_EDGE_FLAG_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_INDEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);

auto stride = static_cast<GLsizei>(sizeof(core::frame_geometry::coord));
auto vertex_coord_member = &core::frame_geometry::coord::vertex_x;
auto texture_coord_member = &core::frame_geometry::coord::texture_x;
auto data_ptr = coords.data();
auto vertex_coord_ptr = &(data_ptr->*vertex_coord_member);
auto texture_coord_ptr = &(data_ptr->*texture_coord_member);

glVertexPointer(2, GL_DOUBLE, stride, vertex_coord_ptr);
glTexCoordPointer(4, GL_DOUBLE, stride, texture_coord_ptr);

if (params.blend_mode == core::blend_mode::normal) {
glDrawArrays(GL_QUADS, 0, static_cast<GLsizei>(coords.size()));
} else {
for (auto i = 0; i < coords.size(); i += 4) {
glTextureBarrier();
glDrawArrays(GL_QUADS, i, 4);
case core::frame_geometry::geometry_type::quad:
case core::frame_geometry::geometry_type::quad_list: {
glClientActiveTexture(GL_TEXTURE0);

glDisableClientState(GL_EDGE_FLAG_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_INDEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);

auto stride = static_cast<GLsizei>(sizeof(core::frame_geometry::coord));
auto vertex_coord_member = &core::frame_geometry::coord::vertex_x;
auto texture_coord_member = &core::frame_geometry::coord::texture_x;
auto data_ptr = coords.data();
auto vertex_coord_ptr = &(data_ptr->*vertex_coord_member);
auto texture_coord_ptr = &(data_ptr->*texture_coord_member);

glVertexPointer(2, GL_DOUBLE, stride, vertex_coord_ptr);
glTexCoordPointer(4, GL_DOUBLE, stride, texture_coord_ptr);

if (params.blend_mode == core::blend_mode::normal) {
glDrawArrays(GL_QUADS, 0, static_cast<GLsizei>(coords.size()));
} else {
for (auto i = 0; i < coords.size(); i += 4) {
glTextureBarrier();
glDrawArrays(GL_QUADS, i, 4);
}
}
}

glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
break;
}
default:
break;
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
break;
}
default:
break;
}

// Cleanup
Expand Down
37 changes: 19 additions & 18 deletions common/gl/gl_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,31 @@ void SMFL_GLCheckError(const std::string&, const char* func, const char* file, u
if (LastErrorCode != GL_NO_ERROR) {
// Decode the error code
switch (LastErrorCode) {
case GL_INVALID_ENUM:
CASPAR_THROW_EXCEPTION(ogl_invalid_enum() << msg_info("an unacceptable value has been specified for an enumerated argument")
<< error_info("GL_INVALID_ENUM"));
case GL_INVALID_ENUM:
CASPAR_THROW_EXCEPTION(ogl_invalid_enum()
<< msg_info("an unacceptable value has been specified for an enumerated argument") << error_info("GL_INVALID_ENUM"));

case GL_INVALID_VALUE:
CASPAR_THROW_EXCEPTION(ogl_invalid_value() << msg_info("a numeric argument is out of range") << error_info("GL_INVALID_VALUE"));
case GL_INVALID_VALUE:
CASPAR_THROW_EXCEPTION(ogl_invalid_value() << msg_info("a numeric argument is out of range") << error_info("GL_INVALID_VALUE"));

case GL_INVALID_OPERATION:
CASPAR_THROW_EXCEPTION(ogl_invalid_operation()
<< msg_info("the specified operation is not allowed in the current state") << error_info("GL_INVALID_OPERATION"));
case GL_INVALID_OPERATION:
CASPAR_THROW_EXCEPTION(ogl_invalid_operation()
<< msg_info("the specified operation is not allowed in the current state") << error_info("GL_INVALID_OPERATION"));

case GL_STACK_OVERFLOW:
CASPAR_THROW_EXCEPTION(ogl_stack_overflow() << msg_info("this command would cause a stack overflow") << error_info("GL_STACK_OVERFLOW"));
case GL_STACK_OVERFLOW:
CASPAR_THROW_EXCEPTION(ogl_stack_overflow() << msg_info("this command would cause a stack overflow") << error_info("GL_STACK_OVERFLOW"));

case GL_STACK_UNDERFLOW:
CASPAR_THROW_EXCEPTION(ogl_stack_underflow() << msg_info("this command would cause a stack underflow") << error_info("GL_STACK_UNDERFLOW"));
case GL_STACK_UNDERFLOW:
CASPAR_THROW_EXCEPTION(ogl_stack_underflow() << msg_info("this command would cause a stack underflow") << error_info("GL_STACK_UNDERFLOW"));

case GL_OUT_OF_MEMORY:
CASPAR_THROW_EXCEPTION(ogl_out_of_memory() << msg_info("there is not enough memory left to execute the command") << error_info("GL_OUT_OF_MEMORY"));
case GL_OUT_OF_MEMORY:
CASPAR_THROW_EXCEPTION(ogl_out_of_memory()
<< msg_info("there is not enough memory left to execute the command") << error_info("GL_OUT_OF_MEMORY"));

case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
CASPAR_THROW_EXCEPTION(ogl_invalid_framebuffer_operation_ext()
<< msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
<< error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT"));
case GL_INVALID_FRAMEBUFFER_OPERATION_EXT:
CASPAR_THROW_EXCEPTION(ogl_invalid_framebuffer_operation_ext()
<< msg_info("the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"")
<< error_info("GL_INVALID_FRAMEBUFFER_OPERATION_EXT"));
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions core/diagnostics/graph_to_log_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class graph_to_log_sink : public caspar::diagnostics::spi::graph_sink
std::lock_guard<std::mutex> lock(mutex_);

switch (severity) {
case caspar::diagnostics::tag_severity::INFO:
CASPAR_LOG(trace) << L"[diagnostics] [" << text_ << L"] " << name << L" " << context_;
break;
case caspar::diagnostics::tag_severity::WARNING:
CASPAR_LOG(debug) << L"[diagnostics] [" << text_ << L"] " << name << L" " << context_;
break;
case caspar::diagnostics::tag_severity::INFO:
CASPAR_LOG(trace) << L"[diagnostics] [" << text_ << L"] " << name << L" " << context_;
break;
case caspar::diagnostics::tag_severity::WARNING:
CASPAR_LOG(debug) << L"[diagnostics] [" << text_ << L"] " << name << L" " << context_;
break;
}
}

Expand Down
50 changes: 25 additions & 25 deletions core/diagnostics/osd_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,32 +152,32 @@ class context : public drawable
sf::Event e;
while (window_->pollEvent(e)) {
switch (e.type) {
case sf::Event::Closed:
window_.reset();
return;
case sf::Event::Resized:
calculate_view_ = true;
break;
case sf::Event::MouseButtonPressed:
dragging_ = true;
last_mouse_y_ = e.mouseButton.y;
break;
case sf::Event::MouseButtonReleased:
dragging_ = false;
break;
case sf::Event::MouseMoved:
if (dragging_) {
auto delta_y = e.mouseMove.y - last_mouse_y_;
scroll_position_ += delta_y;
last_mouse_y_ = e.mouseMove.y;
case sf::Event::Closed:
window_.reset();
return;
case sf::Event::Resized:
calculate_view_ = true;
}

break;
case sf::Event::MouseWheelMoved:
scroll_position_ += e.mouseWheel.delta * 15;
calculate_view_ = true;
break;
break;
case sf::Event::MouseButtonPressed:
dragging_ = true;
last_mouse_y_ = e.mouseButton.y;
break;
case sf::Event::MouseButtonReleased:
dragging_ = false;
break;
case sf::Event::MouseMoved:
if (dragging_) {
auto delta_y = e.mouseMove.y - last_mouse_y_;
scroll_position_ += delta_y;
last_mouse_y_ = e.mouseMove.y;
calculate_view_ = true;
}

break;
case sf::Event::MouseWheelMoved:
scroll_position_ += e.mouseWheel.delta * 15;
calculate_view_ = true;
break;
}
}

Expand Down
12 changes: 6 additions & 6 deletions core/diagnostics/subject_diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ class subject_graph : public caspar::diagnostics::spi::graph_sink
std::string severity_path;

switch (severity) {
case caspar::diagnostics::tag_severity::INFO:
severity_path = "info/";
break;
case caspar::diagnostics::tag_severity::WARNING:
severity_path = "warning/";
break;
case caspar::diagnostics::tag_severity::INFO:
severity_path = "info/";
break;
case caspar::diagnostics::tag_severity::WARNING:
severity_path = "warning/";
break;
}

*subject_ << monitor::message("/tag/" + severity_path + name);
Expand Down
Loading

0 comments on commit 699823c

Please sign in to comment.