-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
250 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
#pragma once | ||
|
||
namespace NXKit { | ||
|
||
typedef double NXFloat; | ||
|
||
struct NXSize { | ||
NXFloat width; | ||
NXFloat height; | ||
|
||
NXSize(); | ||
|
||
NXSize(NXFloat width, NXFloat height); | ||
|
||
bool operator==(const NXSize &rhs) const; | ||
|
||
NXSize operator+(const NXSize &first) const; | ||
|
||
NXSize operator-(const NXSize &first) const; | ||
|
||
NXSize &operator+=(const NXSize &rhs); | ||
|
||
NXSize &operator-=(const NXSize &rhs); | ||
|
||
NXSize operator*(const NXFloat &first) const; | ||
|
||
NXSize operator/(const NXFloat &first) const; | ||
|
||
NXSize &operator*=(const NXFloat &rhs); | ||
|
||
NXSize &operator/=(const NXFloat &rhs); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include <SkiaCtx.h> | ||
#include <platforms/SkiaCtx_sdlBase.h> | ||
#include <include/gpu/ganesh/GrDirectContext.h> | ||
|
||
namespace NXKit { | ||
|
||
class SkiaCtx_macos: public SkiaCtx_sdlBase { | ||
public: | ||
SkiaCtx_macos(SDL_Window* window); | ||
|
||
sk_sp<SkSurface> getBackbufferSurface() override; | ||
// float getScaleFactor() override; | ||
sk_sp<GrDirectContext> directContext() override { return context; } | ||
private: | ||
sk_sp<GrDirectContext> context; | ||
|
||
void initContext(); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,50 @@ | ||
#include <NXSize.h> | ||
|
||
using namespace NXKit; | ||
|
||
NXSize::NXSize(): NXSize(0, 0) {} | ||
NXSize::NXSize(NXFloat width, NXFloat height): width(width), height(height) {} | ||
NXSize::NXSize(NXFloat width, NXFloat height): width(width), height(height) {} | ||
|
||
bool NXSize::operator==(const NXSize& rhs) const { | ||
return this->width == rhs.width && this->height == rhs.height; | ||
} | ||
|
||
NXSize NXSize::operator+(const NXSize& first) const { | ||
return NXSize(width + first.width, height + first.height); | ||
} | ||
|
||
NXSize NXSize::operator-(const NXSize& first) const { | ||
return NXSize(width - first.width, height - first.height); | ||
} | ||
|
||
NXSize& NXSize::operator+=(const NXSize& rhs) { | ||
this->width += rhs.width; | ||
this->height += rhs.height; | ||
return *this; | ||
} | ||
|
||
NXSize& NXSize::operator-=(const NXSize& rhs) { | ||
this->width -= rhs.width; | ||
this->height -= rhs.height; | ||
return *this; | ||
} | ||
|
||
NXSize NXSize::operator*(const NXFloat& first) const { | ||
return NXSize(width * first, height * first); | ||
} | ||
|
||
NXSize NXSize::operator/(const NXFloat& first) const { | ||
return NXSize(width / first, height / first); | ||
} | ||
|
||
NXSize& NXSize::operator*=(const NXFloat& rhs) { | ||
this->width *= rhs; | ||
this->height *= rhs; | ||
return *this; | ||
} | ||
|
||
NXSize& NXSize::operator/=(const NXFloat& rhs) { | ||
this->width /= rhs; | ||
this->height /= rhs; | ||
return *this; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.