anchor.diff:        ;; Stop early for 100% transparent colours.
         (0)
         ;; Don't blend 100% opaque colours.
  -      (#xFF (%bitset-xrgb-xrgb-mask-1 nrows ncols colour mask mask-offset mask-stride to to-offset to-stride))
  +      (#xFF (%bitset-mask-1-whole #'%%set-one-xrgb8888-xrgb8888 nrows ncols colour mask mask-offset mask-stride to to-offset to-stride))
         ;; Fall back on blend function.
  -      (t (%bitset-argb-xrgb-mask-1 nrows ncols colour mask mask-offset mask-stride to to-offset to-stride)))))
  -
  -(defun set-one-argb8888-xrgb8888 (dest offset pixel)
  -  (setf (row-major-aref dest offset) pixel))
  -
  -(defun alpha-blend-one-argb8888-xrgb8888 (dest offset pixel)
  -    "Alpha-blend PIXEL into DEST.
  -Uses OpenGL-style Src-alpha/One-minus-src-alpha blending.
  -DEST must be of type (simple-array (unsigned-byte 32) (* *)).
  -OFFSET must be a row-major index into DEST.
  -PIXEL must be a 32-bit ARGB pixel."
  -  (declare (type (unsigned-byte 32) pixel)
  -           (type (simple-array (unsigned-byte 32) (* *)) dest)
  -           (optimize speed))
  -  (let ((ca (ldb (byte 8 24) pixel))
  -        (cr (ldb (byte 8 16) pixel))
  -        (cg (ldb (byte 8  8) pixel))
  -        (cb (ldb (byte 8  0) pixel)))
  -    (cond ((zerop ca)) ; Ignore 100% transparent pixels.
  -          ((eql ca #xFF)
  -           ;; Don't blend for 100% opaque pixels.
  -           (setf (row-major-aref dest offset) pixel))
  -          (t ;; Blend.
  -           (flet ((blend (s d sa)
  -                    (min (+ (truncate (* s sa) 255)
  -                            (truncate (* d (- 255 sa)) 255))
  -                         255)))
  -             ;; Do complicated alpha blending.
  -             (let* ((d (row-major-aref dest offset))
  -                    (da (ldb (byte 8 24) d))
  -                    (dr (ldb (byte 8 16) d))
  -                    (dg (ldb (byte 8  8) d))
  -                    (db (ldb (byte 8  0) d))
  -                    (fa (blend ca da ca))
  -                    (fr (blend cr dr ca))
  -                    (fg (blend cg dg ca))
  -                    (fb (blend cb db ca)))
  -               (setf (row-major-aref dest offset)
  -                     (logior (ash fa 24)
  -                             (ash fr 16)
  -                             (ash fg  8)
  -                             fb))))))))
  -
  -;;; DEST OFFSET PIXEL
  +      (t (%bitset-mask-1-whole #'%%alpha-blend-one-argb8888-xrgb8888 nrows ncols colour mask mask-offset mask-stride to to-offset to-stride)))))
  +
  +;;; EAX = XRGB8888 pixel.
  +;;; RDI = XRGB8888 destination.
  +(sys.int::define-lap-function %%set-one-xrgb8888-xrgb8888 ()
  +  (sys.lap-x86:mov32 (:rdi) :eax)
  +  (sys.lap-x86:ret))
  +
  +;;; EAX = XRGB8888 pixel.
  +;;; RDI = XRGB8888 destination.
   ;;; Alpha-blend PIXEL into DEST.
   ;;; Uses OpenGL-style Src-alpha/One-minus-src-alpha blending.
  -;;; DEST must the fixnum address of an (unsigned-byte 32) simple-array.
  -;;; OFFSET must be a row-major index into DEST.
  -;;; PIXEL must be a 32-bit ARGB pixel.
  -(sys.int::define-lap-function %alpha-blend-one-argb8888-xrgb8888 ()
  -  (sys.lap-x86:mov64 :rax :r10) ; rax = pixel (ARGB fixnum)
  -  (sys.lap-x86:shr64 :rax 3) ; rax = pixel (ARGB)
  -  (sys.lap-x86:mov64 :rdi :r8) ; rdi = dest (fixnum)
  -  (sys.lap-x86:shr64 :rdi 3) ; rdi = dest (byte address)
  -  (sys.lap-x86:mov64 :rbx :r9) ; rbx = offset (* 8)
  -  (sys.lap-x86:shr64 :rbx 1) ; rbx = offset (* 4)
  -  (sys.lap-x86:mov32 :ecx :eax) ; ecx = pixel (ARGB)
  -  (sys.lap-x86:and32 :ecx #xFF000000) ; ecx = pixel-alpha (A000)
  +(sys.int::define-lap-function %%alpha-blend-one-argb8888-xrgb8888 ()
  +  (sys.lap-x86:mov32 :ebx :eax) ; ebx = pixel (ARGB)
  +  (sys.lap-x86:and32 :ebx #xFF000000) ; ebx = pixel-alpha (A000)
     (sys.lap-x86:jz out) ; Fully transparent, bail out.
  -  (sys.lap-x86:cmp32 :ecx #xFF000000)
  +  (sys.lap-x86:cmp32 :ebx #xFF000000)
     (sys.lap-x86:je set-result) ; Fully opaque, just set it.
     ;; Read destination.
  -  (sys.lap-x86:mov32 :edx (:rdi :rbx)) ; rdx = pixel (XRGB)
  +  (sys.lap-x86:mov32 :edx (:rdi)) ; rdx = pixel (XRGB)
     ;; MMX pixel blend.
     ;; RAX = Source pixel.
     ;; RCX = Alpha channel of source pixel at (byte 8 24).
     ;; RDX = Dest pixel.
     (sys.lap-x86:movd :mm0 :eax) ; MM0 = source (0000ARGB)
  -  (sys.lap-x86:movd :mm1 :ecx) ; MM1 = source alpha (0000A000)
  +  (sys.lap-x86:movd :mm1 :ebx) ; MM1 = source alpha (0000A000)
     (sys.lap-x86:movd :mm2 :edx) ; MM2 = dest (0000XRGB)
     (sys.lap-x86:pxor :mm3 :mm3) ; MM3 = 0
     ;; Swizzle alpha.
  
positive.code:   (sys.lap-x86:movd :eax :mm0)
    ;; EAX = Final pixel.
    set-result
    (sys.lap-x86:mov32 (:rdi :rbx) :eax) ; rdx = pixel (XRGB)
    out
    (sys.lap-x86:mov32 :ecx 8)
    (sys.lap-x86:mov64 :rbx :lsp)
    (sys.lap-x86:ret)
    ;(:align 4) ; 16 byte alignment for XMM. (TODO)
    alpha-shuffle
  
negative.code: ;;;; Optimized pluggable blitter functions.
  ;;;; The low-level pixel blending functions use a custom calling
  ;;;; convetion and must not be called directly from lisp.
  ;;;; RAX contains the source pixel.
  ;;;; RDI contains the address of the destination pixel.
  ;;;; RAX, RBX, RDX and MMX/SSE registers are caller save.
  ;;;; All other registers are callee save.
  ;;;; Higher-level line blenders must be called with the GC deferred.
  
  (in-package #:sys.graphics)
  
  (defun compute-blit-info-dest-src (nrows ncols from-array from-row from-col to-array to-row to-col)
  