Skip to content

Instantly share code, notes, and snippets.

View djg's full-sized avatar
💭
I may be slow to respond.

Dan Glastonbury djg

💭
I may be slow to respond.
View GitHub Profile
@djg
djg / crap0.asm
Created November 24, 2013 23:30
crap0 - Level 0 compiler nasm -f bin crap0.asm && chmod +x crap0
%define STDIN_FILENO 0
%define STDOUT_FILENO 1
%define SYS_EXIT 1
%define SYS_READ 3
%define SYS_WRITE 4
USE32
ORG 0x1000
@djg
djg / crap2a.crap
Created November 24, 2013 23:33
crap2a.crap - support for single character labels.
#
# CRAP2a for Darwin-i386-MachO
# Copyright (C) 2013, Dan Glastonbury <dan.glastonbury@gmail.com>
#
# Uses BSS section for data storage.
#
# Based on:
# HEX2a for Linux-i386-ELF
# Copyright (C) 2001, Edmund GRIMLEY EVANS <edmundo@rano.org>
#
@djg
djg / crap3a.crap
Created November 24, 2013 23:36
crap3a.crap - Supports 4 character labels! (written in crap2 dialect)
#
# CRAP3a for Darwin-i386-MachO
# Copyright (C) 2013, Dan Glastonbury <dan.glastonbury@gmail.com>
#
# Labels are 4 chars. Labels are stores in a symbol table stored in
# BSS section. The labels form a list of 32-bit label name and address
# pairs.
#
# Errors are signaled by return code:
# 1: Syntax Error
@djg
djg / woah.js
Last active December 29, 2015 12:09
Yeah, umm. WAT?!
function base_colors(src, mode) {
var col_1, col_2;
function compare(c1, c2) {
return (c1[0] * 16384 + c1[1] * 256 + c1[2]) >=
(c2[0] * 16384 + c2[1] * 256 + c2[2]);
}
if (mode === 'I') {
col_1 = extend_4to8bits(src[7], src[6], src[5]),
col_2 = extend_4to8bits(src[7] << 4, src[6] << 4, src[5] << 4)
return [ col_1, col_2 ];
@djg
djg / uncompressETC2Block.js
Created November 28, 2013 21:37
Yeah, umm. Thanks to @BrendanEich for <<,>>>,&,| ;-)
function uncompressETC2Block(destBuffer, destX, destY, destWidth, src) {
'use strict';
var xx, yy, basecols;
function extend_4to8bits(r, g, b) {
return [
(r & 0xf0) | ((r >> 4) & 0x0f),
(g & 0xf0) | ((g >> 4) & 0x0f),
(b & 0xf0) | ((b >> 4) & 0x0f),
255
@djg
djg / gist:7798142
Created December 5, 2013 00:26
Sad Panda.
djg in ~/Mozilla/hg/mozilla-central
$ export HGMERGE=p4merge
djg in ~/Mozilla/hg/mozilla-central
$ mhg qpush
applying bug-942506-refactor-ApplyFilterToBoundTexture
patching file gfx/gl/GLContext.cpp
Hunk #1 FAILED at 1325
1 out of 1 hunks FAILED -- saving rejects to file gfx/gl/GLContext.cpp.rej
patching file gfx/gl/GLContextProviderGLX.cpp
@djg
djg / gist:8531923
Created January 21, 2014 00:08
I don't see free() here ...
D3DCompiler_43.dll!CBaseProgram::DeleteArgsAbove(unsigned int) Unknown
D3DCompiler_43.dll!CCompiler::Reset(unsigned int,unsigned int,class CArgument * const *,class CTrackVarMapChanges *) Unknown
D3DCompiler_43.dll!CCompiler::ApplySFPSRange(class CInstruction *,unsigned int,class CArgument * const *,bool) Unknown
D3DCompiler_43.dll!CCompiler::EmitInstAll(struct ArSourceLocation const *,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,unsigned __int64,enum ArRangeFlags,enum ArBasicKind) Unknown
D3DCompiler_43.dll!CCompiler::EmitBinaryInst(struct ArSourceLocation const *,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,enum ArRangeFlags) Unknown
D3DCompiler_43.dll!CCompiler::EmitDot(struct ArSourceLocation const *,unsigned int,unsigned int,class CArgument * *,class CArgument * const *,class CArgument * const *,enum ArRangeFlags) Unknown
D3DCompiler_43.dll!CCompiler::EmitIntrinsic(class CNode *,class CArgument * *,bool) Unknown
@djg
djg / gist:05323539d0894dd9119c
Created February 18, 2016 01:29
nsDocument: IsActive() vs. IsVisible() vs. Hidden()
<roc> basically, IsActive() is true when the document is associated with a GlobalWindow(inner) which is the current document in its docshell
<roc> i.e. not bfcached
<roc> IsVisible() is similar but more specifically delimited by the pageshow and pagehide DOM events
<roc> Hidden() is like !IsActive() but all documents associated with hidden tabs are also Hdden()
<roc> tabs/docshells have this "hidden" state; all Firefox tabs that aren't the topmost tab are marked hidden
# YCBCR422
diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp
index 4ac0a50..8231d8a 100644
--- a/gfx/2d/MacIOSurface.cpp
+++ b/gfx/2d/MacIOSurface.cpp
@@ -476,6 +476,8 @@ MacIOSurface::GetFormat()
OSType pixelFormat = GetPixelFormat();
if (pixelFormat == '420v') {
return SurfaceFormat::NV12;
+ } else if (pixelFormat == '2vuy') {
@djg
djg / intel-hd-4600.txt
Created July 15, 2016 04:33
Intel(R) HD Graphics 4600
Intel(R) HD Graphics 4600
Report Date: Friday, July 15, 2016
Report Time [hh:mm:ss]: 2:30:59 PM
Driver Version: 10.18.15.4279
Operating System: Windows* 10 Pro(10.0.14372)
Default Language: English (Australia)