Skip to content

Commit

Permalink
SDL import fix
Browse files Browse the repository at this point in the history
  • Loading branch information
XITRIX committed Dec 17, 2024
1 parent 123bf32 commit 55cc542
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Submodules/UIKit/include/Application.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <SDL.h>
#include <SDL_events.h>
#include "include/gpu/ganesh/GrDirectContext.h"
#include "tools/window/WindowContext.h"
#include "SkiaCtx.h"
Expand Down
2 changes: 0 additions & 2 deletions Submodules/UIKit/include/CGImage.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include <SDL.h>
//#include <SDL_gpu.h>
#include <optional>
#include <memory>
#include <NXData.h>
Expand Down
2 changes: 1 addition & 1 deletion Submodules/UIKit/include/SkiaCtx.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <SDL.h>
#include "SDL_video.h"
#include <memory>
#include "include/core/SkSurface.h"
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion Submodules/UIKit/include/UIApplication.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <SDL.h>
#include <SDL_events.h>

#include <UIApplicationDelegate.h>
#include <UIWindow.h>
Expand Down
1 change: 1 addition & 0 deletions Submodules/UIKit/lib/UIApplication.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <UIApplication.h>
#include <SDL.h>

using namespace NXKit;

Expand Down
7 changes: 6 additions & 1 deletion Submodules/UIKit/lib/UILabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ void UILabel::draw() {

SkBitmap bitmap;
auto scale = SkiaCtx::main()->getScaleFactor();
auto size = layer()->presentationOrSelf()->bounds().size;
NXSize size;
if (contentMode() == UIViewContentMode::redraw) {
size = layer()->presentationOrSelf()->bounds().size;
} else {
size = bounds().size;
}
auto bitmapSize = size * scale;
bitmap.allocPixels(SkImageInfo::MakeN32Premul(bitmapSize.width, bitmapSize.height));
SkCanvas canvas(bitmap);
Expand Down
3 changes: 2 additions & 1 deletion Submodules/UIKit/lib/platforms/SkiaCtx_sdlBase.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <platforms/SkiaCtx_sdlBase.h>
#include <SDL.h>

using namespace NXKit;

Expand Down Expand Up @@ -43,4 +44,4 @@ float SkiaCtx_sdlBase::getScaleFactor() {
SDL_GetWindowSize(window, &w, &h);
SDL_GL_GetDrawableSize(window, &dw, &dh);
return (float)dw / (float)w;
}
}
2 changes: 1 addition & 1 deletion app/Screens/TestViewController/TestViewController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void TestViewController::loadView() {
label->setText("Привет\nебать,\nэто\nкириллица,\nнахуй!!!!");
label->setTextAlignment(NSTextAlignment::center);
label->setBackgroundColor(UIColor::red);
label->setContentMode(NXKit::UIViewContentMode::redraw);
// label->setContentMode(NXKit::UIViewContentMode::redraw);
rootView->addSubview(label);

auto blur = new_shared<UIBlurView>();
Expand Down

0 comments on commit 55cc542

Please sign in to comment.