diff options
author | Sam Spilsbury <smspillaz@gmail.com> | 2009-08-30 17:08:51 +0800 |
---|---|---|
committer | Sam Spilsbury <smspillaz@gmail.com> | 2009-08-30 17:08:51 +0800 |
commit | 21eafe2bd1b8b875df6d11da9b821fed9e831f56 (patch) | |
tree | 96749b5f0f35edc4aa866212c283ccee36c6ed99 | |
parent | c16d43282cc959ec76087f3f9041028ae020685e (diff) | |
download | bicubic-21eafe2bd1b8b875df6d11da9b821fed9e831f56.tar.gz bicubic-21eafe2bd1b8b875df6d11da9b821fed9e831f56.tar.bz2 |
Initial C++ port
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | Makefile | 533 | ||||
-rw-r--r-- | bicubic.c | 492 | ||||
-rw-r--r-- | bicubic.xml.in | 7 | ||||
-rw-r--r-- | plugin.info | 1 |
5 files changed, 10 insertions, 1029 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e5c6fdb..cbec32c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ -include (CompizFusion) +find_package (Compiz REQUIRED) -compiz_fusion_plugin (bicubic) +include (CompizPlugin) + +compiz_plugin (bicubic PLUGINDEPS composite opengl) diff --git a/Makefile b/Makefile deleted file mode 100644 index d9a07cf..0000000 --- a/Makefile +++ /dev/null @@ -1,533 +0,0 @@ -## -# -# Compiz plugin Makefile -# -# Copyright : (C) 2007 by Dennis Kasprzyk -# E-mail : onestone@deltatauchi.de -# -# -# 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 2 -# 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. -# -## - -# plugin.info file contents -# -# PLUGIN = foo -# PKG_DEP = pango -# LDFLAGS_ADD = -lGLU -# CFLAGS_ADD = -I/usr/include/foo -# CHK_HEADERS = compiz-cube.h -# - -#load config file - -ECHO = `which echo` - -# default color settings -color := $(shell if [ $$TERM = "dumb" ]; then $(ECHO) "no"; else $(ECHO) "yes"; fi) - -ifeq ($(shell if [ -f plugin.info ]; then $(ECHO) -n "found"; fi ),found) -include plugin.info -else -$(error $(shell if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\033[1;31m[ERROR]\033[0m \"plugin.info\" file not found"; \ - else \ - $(ECHO) "[ERROR] \"plugin.info\" file not found"; \ - fi;)) -endif - -ifneq ($(shell if pkg-config --exists compiz; then $(ECHO) -n "found"; fi ),found) -$(error $(shell if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m Compiz not installed"; \ - else \ - $(ECHO) -n "[ERROR] Compiz not installed"; \ - fi)) -endif - - -ifneq ($(shell if [ -n "$(PKG_DEP)" ]; then if pkg-config --exists $(PKG_DEP); then $(ECHO) -n "found"; fi; \ - else $(ECHO) -n "found"; fi ),found) -$(error $(shell if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m "; \ - else \ - $(ECHO) -n "[ERROR] "; \ - fi; \ - pkg-config --print-errors --short-errors --errors-to-stdout $(PKG_DEP); )) -endif - - -ifeq ($(BUILD_GLOBAL),true) - PREFIX = $(shell pkg-config --variable=prefix compiz) - CLIBDIR = $(shell pkg-config --variable=libdir compiz) - CINCDIR = $(shell pkg-config --variable=includedir compiz) - PKGDIR = $(CLIBDIR)/pkgconfig - DESTDIR = $(shell pkg-config --variable=libdir compiz)/compiz - XMLDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz - IMAGEDIR = $(shell pkg-config --variable=prefix compiz)/share/compiz - DATADIR = $(shell pkg-config --variable=prefix compiz)/share/compiz -else - DESTDIR = $(HOME)/.compiz/plugins - XMLDIR = $(HOME)/.compiz/metadata - IMAGEDIR = $(HOME)/.compiz/images - DATADIR = $(HOME)/.compiz/data -endif - -BUILDDIR = build - -CC = gcc -CPP = g++ -LIBTOOL = libtool -INSTALL = install - -BCOP = `pkg-config --variable=bin bcop` - -CFLAGS = -g -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing `pkg-config --cflags $(PKG_DEP) compiz ` $(CFLAGS_ADD) -LDFLAGS = `pkg-config --libs $(PKG_DEP) compiz ` $(LDFLAGS_ADD) - -DEFINES = -DIMAGEDIR=\"$(IMAGEDIR)\" -DDATADIR=\"$(DATADIR)\" - -POFILEDIR = $(shell if [ -n "$(PODIR)" ]; then $(ECHO) $(PODIR); else $(ECHO) ./po;fi ) - -COMPIZ_HEADERS = compiz.h compiz-core.h -COMPIZ_INC = $(shell pkg-config --variable=includedir compiz)/compiz/ - -is-bcop-target := $(shell if [ -e $(PLUGIN).xml.in ]; then cat $(PLUGIN).xml.in | grep "useBcop=\"true\""; \ - else if [ -e $(PLUGIN).xml ]; then cat $(PLUGIN).xml | grep "useBcop=\"true\""; fi; fi) - -trans-target := $(shell if [ -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml;fi ) - -bcop-target := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi ) -bcop-target-src := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.c; fi ) -bcop-target-hdr := $(shell if [ -n "$(is-bcop-target)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN)_options.h; fi ) - -gen-schemas := $(shell if [ \( -e $(PLUGIN).xml.in -o -e $(PLUGIN).xml \) -a -n "`pkg-config --variable=xsltdir compiz-gconf`" ]; then $(ECHO) true; fi ) -schema-target := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/$(PLUGIN).xml; fi ) -schema-output := $(shell if [ -n "$(gen-schemas)" ]; then $(ECHO) $(BUILDDIR)/compiz-$(PLUGIN).schema; fi ) - -ifeq ($(BUILD_GLOBAL),true) - pkg-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" ]; then $(ECHO) "$(BUILDDIR)/compiz-$(PLUGIN).pc"; fi ) - hdr-install-target := $(shell if [ -e compiz-$(PLUGIN).pc.in -a -n "$(PREFIX)" -a -d "$(PREFIX)" -a -e compiz-$(PLUGIN).h ]; then $(ECHO) "compiz-$(PLUGIN).h"; fi ) -endif - -# find all the object files - -c-objs := $(patsubst %.c,%.lo,$(shell find -name '*.c' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')) -c-objs += $(patsubst %.cpp,%.lo,$(shell find -name '*.cpp' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')) -c-objs += $(patsubst %.cxx,%.lo,$(shell find -name '*.cxx' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///')) -c-objs := $(filter-out $(bcop-target-src:.c=.lo),$(c-objs)) - -h-files := $(shell find -name '*.h' 2> /dev/null | grep -v "$(BUILDDIR)/" | sed -e 's/^.\///') -h-files += $(bcop-target-hdr) -h-files += $(foreach file,$(COMPIZ_HEADERS) $(CHK_HEADERS),$(shell $(ECHO) -n "$(COMPIZ_INC)$(file)")) - -all-c-objs := $(addprefix $(BUILDDIR)/,$(c-objs)) -all-c-objs += $(bcop-target-src:.c=.lo) - -# additional files - -data-files := $(shell find data/ -name '*' -type f 2> /dev/null | sed -e 's/data\///') -image-files := $(shell find images/ -name '*' -type f 2> /dev/null | sed -e 's/images\///') - -# system include path parameter, -isystem doesn't work on old gcc's -inc-path-param = $(shell if [ -z "`gcc --version | head -n 1 | grep ' 3'`" ]; then $(ECHO) "-isystem"; else $(ECHO) "-I"; fi) - -# Tests -ifeq ($(shell if [ -n "$(is-bcop-target)" -a -z "$(BCOP)" ]; then $(ECHO) -n "error"; fi ),error) -$(error $(shell if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[1;31m[ERROR]\033[0m BCOP not installed but is needed to build plugin"; \ - else \ - $(ECHO) -n "[ERROR] BCOP not installed but is needed to build plugin"; \ - fi)) -endif - -ifeq ($(shell if [ "x$(BUILD_GLOBAL)" != "xtrue" -a -e compiz-$(PLUGIN).pc.in ]; then $(ECHO) -n "warn"; fi ),warn) -$(warning $(shell if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[1;31m[WARNING]\033[0m This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\" "; \ - else \ - $(ECHO) -n "[WARNING] This plugin might be needed by other plugins. Install it with \"BUILD_GLOBAL=true sudo make install\""; \ - fi)) -endif - -# -# Do it. -# - -.PHONY: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin - -all: $(BUILDDIR) build-dir trans-target bcop-build pkg-creation schema-creation c-build-objs c-link-plugin - -trans-build: $(trans-target) - -bcop-build: $(bcop-target-hdr) $(bcop-target-src) - -schema-creation: $(schema-output) - -c-build-objs: $(all-c-objs) - -c-link-plugin: $(BUILDDIR)/lib$(PLUGIN).la - -pkg-creation: $(pkg-target) - -# -# Create build directory -# - -$(BUILDDIR) : - @mkdir -p $(BUILDDIR) - -$(DESTDIR) : - @mkdir -p $(DESTDIR) - -# -# fallback if xml.in doesn't exists -# -$(BUILDDIR)/%.xml: %.xml - @cp $< $@ - -# -# Translating -# -$(BUILDDIR)/%.xml: %.xml.in - @if [ -d $(POFILEDIR) ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mtranslate \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "translate $< -> $@"; \ - fi; \ - intltool-merge -x -u $(POFILEDIR) $< $@ > /dev/null; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mtranslate : \033[34m$< -> $@\033[0m"; \ - fi; \ - else \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mconvert \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "convert $< -> $@"; \ - fi; \ - cat $< | sed -e 's;<_;<;g' -e 's;</_;</;g' > $@; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mconvert : \033[34m$< -> $@\033[0m"; \ - fi; \ - fi - -# -# BCOP'ing - -$(BUILDDIR)/%_options.h: $(BUILDDIR)/%.xml - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "bcop'ing $< -> $@"; \ - fi - @$(BCOP) --header=$@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \ - fi - -$(BUILDDIR)/%_options.c: $(BUILDDIR)/%.xml - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mbcop'ing \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "bcop'ing $< -> $@"; \ - fi - @$(BCOP) --source=$@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mbcop'ing : \033[34m$< -> $@\033[0m"; \ - fi - -# -# Schema generation - -$(BUILDDIR)/compiz-%.schema: $(BUILDDIR)/%.xml - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mschema'ing\033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "schema'ing $< -> $@"; \ - fi - @xsltproc `pkg-config --variable=xsltdir compiz-gconf`/schemas.xslt $< > $@ - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mschema : \033[34m$< -> $@\033[0m"; \ - fi - -# -# pkg config file generation - -$(BUILDDIR)/compiz-%.pc: compiz-%.pc.in - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mpkgconfig \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "pkgconfig $< -> $@"; \ - fi - @COMPIZREQUIRES=`cat $(PKGDIR)/compiz.pc | grep Requires | sed -e 's;Requires: ;;g'`; \ - COMPIZCFLAGS=`cat $(PKGDIR)/compiz.pc | grep Cflags | sed -e 's;Cflags: ;;g'`; \ - sed -e 's;@prefix@;$(PREFIX);g' -e 's;\@libdir@;$(CLIBDIR);g' \ - -e 's;@includedir@;$(CINCDIR);g' -e 's;\@VERSION@;0.0.1;g' \ - -e "s;@COMPIZ_REQUIRES@;$$COMPIZREQUIRES;g" \ - -e "s;@COMPIZ_CFLAGS@;$$COMPIZCFLAGS;g" $< > $@; - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mpkgconfig : \033[34m$< -> $@\033[0m"; \ - fi - -# -# Compiling -# - -$(BUILDDIR)/%.lo: %.c $(h-files) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "compiling $< -> $@"; \ - fi - @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \ - fi - -$(BUILDDIR)/%.lo: $(BUILDDIR)/%.c $(h-files) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "compiling $< -> $@"; \ - fi - @$(LIBTOOL) --quiet --mode=compile $(CC) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \ - fi - -$(BUILDDIR)/%.lo: %.cpp $(h-files) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "compiling $< -> $@"; \ - fi - @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \ - fi - -$(BUILDDIR)/%.lo: %.cxx $(h-files) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5mcompiling \033[0m: \033[0;32m$< \033[0m-> \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "compiling $< -> $@"; \ - fi - @$(LIBTOOL) --quiet --mode=compile $(CPP) $(CFLAGS) $(DEFINES) -I$(BUILDDIR) -c -o $@ $< - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mcompiling : \033[34m$< -> $@\033[0m"; \ - fi - -# -# Linking -# - -cxx-rpath-prefix := -Wl,-rpath, - -$(BUILDDIR)/lib$(PLUGIN).la: $(all-c-objs) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mlinking \033[0m: \033[0;31m$@\033[0m"; \ - else \ - $(ECHO) "linking : $@"; \ - fi - @$(LIBTOOL) --quiet --mode=link $(CC) $(LDFLAGS) -rpath $(DESTDIR) -o $@ $(all-c-objs) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mlinking : \033[34m$@\033[0m"; \ - fi - - -clean: - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e -n "\033[0;1;5mremoving \033[0m: \033[0;31m./$(BUILDDIR)\033[0m"; \ - else \ - $(ECHO) "removing : ./$(BUILDDIR)"; \ - fi - @rm -rf $(BUILDDIR) - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0mremoving : \033[34m./$(BUILDDIR)\033[0m"; \ - fi - - -install: $(DESTDIR) all - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \ - else \ - $(ECHO) "install : $(DESTDIR)/lib$(PLUGIN).so"; \ - fi - @mkdir -p $(DESTDIR) - @$(INSTALL) $(BUILDDIR)/.libs/lib$(PLUGIN).so $(DESTDIR)/lib$(PLUGIN).so - @if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \ - fi - @if [ -e $(BUILDDIR)/$(PLUGIN).xml ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \ - else \ - $(ECHO) "install : $(XMLDIR)/$(PLUGIN).xml"; \ - fi; \ - mkdir -p $(XMLDIR); \ - $(INSTALL) $(BUILDDIR)/$(PLUGIN).xml $(XMLDIR)/$(PLUGIN).xml; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \ - fi; \ - fi - @if [ -n "$(hdr-install-target)" ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \ - else \ - $(ECHO) "install : $(CINCDIR)/compiz/$(hdr-install-target)"; \ - fi; \ - $(INSTALL) --mode=u=rw,go=r,a-s $(hdr-install-target) $(CINCDIR)/compiz/$(hdr-install-target); \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \ - fi; \ - fi - @if [ -n "$(pkg-target)" ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \ - else \ - $(ECHO) "install : $(PKGDIR)/compiz-$(PLUGIN).pc"; \ - fi; \ - $(INSTALL) --mode=u=rw,go=r,a-s $(pkg-target) $(PKGDIR)/compiz-$(PLUGIN).pc; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \ - fi; \ - fi - @if [ -n "$(schema-output)" -a -e "$(schema-output)" ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \ - else \ - $(ECHO) "install : $(schema-output)"; \ - fi; \ - if [ "x$(USER)" = "xroot" ]; then \ - GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ - gconftool-2 --makefile-install-rule $(schema-output) > /dev/null; \ - else \ - gconftool-2 --install-schema-file=$(schema-output) > /dev/null; \ - fi; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(schema-output)\033[0m"; \ - fi; \ - fi - @if [ -n "$(data-files)" ]; then \ - mkdir -p $(DATADIR); \ - for FILE in $(data-files); do \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \ - else \ - $(ECHO) "install : $(DATADIR)/$$FILE"; \ - fi; \ - FILEDIR="$(DATADIR)/`dirname "$$FILE"`"; \ - mkdir -p "$$FILEDIR"; \ - $(INSTALL) --mode=u=rw,go=r,a-s data/$$FILE $(DATADIR)/$$FILE; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \ - fi; \ - done \ - fi - @if [ -n "$(image-files)" ]; then \ - mkdir -p $(IMAGEDIR); \ - for FILE in $(image-files); do \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5minstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \ - else \ - $(ECHO) "install : $(IMAGEDIR)/$$FILE"; \ - fi; \ - FILEDIR="$(IMAGEDIR)/`dirname "$$FILE"`"; \ - mkdir -p "$$FILEDIR"; \ - $(INSTALL) --mode=u=rw,go=r,a-s images/$$FILE $(IMAGEDIR)/$$FILE; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0minstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \ - fi; \ - done \ - fi - -uninstall: - @if [ -e $(DESTDIR)/lib$(PLUGIN).so ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \ - else \ - $(ECHO) "uninstall : $(DESTDIR)/lib$(PLUGIN).so"; \ - fi; \ - rm -f $(DESTDIR)/lib$(PLUGIN).so; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(DESTDIR)/lib$(PLUGIN).so\033[0m"; \ - fi; \ - fi - @if [ -e $(XMLDIR)/$(PLUGIN).xml ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \ - else \ - $(ECHO) "uninstall : $(XMLDIR)/$(PLUGIN).xml"; \ - fi; \ - rm -f $(XMLDIR)/$(PLUGIN).xml; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(XMLDIR)/$(PLUGIN).xml\033[0m"; \ - fi; \ - fi - @if [ -n "$(hdr-install-target)" -a -e $(CINCDIR)/compiz/$(hdr-install-target) ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \ - else \ - $(ECHO) "uninstall : $(CINCDIR)/compiz/$(hdr-install-target)"; \ - fi; \ - rm -f $(CINCDIR)/compiz/$(hdr-install-target); \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(CINCDIR)/compiz/$(hdr-install-target)\033[0m"; \ - fi; \ - fi - @if [ -n "$(pkg-target)" -a -e $(PKGDIR)/compiz-$(PLUGIN).pc ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \ - else \ - $(ECHO) "uninstall : $(PKGDIR)/compiz-$(PLUGIN).pc"; \ - fi; \ - rm -f $(PKGDIR)/compiz-$(PLUGIN).pc; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(PKGDIR)/compiz-$(PLUGIN).pc\033[0m"; \ - fi; \ - fi - @if [ -n "$(schema-output)" -a -e "$(schema-output)" -a 'x$(USER)' = 'xroot' ]; then \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(schema-output)\033[0m"; \ - else \ - $(ECHO) "uninstall : $(schema-output)"; \ - fi; \ - GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` \ - gconftool-2 --makefile-uninstall-rule $(schema-output) > /dev/null; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(schema-output)\033[0m"; \ - fi; \ - fi - @if [ -n "$(data-files)" ]; then \ - for FILE in $(data-files); do \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(DATADIR)/$$FILE\033[0m"; \ - else \ - $(ECHO) "uninstall : $(DATADIR)/$$FILE"; \ - fi; \ - rm -f $(DATADIR)/$$FILE; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(DATADIR)/$$FILE\033[0m"; \ - fi; \ - done \ - fi - @if [ -n "$(image-files)" ]; then \ - for FILE in $(image-files); do \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -n -e "\033[0;1;5muninstall \033[0m: \033[0;31m$(IMAGEDIR)/$$FILE\033[0m"; \ - else \ - $(ECHO) "uninstall : $(IMAGEDIR)/$$FILE"; \ - fi; \ - rm -f $(IMAGEDIR)/$$FILE; \ - if [ '$(color)' != 'no' ]; then \ - $(ECHO) -e "\r\033[0muninstall : \033[34m$(IMAGEDIR)/$$FILE\033[0m"; \ - fi; \ - done \ - fi diff --git a/bicubic.c b/bicubic.c deleted file mode 100644 index a5e0a84..0000000 --- a/bicubic.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * - * Compiz bicubic filter plugin - * - * bicubic.c - * - * Copyright : (C) 2008 by Dennis Kasprzyk - * E-mail : onestone@opencompositing.org - * - * - * 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 2 - * 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. - * - */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> - -#include <compiz-core.h> - -static CompMetadata bicubicMetadata; - -static int BicubicDisplayPrivateIndex; - -typedef struct _BicubicFunction { - struct _BicubicFunction *next; - - int handle; - int target; - int param; - int unit; -} BicubicFunction; - -typedef struct _BicubicDisplay -{ - int screenPrivateIndex; -} BicubicDisplay; - - -typedef struct _BicubicScreen -{ - DrawWindowTextureProc drawWindowTexture; - - BicubicFunction *func; - - GLenum lTexture; - -} BicubicScreen; - -#define GET_PLUGIN_CORE(object, plugin) \ - ((plugin##Core *) (object)->base.privates[plugin##CorePrivateIndex].ptr) -#define PLUGIN_CORE(object, plugin, prefix) \ - plugin##Core * prefix##c = GET_PLUGIN_CORE (object, plugin) - -#define GET_PLUGIN_DISPLAY(object, plugin) \ - ((plugin##Display *) \ - (object)->base.privates[plugin##DisplayPrivateIndex].ptr) -#define PLUGIN_DISPLAY(object, plugin, prefix) \ - plugin##Display * prefix##d = GET_PLUGIN_DISPLAY (object, plugin) - -#define GET_PLUGIN_SCREEN(object, parent, plugin) \ - ((plugin##Screen *) \ - (object)->base.privates[(parent)->screenPrivateIndex].ptr) -#define PLUGIN_SCREEN(object, plugin, prefix) \ - plugin##Screen * prefix##s = \ - GET_PLUGIN_SCREEN (object, \ - GET_PLUGIN_DISPLAY ((object)->display, plugin), plugin) - -#define GET_PLUGIN_WINDOW(object, parent, plugin) \ - ((plugin##Window *) \ - (object)->base.privates[(parent)->windowPrivateIndex].ptr) -#define PLUGIN_WINDOW(object, plugin, prefix) \ - plugin##Window * prefix##w = \ - GET_PLUGIN_WINDOW (object, \ - GET_PLUGIN_SCREEN ((object)->screen, \ - GET_PLUGIN_DISPLAY ((object)->screen->display, plugin), plugin), plugin) - -#define BICUBIC_DISPLAY(d) PLUGIN_DISPLAY(d, Bicubic, b) -#define BICUBIC_SCREEN(s) PLUGIN_SCREEN(s, Bicubic, b) - -static int -getBicubicFragmentFunction (CompScreen *s, - CompTexture *texture, - int param, - int unit) -{ - BicubicFunction *function; - CompFunctionData *data; - int target; - char *targetString; - - BICUBIC_SCREEN (s); - - if (texture->target == GL_TEXTURE_2D) - { - target = COMP_FETCH_TARGET_2D; - targetString = "2D"; - } - else - { - target = COMP_FETCH_TARGET_RECT; - targetString = "RECT"; - } - - for (function = bs->func; function; function = function->next) - if (function->param == param && - function->target == target && - function->unit == unit) - return function->handle; - - data = createFunctionData (); - if (data) - { - Bool ok = TRUE; - int handle = 0, i; - - static char *filterTemp[] = { - "hgX", "hgY", "cs00", "cs01", "cs10", "cs11" - }; - - for (i = 0; i < sizeof (filterTemp) / sizeof (filterTemp[0]); i++) - ok &= addTempHeaderOpToFunctionData (data, filterTemp[i]); - - - ok &= addDataOpToFunctionData (data, - "MAD cs00, fragment.texcoord[0], program.env[%d]," - "{-0.5, -0.5, 0.0, 0.0};", param + 2); - - ok &= addDataOpToFunctionData (data, - "TEX hgX, cs00.x, texture[%d], 1D;", unit); - ok &= addDataOpToFunctionData (data, - "TEX hgY, cs00.y, texture[%d], 1D;", unit); - - ok &= addDataOpToFunctionData (data, - "MUL cs10, program.env[%d], hgX.y;", param); - ok &= addDataOpToFunctionData (data, - "MUL cs00, program.env[%d], -hgX.x;", param); - ok &= addDataOpToFunctionData (data, - "MAD cs11, program.env[%d], hgY.y, cs10;", param + 1); - ok &= addDataOpToFunctionData (data, - "MAD cs01, program.env[%d], hgY.y, cs00;", param + 1); - ok &= addDataOpToFunctionData (data, - "MAD cs10, program.env[%d], -hgY.x, cs10;", param + 1); - ok &= addDataOpToFunctionData (data, - "MAD cs00, program.env[%d], -hgY.x, cs00;", param + 1); - - ok &= addDataOpToFunctionData (data, - "ADD cs00, cs00, fragment.texcoord[0];"); - ok &= addDataOpToFunctionData (data, - "ADD cs01, cs01, fragment.texcoord[0];"); - ok &= addDataOpToFunctionData (data, - "ADD cs10, cs10, fragment.texcoord[0];"); - ok &= addDataOpToFunctionData (data, - "ADD cs11, cs11, fragment.texcoord[0];"); - - ok &= addDataOpToFunctionData (data, - "TEX cs00, cs00, texture[0], %s;", targetString); - ok &= addDataOpToFunctionData (data, - "TEX cs01, cs01, texture[0], %s;", targetString); - ok &= addDataOpToFunctionData (data, - "TEX cs10, cs10, texture[0], %s;", targetString); - ok &= addDataOpToFunctionData (data, - "TEX cs11, cs11, texture[0], %s;", targetString); - - ok &= addDataOpToFunctionData (data, "LRP cs00, hgY.z, cs00, cs01;"); - ok &= addDataOpToFunctionData (data, "LRP cs10, hgY.z, cs10, cs11;"); - - ok &= addDataOpToFunctionData (data, "LRP output, hgX.z, cs00, cs10;"); - - ok &= addColorOpToFunctionData (data, "output", "output"); - if (!ok) - { - destroyFunctionData (data); - return 0; - } - - function = malloc (sizeof (BicubicFunction)); - if (function) - { - handle = createFragmentFunction (s, "bicubic", data); - - function->handle = handle; - function->target = target; - function->param = param; - function->unit = unit; - - function->next = bs->func; - bs->func = function; - } - - destroyFunctionData (data); - - return handle; - } - - return 0; -} - -static void -BicubicDrawWindowTexture (CompWindow *w, - CompTexture *texture, - const FragmentAttrib *attrib, - unsigned int mask) -{ - CompScreen *s = w->screen; - - BICUBIC_SCREEN (s); - - if ((mask & (PAINT_WINDOW_TRANSFORMED_MASK | - PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK)) && - s->filter[SCREEN_TRANS_FILTER] == COMP_TEXTURE_FILTER_GOOD) - { - FragmentAttrib fa = *attrib; - int function, param; - int unit = 0; - - param = allocFragmentParameters (&fa, 3); - unit = allocFragmentTextureUnits (&fa, 1); - - function = getBicubicFragmentFunction (s, texture, param, unit); - - if (function) - { - addFragmentFunction (&fa, function); - - (*s->activeTexture) (GL_TEXTURE0_ARB + unit); - glBindTexture (GL_TEXTURE_1D, bs->lTexture); - (*s->activeTexture) (GL_TEXTURE0_ARB); - - - (*s->programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, param, - texture->matrix.xx, 0.0f, - 0.0f, 0.0f); - (*s->programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, - param + 1, - 0.0f, -texture->matrix.yy, - 0.0f, 0.0f); - (*s->programEnvParameter4f) (GL_FRAGMENT_PROGRAM_ARB, - param + 2, - 1.0 / texture->matrix.xx, - 1.0 / -texture->matrix.yy, - 0.0f, 0.0f); - } - - UNWRAP (bs, s, drawWindowTexture); - (*s->drawWindowTexture) (w, texture, &fa, mask); - WRAP (bs, s, drawWindowTexture, BicubicDrawWindowTexture); - - if (unit) - { - (*s->activeTexture) (GL_TEXTURE0_ARB + unit); - glBindTexture (GL_TEXTURE_1D, 0); - (*s->activeTexture) (GL_TEXTURE0_ARB); - } - } - else - { - UNWRAP (bs, s, drawWindowTexture); - (*s->drawWindowTexture) (w, texture, attrib, mask); - WRAP (bs, s, drawWindowTexture, BicubicDrawWindowTexture); - } -} - -static void -generateLookupTexture (CompScreen *s, GLenum format) -{ - GLfloat values[512]; - int i; - float a, a2, a3, w0, w1, w2, w3; - - BICUBIC_SCREEN (s); - - for (i = 0; i < 512; i += 4) - { - a = (float)i / 512.0; - a2 = a * a; - a3 = a2 * a; - - w0 = (1.0 / 6.0) * ((-a3) + (3.0 * a2) + (-3.0 * a) + 1.0); - w1 = (1.0 / 6.0) * ((3.0 * a3) + (-6.0 * a2) + 4.0); - w2 = (1.0 / 6.0) * ((-3.0 * a3) + (3.0 * a2) + (3.0 * a) + 1.0); - w3 = (1.0 / 6.0) * a3; - - values[i] = 1.0 - (w1 / (w0 + w1)) + a; - values[i + 1] = 1.0 + (w3 / (w2 + w3)) - a; - values[i + 2] = w0 + w1; - values[i + 3] = w2 + w3; - } - - glGenTextures (1, &bs->lTexture); - - glBindTexture (GL_TEXTURE_1D, bs->lTexture); - - glTexImage1D (GL_TEXTURE_1D, 0, format, 128, 0, GL_RGBA, - GL_FLOAT, values); - - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri (GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_REPEAT); - - glBindTexture (GL_TEXTURE_1D, 0); -} - -static Bool -BicubicInitDisplay (CompPlugin *p, - CompDisplay *d) -{ - BicubicDisplay *bd; - - if (!checkPluginABI ("core", CORE_ABIVERSION)) - return FALSE; - - bd = malloc (sizeof (BicubicDisplay)); - if (!bd) - return FALSE; - - bd->screenPrivateIndex = allocateScreenPrivateIndex(d); - if (bd->screenPrivateIndex < 0) - { - free (bd); - return FALSE; - } - - d->base.privates[BicubicDisplayPrivateIndex].ptr = bd; - - return TRUE; -} - -static void -BicubicFiniDisplay (CompPlugin *p, - CompDisplay *d) -{ - BICUBIC_DISPLAY (d); - - freeScreenPrivateIndex (d, bd->screenPrivateIndex); - - free (bd); -} - -static Bool -BicubicInitScreen (CompPlugin *p, - CompScreen *s) -{ - BicubicScreen *bs; - const char *glExtensions; - GLenum format = GL_RGBA16F_ARB; - - BICUBIC_DISPLAY (s->display); - - if (!s->fragmentProgram) - { - compLogMessage ("bicube", CompLogLevelFatal, - "GL_ARB_fragment_program not supported."); - return FALSE; - } - - glExtensions = (const char *) glGetString (GL_EXTENSIONS); - if (!glExtensions) - { - compLogMessage ("bicubic", CompLogLevelFatal, - "No valid GL extensions string found."); - return FALSE; - } - - if (!strstr (glExtensions, "GL_ARB_texture_float")) - { - compLogMessage ("bicubic", CompLogLevelFatal, - "GL_ARB_texture_float not supported. " - "This can lead to visual artifacts."); - format = GL_RGBA; - } - - bs = malloc (sizeof (BicubicScreen)); - if (!bs) - return FALSE; - - /* wrap overloaded functions */ - WRAP (bs, s, drawWindowTexture, BicubicDrawWindowTexture); - - s->base.privates[bd->screenPrivateIndex].ptr = bs; - - generateLookupTexture (s, format); - - bs->func = NULL; - - return TRUE; -} - -static void -BicubicFiniScreen (CompPlugin *p, - CompScreen *s) -{ - BicubicFunction *f, *f2; - - BICUBIC_SCREEN (s); - - UNWRAP (bs, s, drawWindowTexture); - - for (f = bs->func; f;) - { - destroyFragmentFunction (s, f->handle); - f2 = f; - f = f->next; - free (f2); - } - - glDeleteTextures (1, &bs->lTexture); - - free (bs); -} - -static Bool -BicubicInit (CompPlugin * p) -{ - - if (!compInitPluginMetadataFromInfo (&bicubicMetadata, p->vTable->name, - 0, 0, 0, 0)) - return FALSE; - - BicubicDisplayPrivateIndex = allocateDisplayPrivateIndex (); - if (BicubicDisplayPrivateIndex < 0) - { - compFiniMetadata (&bicubicMetadata); - return FALSE; - } - - compAddMetadataFromFile (&bicubicMetadata, p->vTable->name); - - return TRUE; -} - -static void -BicubicFini (CompPlugin * p) -{ - freeDisplayPrivateIndex (BicubicDisplayPrivateIndex); - compFiniMetadata (&bicubicMetadata); -} - -static CompBool -BicubicInitObject (CompPlugin *p, - CompObject *o) -{ - static InitPluginObjectProc dispTab[] = { - (InitPluginObjectProc) 0, - (InitPluginObjectProc) BicubicInitDisplay, - (InitPluginObjectProc) BicubicInitScreen - }; - - RETURN_DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), TRUE, (p, o)); -} - -static void -BicubicFiniObject (CompPlugin *p, - CompObject *o) -{ - static FiniPluginObjectProc dispTab[] = { - (FiniPluginObjectProc) 0, - (FiniPluginObjectProc) BicubicFiniDisplay, - (FiniPluginObjectProc) BicubicFiniScreen - }; - - DISPATCH (o, dispTab, ARRAY_SIZE (dispTab), (p, o)); -} - -CompPluginVTable BicubicVTable = { - "bicubic", - 0, - BicubicInit, - BicubicFini, - BicubicInitObject, - BicubicFiniObject, - 0, - 0, -}; - -CompPluginVTable* -getCompPluginInfo20070830 (void) -{ - return &BicubicVTable; -} - - diff --git a/bicubic.xml.in b/bicubic.xml.in index 48a9eff..d20eab1 100644 --- a/bicubic.xml.in +++ b/bicubic.xml.in @@ -1,8 +1,13 @@ <?xml version="1.0"?> <compiz> - <plugin name="bicubic"> + <plugin name="bicubic" useBcop="true"> <_short>Bicubic filter</_short> <_long>Bicubic texture filtering</_long> + <deps> + <requirement> + <plugin>opengl</plugin> + </requirement> + </deps> <category>Effects</category> <deps> <relation type="after"> diff --git a/plugin.info b/plugin.info deleted file mode 100644 index bb64abd..0000000 --- a/plugin.info +++ /dev/null @@ -1 +0,0 @@ -PLUGIN = bicubic |