-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'visible-sliders' into master
- Loading branch information
Showing
47 changed files
with
3,898 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SUBDIRS = protobufs src | ||
SUBDIRS = protobufs graph src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
git-buildpackage --git-upstream-branch=visible-sliders --git-upstream-tree=branch --git-debian-branch=visible-sliders |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ AC_INIT([remy], [0.1], [[email protected]]) | |
AM_INIT_AUTOMAKE([foreign]) | ||
AC_CONFIG_SRCDIR([src/remy.cc]) | ||
AC_CONFIG_HEADERS([config.h]) | ||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | ||
|
||
# Checks for programs. | ||
AC_PROG_CXX | ||
|
@@ -20,9 +21,17 @@ PKG_CHECK_MODULES([protobuf], [protobuf]) | |
|
||
# Add picky CXXFLAGS | ||
CPPFLAGS="-std=c++11 -pthread" | ||
PICKY_CXXFLAGS="-pedantic -Wall -Wextra -Weffc++ -Werror -fno-default-inline" | ||
PICKY_CXXFLAGS="-pedantic -Wall -Wextra -Werror" | ||
AC_SUBST([PICKY_CXXFLAGS]) | ||
|
||
# Checks for libraries. | ||
PKG_CHECK_MODULES([GL], [gl]) | ||
PKG_CHECK_MODULES([GLFW], [glfw3]) | ||
PKG_CHECK_MODULES([GLEW], [glew]) | ||
PKG_CHECK_MODULES([GLU], [glu]) | ||
PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo]) | ||
PKG_CHECK_MODULES([GTKMM], [gtkmm-3.0]) | ||
|
||
# Checks for header files. | ||
AC_LANG_PUSH(C++) | ||
|
||
|
@@ -36,8 +45,6 @@ boost/random/uniform_real_distribution.hpp fcntl.h future cmath queue \ | |
cstdio string sys/stat.h sys/types.h ctime tuple unistd.h unordered_map \ | ||
utility vector], [], [AC_MSG_ERROR([Missing header file])]) | ||
|
||
AC_CHECK_LIB(jemalloc, malloc, [], [AC_MSG_ERROR([Need jemalloc])]) | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_CHECK_HEADER_STDBOOL | ||
AC_TYPE_SIZE_T | ||
|
@@ -46,5 +53,5 @@ AC_LANG_POP(C++) | |
|
||
# Checks for library functions. | ||
|
||
AC_CONFIG_FILES([Makefile protobufs/Makefile src/Makefile]) | ||
AC_CONFIG_FILES([Makefile protobufs/Makefile graph/Makefile src/Makefile]) | ||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
ratatouille (0.1.2-1) trusty; urgency=low | ||
|
||
* Explicitly invoke rectangle exception in GLSL 1.3 | ||
|
||
-- Keith Winstein <[email protected]> Mon, 15 Sep 2014 13:31:37 -0500 | ||
|
||
ratatouille (0.1.1-1) trusty; urgency=low | ||
|
||
* Downgrade OpenGL requirements for use under VMware Fusion | ||
|
||
-- Keith Winstein <[email protected]> Mon, 15 Sep 2014 04:04:15 -0500 | ||
|
||
ratatouille (0.1-1) trusty; urgency=low | ||
|
||
* First packaging. | ||
|
||
-- Keith Winstein <[email protected]> Mon, 15 Sep 2014 02:35:00 -0500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Source: ratatouille | ||
Section: net | ||
Priority: optional | ||
Maintainer: Keith Winstein <[email protected]> | ||
Build-Depends: debhelper (>= 7.0.50), autotools-dev, dh-autoreconf, pkg-config, protobuf-compiler, libprotobuf-dev, libgl-dev, libglfw3-dev, libglew-dev, libglu-dev, libcairo2-dev, libpango1.0-dev, libgtkmm-3.0-dev, libboost1.55-dev | ||
Standards-Version: 3.9.4.0 | ||
Vcs-Git: git://github.com/keithw/remy.git | ||
Vcs-Browser: https://github.com/keithw/remy | ||
|
||
Package: ratatouille | ||
Architecture: any | ||
Depends: ${shlibs:Depends}, ${misc:Depends} | ||
Description: Demo of the Remy toolkit (http://mit.edu/remy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: remy | ||
Source: http://github.com/keithw/remy | ||
|
||
Files: * | ||
Copyright: 2013 Keith Winstein <[email protected]> | ||
License: GPL-3+ | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
. | ||
In addition, as a special exception, the copyright holders give | ||
permission to link the code of portions of this program with the | ||
OpenSSL library under certain conditions as described in each | ||
individual source file, and distribute linked combinations including | ||
the two. | ||
. | ||
You must obey the GNU General Public License in all respects for all | ||
of the code used other than OpenSSL. If you modify file(s) with this | ||
exception, you may extend this exception to your version of the | ||
file(s), but you are not obligated to do so. If you do not wish to do | ||
so, delete this exception statement from your version. If you delete | ||
this exception statement from all source files in the program, then | ||
also delete it here. | ||
. | ||
On Debian systems, the complete text of the GNU General | ||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/make -f | ||
# -*- makefile -*- | ||
# Sample debian/rules that uses debhelper. | ||
# This file was originally written by Joey Hess and Craig Small. | ||
# As a special exception, when this file is copied by dh-make into a | ||
# dh-make output file, you may use that output file without restriction. | ||
# This special exception was added by Craig Small in version 0.37 of dh-make. | ||
|
||
# Uncomment this to turn on verbose mode. | ||
#export DH_VERBOSE=1 | ||
|
||
# Through Autoconf we set hardening flags that are actually more aggressive | ||
# than the Ubuntu defaults, but they conflict with same. | ||
export DEB_BUILD_MAINT_OPTIONS = hardening=-stackprotector | ||
-include /usr/share/dpkg/buildflags.mk | ||
|
||
%: | ||
dh $@ --with autoreconf | ||
|
||
override_dh_auto_configure: | ||
dh_auto_configure -- \ | ||
--disable-silent-rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (quilt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AM_CPPFLAGS = $(GL_CFLAGS) $(GLFW_CFLAGS) $(GLEW_CFLAGS) $(GLU_CFLAGS) $(PANGOCAIRO_CFLAGS) | ||
AM_CXXFLAGS = $(PICKY_CXXFLAGS) $(NODEBUG_CXXFLAGS) | ||
#LDADD = $(GL_LIBS) $(GLFW_LIBS) $(GLEW_LIBS) $(GLU_LIBS) $(PANGOCAIRO_LIBS) | ||
#bin_PROGRAMS = glfun | ||
|
||
noinst_LIBRARIES = libremygraph.a | ||
|
||
libremygraph_a_SOURCES = gl_objects.hh gl_objects.cc \ | ||
display.hh display.cc \ | ||
image.hh image.cc \ | ||
cairo_objects.hh cairo_objects.cc \ | ||
graph.hh graph.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
#include <stdexcept> | ||
|
||
#include "cairo_objects.hh" | ||
|
||
using namespace std; | ||
|
||
int Cairo::stride_pixels_for_width( const unsigned int width ) | ||
{ | ||
const int stride_bytes = cairo_format_stride_for_width( CAIRO_FORMAT_ARGB32, width ); | ||
|
||
if ( stride_bytes % sizeof( Pixel ) ) { | ||
throw runtime_error( "Cairo requested stride that was not even multiple of pixel size" ); | ||
} else if ( stride_bytes < int( sizeof( Pixel ) * width ) ) { | ||
throw runtime_error( "Cairo does not support width " + to_string( width ) ); | ||
} | ||
|
||
return stride_bytes / sizeof( Pixel ); | ||
} | ||
|
||
Cairo::Cairo( const pair<unsigned int, unsigned int> size ) | ||
: image_( size.first, | ||
size.second, | ||
stride_pixels_for_width( size.first ) ), | ||
surface_( image_ ), | ||
context_( surface_ ) | ||
{ | ||
check_error(); | ||
} | ||
|
||
Cairo::Surface::Surface( Image & image ) | ||
: surface( cairo_image_surface_create_for_data( image.raw_pixels(), | ||
CAIRO_FORMAT_ARGB32, | ||
image.size().first, | ||
image.size().second, | ||
image.stride_bytes() ) ) | ||
{ | ||
check_error(); | ||
} | ||
|
||
Cairo::Context::Context( Surface & surface ) | ||
: context( cairo_create( surface.surface.get() ) ) | ||
{ | ||
check_error(); | ||
} | ||
|
||
void Cairo::Surface::check_error( void ) | ||
{ | ||
const cairo_status_t surface_result = cairo_surface_status( surface.get() ); | ||
if ( surface_result ) { | ||
throw runtime_error( string( "cairo surface error: " ) + cairo_status_to_string( surface_result ) ); | ||
} | ||
} | ||
|
||
void Cairo::Context::check_error( void ) | ||
{ | ||
const cairo_status_t context_result = cairo_status( context.get() ); | ||
if ( context_result ) { | ||
throw runtime_error( string( "cairo context error: " ) + cairo_status_to_string( context_result ) ); | ||
} | ||
} | ||
|
||
void Cairo::check_error( void ) | ||
{ | ||
context_.check_error(); | ||
surface_.check_error(); | ||
} | ||
|
||
Pango::Pango( Cairo & cairo ) | ||
: context_( pango_cairo_create_context( cairo ) ), | ||
layout_( pango_layout_new( *this ) ) | ||
{} | ||
|
||
Pango::Font::Font( const string & description ) | ||
: font( pango_font_description_from_string( description.c_str() ) ) | ||
{} | ||
|
||
void Pango::set_font( const Pango::Font & font ) | ||
{ | ||
pango_layout_set_font_description( *this, font ); | ||
} | ||
|
||
Pango::Text::Text( Cairo & cairo, Pango & pango, const Font & font, const string & text ) | ||
: path_(), | ||
extent_( { 0, 0, 0, 0 } ) | ||
{ | ||
cairo_identity_matrix( cairo ); | ||
cairo_new_path( cairo ); | ||
|
||
pango.set_font( font ); | ||
|
||
pango_layout_set_text( pango, text.data(), text.size() ); | ||
|
||
pango_cairo_layout_path( cairo, pango ); | ||
|
||
path_.reset( cairo_copy_path( cairo ) ); | ||
|
||
/* get logical extents */ | ||
PangoRectangle logical; | ||
pango_layout_get_extents( pango, nullptr, &logical ); | ||
extent_ = { logical.x / double( PANGO_SCALE ), | ||
logical.y / double( PANGO_SCALE ), | ||
logical.width / double( PANGO_SCALE ), | ||
logical.height / double( PANGO_SCALE ) }; | ||
} | ||
|
||
void Pango::Text::draw_centered_at( Cairo & cairo, const double x, const double y, const double max_width ) const | ||
{ | ||
cairo_identity_matrix( cairo ); | ||
cairo_new_path( cairo ); | ||
Cairo::Extent<true> my_extent = extent().to_device( cairo ); | ||
|
||
double center_x = x - my_extent.x - my_extent.width / 2; | ||
double center_y = y - my_extent.y - my_extent.height / 2; | ||
|
||
if ( my_extent.width > max_width ) { | ||
const double scale_factor = max_width / my_extent.width; | ||
cairo_scale( cairo, scale_factor, scale_factor ); | ||
center_x = x - my_extent.x - my_extent.width * scale_factor / 2; | ||
center_y = y - my_extent.y - my_extent.height * scale_factor / 2; | ||
} | ||
|
||
cairo_device_to_user( cairo, ¢er_x, ¢er_y ); | ||
|
||
cairo_translate( cairo, center_x, center_y ); | ||
|
||
cairo_append_path( cairo, path_.get() ); | ||
} | ||
|
||
void Pango::Text::draw_centered_rotated_at( Cairo & cairo, const double x, const double y ) const | ||
{ | ||
cairo_identity_matrix( cairo ); | ||
cairo_new_path( cairo ); | ||
|
||
cairo_rotate( cairo, - 3.1415926 / 2.0 ); | ||
|
||
Cairo::Extent<true> my_extent = extent().to_device( cairo ); | ||
|
||
double center_x = x - my_extent.x - my_extent.width / 2; | ||
double center_y = y - my_extent.y - my_extent.height / 2; | ||
|
||
cairo_device_to_user( cairo, ¢er_x, ¢er_y ); | ||
cairo_translate( cairo, center_x, center_y ); | ||
cairo_append_path( cairo, path_.get() ); | ||
} | ||
|
||
Cairo::Pattern::Pattern( cairo_pattern_t * pattern ) | ||
: pattern_( pattern ) | ||
{ | ||
const cairo_status_t pattern_result = cairo_pattern_status( pattern_.get() ); | ||
if ( pattern_result ) { | ||
throw runtime_error( string( "cairo pattern error: " ) + cairo_status_to_string( pattern_result ) ); | ||
} | ||
} |
Oops, something went wrong.