-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for cimbar.js, cimbar_send #75
Changes from all commits
b392e57
1b09a77
98368d7
20f1601
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */ | ||
#include "cimbar_js.h" | ||
|
||
#include "cimb_translator/Config.h" | ||
#include "encoder/SimpleEncoder.h" | ||
#include "gui/window_glfw.h" | ||
#include "util/byte_istream.h" | ||
|
@@ -18,9 +19,9 @@ namespace { | |
uint8_t _encodeId = 0; | ||
|
||
// settings | ||
unsigned _ecc = 30; | ||
unsigned _colorBits = 2; | ||
int _compressionLevel = 6; | ||
unsigned _ecc = cimbar::Config::ecc_bytes(); | ||
unsigned _colorBits = cimbar::Config::color_bits(); | ||
int _compressionLevel = cimbar::Config::compression_level(); | ||
} | ||
|
||
extern "C" { | ||
|
@@ -30,6 +31,11 @@ int initialize_GL(int width, int height) | |
if (_window) | ||
return 1; | ||
|
||
// must be divisible by 4??? | ||
if (width % 4 != 0) | ||
width += (4 - width % 4); | ||
if (height % 4 != 0) | ||
height += (4 - height % 4); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll admit I don't understand this at all. Some opengl nonsense, I think. |
||
std::cerr << "initializing " << width << " by " << height << " window"; | ||
|
||
_window = std::make_shared<cimbar::window_glfw>(width, height, "Cimbar Encoder"); | ||
|
@@ -105,11 +111,11 @@ int configure(unsigned color_bits, unsigned ecc, int compression) | |
{ | ||
// defaults | ||
if (color_bits > 3) | ||
color_bits = 2; | ||
color_bits = cimbar::Config::color_bits(); | ||
if (ecc < 0 or ecc >= 150) | ||
ecc = 30; | ||
ecc = cimbar::Config::ecc_bytes(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honor config defaults. |
||
if (compression < 0 or compression > 22) | ||
compression = 6; | ||
compression = cimbar::Config::compression_level(); | ||
|
||
// check if we need to refresh the stream | ||
bool refresh = (color_bits != _colorBits or ecc != _ecc or compression != _compressionLevel); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ return { | |
|
||
setColorBits : function(color_bits) | ||
{ | ||
Module._configure(color_bits, 30, 6); | ||
Module._configure(color_bits, 255, 255); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use config defaults. |
||
|
||
var nav = document.getElementById("nav-container"); | ||
if (color_bits == 2) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Staying on
latest
isn't just tempting fate: it's already changed/broken in the past month.