Skip to content

Commit

Permalink
Merge pull request #158 from guzba/master
Browse files Browse the repository at this point in the history
0.7.8
  • Loading branch information
treeform authored May 29, 2021
2 parents 872857d + a819878 commit 973ce77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
6 changes: 3 additions & 3 deletions fidget.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.7.7"
version = "0.7.8"
author = "treeform"
description = "Fidget - UI Library"
license = "MIT"
Expand All @@ -9,8 +9,8 @@ srcDir = "src"
# Dependencies

requires "nim >= 1.4.0"
requires "typography >= 0.7.8"
requires "pixie >= 1.1.2"
requires "typography >= 0.7.10"
requires "pixie >= 2.0.2"
requires "print >= 0.1.0"
requires "opengl >= 1.2.3"
requires "html5_canvas >= 1.3"
Expand Down
32 changes: 18 additions & 14 deletions src/fidget/opengl/context.nim
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,13 @@ proc fillRoundedRect*(ctx: Context, rect: Rect, color: Color, radius: float32) =
w = ceil(rect.w).int
h = ceil(rect.h).int
if hash notin ctx.entries:
var image = newImage(w, h)
image.fillRoundedRect(
let
image = newImage(w, h)
c = newContext(image)
c.fillStyle = rgba(255, 255, 255, 255)
c.fillRoundedRect(
rect(0, 0, rect.w, rect.h),
radius,
rgba(255, 255, 255, 255)
radius
)
ctx.putImage(hash, image)

Expand Down Expand Up @@ -568,12 +570,14 @@ proc strokeRoundedRect*(
w = ceil(rect.w).int
h = ceil(rect.h).int
if hash notin ctx.entries:
var image = newImage(w, h)
image.strokeRoundedRect(
let
image = newImage(w, h)
c = newContext(image)
c.fillStyle = rgba(255, 255, 255, 255)
c.lineWidth = weight
c.strokeRoundedRect(
rect(weight / 2, weight / 2, rect.w - weight, rect.h - weight),
radius,
rgba(255, 255, 255, 255),
weight
radius
)
ctx.putImage(hash, image)
let
Expand Down Expand Up @@ -605,11 +609,11 @@ proc line*(
return

if hash notin ctx.entries:
var image = newImage(w, h)
image.strokeSegment(
segment(a - pos, b - pos),
rgba(255, 255, 255, 255)
)
let
image = newImage(w, h)
c = newContext(image)
c.fillStyle = rgba(255, 255, 255, 255)
c.strokeSegment(segment(a - pos, b - pos))
ctx.putImage(hash, image)
let
uvRect = ctx.entries[hash]
Expand Down
3 changes: 3 additions & 0 deletions src/fidget/openglbackend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ when not defined(emscripten) and not defined(fidgetNoAsync):

export input

type
Context = context.Context

var
ctx*: Context
glyphOffsets: Table[Hash, Vec2]
Expand Down

0 comments on commit 973ce77

Please sign in to comment.