Skip to content

Instantly share code, notes, and snippets.

View HalCanary's full-sized avatar

Hal Canary HalCanary

View GitHub Profile
#include "sk_types.h"
void concat_matrices(sk_matrix_t* dst,
const sk_matrix_t* matrixU,
const sk_matrix_t* matrixV) {
const float* u = matrixU->mat;
const float* v = matrixV->mat;
sk_matrix_t result = {{
u[0] * v[0] + u[1] * v[3] + u[2] * v[6],
u[0] * v[1] + u[1] * v[4] + u[2] * v[7],
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef animator_DEFINED
#define animator_DEFINED
#include <memory>
#!/usr/bin/env python
# Copyright 2017 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import httplib, json, re, subprocess, sys
def retrieve_changeid(commit_or_branch):
b = subprocess.check_output(['git', 'log', '-1', '--format=%B', commit_or_branch])
r = re.compile(r'^Change-Id: (.*)$')
for l in b.split('\n'):
m = r.match(l)
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPixelIterator_DEFINED
#define SkPixelIterator_DEFINED
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
#include "SkString.h"
static void draw(SkCanvas* canvas) {
canvas->drawColor(SkColorSetARGB(255, 101, 33, 131));
SkPaint paint;
@HalCanary
HalCanary / path_join.cc
Last active December 5, 2017 22:21
std::string path_join(...);
#include <iostream>
#include <sstream>
inline void path_join_append(std::ostringstream* o) { }
template<class... Types>
void path_join_append(std::ostringstream* o, const char* v, Types... args) {
constexpr char kPathSeparator[] = "/";
*o << kPathSeparator << v;
path_join_append(o, args...);
// Implementation of /Choose Your Own Adventure/
//
// Hal Canary, 2018.
//
// See https://github.com/jcdyer/rust101.git
//
// Data: https://raw.githubusercontent.com/jcdyer/rust101/master/data/adventure.json
extern crate serde;
extern crate serde_json;
#! /bin/sh
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if [ $# -ne 3 ]; then
echo usage:
echo $0 EXECUTABLE URL DESTINATION_DIRECTORY
exit 1
#! /bin/sh
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if [ $# -ne 3 ]; then
echo usage:
echo $0 EXECUTABLE URL DESTINATION_PATH
exit 1
/*
Here's a proposal for an addition to SkPath's public API. This allows a client
to build a SkPath from two arrays with a single function call. The
implementation shown here can probably be optimized if I looked at Path's
implementation details.
This can now be done with SkParsePath::FromSVGString, but that is a far less
elegant API.