Don't scale cat larger than it is
Some checks failed
Build / build-gentoo (push) Failing after 15s
Build / download-system-deps (push) Successful in 4m34s
Build / get-source-code (push) Successful in 14m59s
Build / build-deb (push) Failing after 5m15s
Build / build-appimage (push) Successful in 4m41s
Build / build-android (push) Failing after 3m15s
Build / build-windows (push) Failing after 7m50s
Some checks failed
Build / build-gentoo (push) Failing after 15s
Build / download-system-deps (push) Successful in 4m34s
Build / get-source-code (push) Successful in 14m59s
Build / build-deb (push) Failing after 5m15s
Build / build-appimage (push) Successful in 4m41s
Build / build-android (push) Failing after 3m15s
Build / build-windows (push) Failing after 7m50s
This commit is contained in:
parent
c1fe6cae2b
commit
a53b2498cb
3 changed files with 23 additions and 3 deletions
|
@ -41,6 +41,8 @@ void LImageView::Draw(BRect updateRect) {
|
|||
mh = Bounds().Height();
|
||||
float wr = ((float)mw) / ((float)bw);
|
||||
float hr = ((float)mh) / ((float)bh);
|
||||
if (wr > 1.0f) wr = 1.0f;
|
||||
if (hr > 1.0f) hr = 1.0f;
|
||||
if (wr < hr) {
|
||||
iw *= wr;
|
||||
ih *= wr;
|
||||
|
|
|
@ -286,10 +286,12 @@ void MainLoop::GuiFunction() {
|
|||
int cw, ch;
|
||||
SDL_QueryTexture(cat, NULL, NULL, &cw, &ch);
|
||||
float aspect = ((float)cw) / ((float)ch);
|
||||
float x_size = y_pos * aspect;
|
||||
float y_size = std::min(y_pos, (float)ch);
|
||||
float x_size = y_size * aspect;
|
||||
float x_pos = ImGui::GetWindowWidth() - ImGui::GetStyle().WindowPadding.x - x_size;
|
||||
ImGui::SetCursorPosX(x_pos);
|
||||
ImGui::Image((ImTextureID)cat, ImVec2(x_size, y_pos));
|
||||
ImGui::SetCursorPosY(y_pos - y_size);
|
||||
ImGui::Image((ImTextureID)cat, ImVec2(x_size, y_size));
|
||||
}
|
||||
float centerSpace = ImGui::GetWindowHeight() - ImGui::GetFrameHeightWithSpacing() - ImGui::GetFrameHeight() - ImGui::GetStyle().WindowPadding.y;
|
||||
if (streams.size() > 0) {
|
||||
|
|
|
@ -194,5 +194,21 @@ void LooperWindow::clear_cat() {
|
|||
}
|
||||
void LooperWindow::update_cat(QPixmap &img) {
|
||||
cat_pixmap = &img;
|
||||
cat_disp->setPixmap(img.scaled(cat_disp->width(), cat_disp->height(), Qt::KeepAspectRatio));
|
||||
int w = img.width();
|
||||
int h = img.height();
|
||||
int mw = cat_disp->width();
|
||||
int mh = cat_disp->height();
|
||||
float wr = ((float)mw) / ((float)w);
|
||||
float hr = ((float)mh) / ((float)h);
|
||||
if (wr > 1.0f) wr = 1.0f;
|
||||
if (hr > 1.0f) hr = 1.0f;
|
||||
if (wr > hr) {
|
||||
mw *= wr;
|
||||
mh *= wr;
|
||||
} else {
|
||||
mw *= hr;
|
||||
mh *= hr;
|
||||
}
|
||||
cat_disp->setAlignment(Qt::AlignRight | Qt::AlignBottom);
|
||||
cat_disp->setPixmap(img.scaled(mw, mh, Qt::KeepAspectRatio));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue