@@ -188,7 +188,7 @@ export type GlobalCompositeOperation = keyof typeof CGlobalCompositeOperation;
188188export type ImageSmoothingQuality = keyof typeof CImageSmoothingQuality ;
189189
190190const METRICS = new Float32Array ( 7 ) ;
191- const METRICS_PTR = Number ( Deno . UnsafePointer . of ( METRICS ) ) ;
191+ const METRICS_PTR = Deno . UnsafePointer . of ( METRICS ) ;
192192
193193export type Style = string | CanvasGradient | CanvasPattern ;
194194
@@ -259,7 +259,7 @@ export class CanvasRenderingContext2D {
259259 constructor ( canvas : Canvas , ptr : Deno . PointerValue ) {
260260 this . #canvas = canvas ;
261261 this . #ptr = ptr ;
262- if ( this . #ptr === 0 ) {
262+ if ( this . #ptr === null ) {
263263 throw new Error ( "Failed to create context" ) ;
264264 }
265265 }
@@ -291,7 +291,7 @@ export class CanvasRenderingContext2D {
291291 y ,
292292 maxWidth ?? 100_000 ,
293293 1 ,
294- 0 ,
294+ null ,
295295 )
296296 ) {
297297 throw new Error ( "failed to fill text" ) ;
@@ -309,7 +309,7 @@ export class CanvasRenderingContext2D {
309309 y ,
310310 maxWidth ?? 100_000 ,
311311 0 ,
312- 0 ,
312+ null ,
313313 )
314314 ) {
315315 throw new Error ( "failed to stroke text" ) ;
@@ -773,13 +773,16 @@ export class CanvasRenderingContext2D {
773773 const pathptr =
774774 typeof path === "object" && path !== null && path instanceof Path2D
775775 ? path . _unsafePointer
776- : 0 ;
776+ : null ;
777777 const irule = ( typeof path === "string" ? path : rule ) ?? "nonzero" ;
778778 sk_context_fill ( this . #ptr, pathptr , irule === "evenodd" ? 1 : 0 ) ;
779779 }
780780
781781 stroke ( path ?: Path2D ) {
782- sk_context_stroke ( this . #ptr, path ? path . _unsafePointer : 0 ) ;
782+ sk_context_stroke (
783+ this . #ptr,
784+ path ? path . _unsafePointer : null ,
785+ ) ;
783786 }
784787
785788 drawFocusIfNeeded ( ) {
@@ -800,7 +803,7 @@ export class CanvasRenderingContext2D {
800803 ) {
801804 const pathptr = typeof path === "object" && path !== null
802805 ? path . _unsafePointer
803- : 0 ;
806+ : null ;
804807 const fillRuleStr = typeof path === "string" ? path : fillRule ;
805808 const ifillRule = fillRuleStr === "evenodd" ? 1 : 0 ;
806809 sk_context_clip ( this . #ptr, pathptr , ifillRule ) ;
@@ -825,7 +828,7 @@ export class CanvasRenderingContext2D {
825828 ) : boolean {
826829 const pathptr = typeof path === "object" && path !== null
827830 ? path . _unsafePointer
828- : 0 ;
831+ : null ;
829832 const ifillRule = ( typeof y === "string" ? y : fillRule ) === "evenodd"
830833 ? 1
831834 : 0 ;
@@ -854,7 +857,7 @@ export class CanvasRenderingContext2D {
854857 ) : boolean {
855858 const pathptr = typeof path === "object" && path !== null
856859 ? path . _unsafePointer
857- : 0 ;
860+ : null ;
858861 return sk_context_is_point_in_stroke (
859862 this . #ptr,
860863 typeof path === "number" ? path : x ,
@@ -978,7 +981,7 @@ export class CanvasRenderingContext2D {
978981 asw ?: number ,
979982 ash ?: number ,
980983 ) {
981- if ( image instanceof Image && image . _unsafePointer === 0 ) {
984+ if ( image instanceof Image && image . _unsafePointer === null ) {
982985 return ;
983986 }
984987 const dx = asx ?? adx ;
@@ -991,8 +994,8 @@ export class CanvasRenderingContext2D {
991994 const sh = ash === undefined ? image . height : adh ?? image . height ;
992995 sk_context_draw_image (
993996 this . #ptr,
994- image instanceof Canvas ? image . _unsafePointer : 0 ,
995- image instanceof Image ? image . _unsafePointer : 0 ,
997+ image instanceof Canvas ? image . _unsafePointer : null ,
998+ image instanceof Image ? image . _unsafePointer : null ,
996999 dx ,
9971000 dy ,
9981001 dw ,
0 commit comments