Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into version-2
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Corry committed Nov 3, 2023
2 parents 64e73e5 + 4dd9c64 commit 6c455b4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
# Zero-Clause BSD License

# Copyright (C) 2023 Toitware ApS.

# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.

# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

name: Publish package
on:
push:
tags:
- 'v*'
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
create-release:
name: Create new release
runs-on: ubuntu-latest
steps:
- name: Publish
uses: toitlang/pkg-publish@v1.0.2
uses: toitlang/pkg-publish@v1.3.0
18 changes: 9 additions & 9 deletions src/four_gray.toit
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class OpaquePixmapTexture extends BitmapTextureBase_:
bitmap_zap bytes_ color & 1
bitmap_zap bytes_2_ (color & 2) >> 1

write2_ canvas/Canvas:
write2_ canvas/TwoBitCanvas_:
transform_.xywh x_ y_ w_ h_: | x2 y2 w2 h2 |
x := x2 - canvas.x_offset_
y := y2 - canvas.y_offset_
Expand All @@ -126,7 +126,7 @@ class OpaquePixmapTexture extends BitmapTextureBase_:
bitmap_rectangle x y 0 w2 h2 canvas.plane_1_ canvas.width_
super canvas // Calls draw_
draw_ bx by orientation canvas/Canvas:
draw_ bx by orientation canvas/TwoBitCanvas_:
// The area was already zeroed, add in the 1s as needed.
bitmap_draw_bitmap bx by 1 orientation bytes_ 0 w canvas.plane_0_ canvas.width_ false
bitmap_draw_bitmap bx by 1 orientation bytes_2_ 0 w canvas.plane_1_ canvas.width_ false
Expand Down Expand Up @@ -161,8 +161,8 @@ class RoundedCornerWindow extends RoundedCornerWindow_:
constructor x y w h transform corner_radius .background_color:
super x y w h transform corner_radius

make_alpha_map_ canvas/Canvas padding:
return ByteArray (canvas.width_ + padding) * (canvas.height_ + padding)
make_alpha_map_ canvas/TwoBitCanvas_ padding:
return ByteArray ((canvas.width_ + padding) * (canvas.height_ + padding)) >> 3

make_opaque_ x y w h map map_width --frame/bool:
assert: not frame
Expand All @@ -175,11 +175,11 @@ class RoundedCornerWindow extends RoundedCornerWindow_:
if 0 <= y_offset < map.size:
map[x + y_offset] = opacity

draw_background canvas/Canvas:
draw_background canvas/TwoBitCanvas_:
bytemap_zap canvas.plane_0_ (background_color & 1)
bytemap_zap canvas.plane_1_ (background_color & 2) >> 1

draw_frame canvas/Canvas:
draw_frame canvas/TwoBitCanvas_:
throw "UNREACHABLE"

class DropShadowWindow extends DropShadowWindow_:
Expand All @@ -192,7 +192,7 @@ class DropShadowWindow extends DropShadowWindow_:
max_shadow_opacity_ = (shadow_opacity_percent * 2.5500001).to_int
super x y w h transform corner_radius blur_radius drop_distance_x drop_distance_y

make_alpha_map_ canvas/Canvas padding:
make_alpha_map_ canvas/TwoBitCanvas_ padding:
return ByteArray (canvas.width_ + padding) * (canvas.height_ + padding)

make_opaque_ x y w h map map_width --frame/bool:
Expand All @@ -207,10 +207,10 @@ class DropShadowWindow extends DropShadowWindow_:
else:
map[x + y_offset] = opacity

draw_background canvas/Canvas:
draw_background canvas/TwoBitCanvas_:
bytemap_zap canvas.plane_0_ (background_color & 1)
bytemap_zap canvas.plane_1_ (background_color & 2) >> 1

draw_frame canvas/Canvas:
draw_frame canvas/TwoBitCanvas_:
bytemap_zap canvas.plane_0_ 0
bytemap_zap canvas.plane_1_ 0
3 changes: 1 addition & 2 deletions src/pixel_display.toit
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,12 @@ abstract class PixelDisplay implements Window:
speed_ = speed
if speed < 10 or driver_.flags & FLAG_PARTIAL_UPDATES == 0:
draw_entire_display_
if dirty_: bitmap_zap dirty_ CLEAN_
return

// Send data for the whole screen, even if only part of it changed.
if speed < 50: all_is_dirty_

// TODO(kasper): Once we've started a partial update, we need to make sure we refresh,
// because otherwise the lock in the display code in the kernel will not be released.
driver_.start_partial_update speed
refreshed := false
try:
Expand Down
1 change: 1 addition & 0 deletions tests/texture_test_slow.toit
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import pixel_display.histogram show *
import pixel_display.texture show *

import pixel_display.four_gray
import pixel_display.two_bit_texture as two_bit
import pixel_display.three_color
import pixel_display.true_color
import pixel_display.two_color
Expand Down

0 comments on commit 6c455b4

Please sign in to comment.