Merge pull request #477 from analogjupiter/pixmappaint

PixmapPaint February ’25 update
This commit is contained in:
Adam D. Ruppe 2025-02-02 21:20:33 -05:00 committed by GitHub
commit 852d932413
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 981 additions and 21 deletions

File diff suppressed because it is too large Load Diff

View File

@ -372,12 +372,6 @@ enum Scaling {
cssCover = cover, /// equivalent CSS: `object-fit: cover;`
}
///
enum ScalingFilter {
nearest, /// nearest neighbor → blocky/pixelish
linear, /// (bi-)linear interpolation → smooth/blurry
}
///
struct PresenterConfig {
Window window; ///
@ -397,7 +391,7 @@ struct PresenterConfig {
Scaling scaling = Scaling.keepAspectRatio;
/++
Filter
Scaling filter
+/
ScalingFilter filter = ScalingFilter.nearest;
@ -639,7 +633,7 @@ final class OpenGl3PixmapRenderer : PixmapRenderer {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;
case linear:
case bilinear:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
break;
@ -748,7 +742,7 @@ final class OpenGl1PixmapRenderer : PixmapRenderer {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
break;
case linear:
case bilinear:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
break;
@ -842,6 +836,40 @@ final class OpenGl1PixmapRenderer : PixmapRenderer {
}
}
/+
/++
Purely software renderer
+/
final class SoftwarePixmapRenderer : PixmapRenderer {
private {
PresenterObjectsContainer* _poc;
}
public WantsOpenGl wantsOpenGl() @safe pure nothrow @nogc {
return WantsOpenGl(0);
}
public void setup(PresenterObjectsContainer* container) {
}
public void reconfigure() {
}
/++
Schedules a redraw
+/
public void redrawSchedule() {
}
/++
Triggers a redraw
+/
public void redrawNow() {
}
}
+/
///
struct LoopCtrl {
int interval; /// in milliseconds