From: Marten Richter Date: Wed, 3 Oct 2012 20:05:15 +0000 (+0200) Subject: Switch to OpenVG based OSD, note Teletext and Subtitle rendering not working and... X-Git-Url: https://git.vomp.tv/gitweb/?a=commitdiff_plain;h=419964cd6d85419684918774f4ddc420714f616a;p=vompclient-marten.git Switch to OpenVG based OSD, note Teletext and Subtitle rendering not working and little bugs in implementation --- diff --git a/GNUmakefile b/GNUmakefile index 81931d1..5b124af 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -55,13 +55,13 @@ endif ifeq ($(vomp_platform),raspberry) $(info Raspberry pi flags) -LDFLAGS = -Wall -LIBS = -L/opt/vc/lib -lpthread -lrt -lEGL -lGLESv2 -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil +LDFLAGS = -Wall -Wl,--format=binary -Wl,fonts/sourcesans.ttf -Wl,other/vdrhires.jpg -Wl,other/wallpaper720p.jpg -Wl,--format=default +LIBS = -L/opt/vc/lib -lpthread -lrt -lEGL -lOpenVG -lopenmaxil -lbcm_host -lavformat -lavcodec -lavutil -OBJECTS += main.o threadp.o osdopengl.o surfaceopengl.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o wjpegsimple.o remotelinux.o glshader.o glosdshader.o -LIBS+= -ljpeg +OBJECTS += main.o threadp.o osdvector.o surfacevector.o osdopenvg.o ledraspberry.o mtdraspberry.o videoomx.o audioomx.o wjpegsimple.o remotelinux.o +LIBS+= -lfreetype -lMagick++ -lMagickCore CROSSLIBS = -INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads +INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/usr/include/freetype2 -I/usr/include/ImageMagick CXXFLAGS_DEV += -D__STDC_CONSTANT_MACROS CXXFLAGS_REL += -D__STDC_CONSTANT_MACROS diff --git a/boxx.cc b/boxx.cc index 1e0935f..4645d60 100644 --- a/boxx.cc +++ b/boxx.cc @@ -244,8 +244,8 @@ void Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour) char line[256]; int lineHeight = getFontHeight() + paraVSpace; - int lineWidth; - int thisCharWidth; + float lineWidth; + float thisCharWidth; int textPos; int linePos; int ypos; @@ -261,42 +261,44 @@ void Boxx::drawPara(const char* text, int x, int y, const DrawStyle& colour) while(1) { printLine = 0; + unsigned int cur_length=1; + wchar_t cur_char=getWChar(text+textPos,&cur_length); - if (text[textPos] == '\0') break; + if (cur_char == '\0') break; - if (text[textPos] == '\n') + if (cur_char == '\n') { - textPos++; // ignore the \n + textPos+=cur_length; // ignore the \n printLine = 1; break; } - - thisCharWidth = charWidth(text[textPos]); + thisCharWidth = charWidth(cur_char); if ((lineWidth + thisCharWidth) > (int)(area.w - (2 * paraMargin))) { // this character would break the right margin - if (text[textPos] == ' ') + if (cur_char == ' ') { // this char is a space, ignore and break - textPos++; + textPos+=cur_length; break; } else { // Need to go back to the last space in the line - while ((text[textPos] != ' ') && (linePos >= 0)) + while ((cur_char != ' ') && (linePos >= 0)) { - textPos--; + textPos-=cur_length; + cur_char=getWChar(text+textPos,&cur_length); linePos--; } // Now take the space we just found - textPos++; + textPos+=cur_length; break; } } - line[linePos++] = text[textPos]; + for (int n=0;ncharWidth(c); else if (surface) return surface->getCharWidth(c); - else return 10; //? + else return 16.; //? +} + +wchar_t Boxx::getWChar(const char* str, unsigned int *length) +{ + if (parent) return parent->getWChar(str,length); + else if (surface) return surface->getWChar(str,length); + else return '?'; //? } Surface * Boxx::getSurface() { diff --git a/boxx.h b/boxx.h index a97c895..887d03d 100644 --- a/boxx.h +++ b/boxx.h @@ -117,7 +117,8 @@ class Boxx void startFastDraw(); void endFastDraw(); - int charWidth(char c); + float charWidth(wchar_t c); + wchar_t getWChar(const char* str, unsigned int *length); void add(Boxx*); // a boxx has a set of child boxxs void remove(Boxx*); diff --git a/defines.h b/defines.h index fc4f354..5358246 100644 --- a/defines.h +++ b/defines.h @@ -90,7 +90,7 @@ long long getTimeMS(); //lirc? #define Mtd_TYPE MtdRaspberry //this is device dependent #define Led_TYPE LedRaspberry //this is device dependent - #define Osd_TYPE OsdOpenGL // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices + #define Osd_TYPE OsdOpenVG // This OpenGL ES 2.0, in the moment only for raspberry, but might be splitted for other devices #define OsdStartDev "" #define Audio_TYPE AudioOMX // This is Audio based on OpenMax and libav for decoding #define Video_TYPE VideoOMX // This is Video based on OpenMax diff --git a/fonts/licence.txt b/fonts/licence.txt deleted file mode 100644 index 0c39824..0000000 --- a/fonts/licence.txt +++ /dev/null @@ -1,876 +0,0 @@ -The fonts were obtained from the debian package xfree86. -The copyright file from this package is included here. - - -Package: xfree86 -Obtained from: XFree86 CVS repository (anoncvs@anoncvs.xfree86.org:/cvs) -Upstream author(s): The XFree86 Project, Inc., et al. -Debian package author(s): Stephen Early, Mark Eichin, Branden Robinson - -Debian modifications to upstream sources: - - The following files were removed from the source package due to - non-DFSG-compliant licensing: - xc/fonts/scaled/Type1/COPYRIGHT.BH - xc/fonts/scaled/Type1/COPYRIGHT.IBM - xc/fonts/scaled/Type1/UTBI____.afm - xc/fonts/scaled/Type1/UTBI____.pfa - xc/fonts/scaled/Type1/UTB_____.afm - xc/fonts/scaled/Type1/UTB_____.pfa - xc/fonts/scaled/Type1/UTI_____.afm - xc/fonts/scaled/Type1/UTI_____.pfa - xc/fonts/scaled/Type1/UTRG____.afm - xc/fonts/scaled/Type1/UTRG____.pfa - xc/fonts/scaled/Type1/cour.afm - xc/fonts/scaled/Type1/cour.pfa - xc/fonts/scaled/Type1/courb.afm - xc/fonts/scaled/Type1/courb.pfa - xc/fonts/scaled/Type1/courbi.afm - xc/fonts/scaled/Type1/courbi.pfa - xc/fonts/scaled/Type1/couri.afm - xc/fonts/scaled/Type1/couri.pfa - xc/fonts/scaled/Type1/lcdxmo.afm - xc/fonts/scaled/Type1/lcdxmo.pfa - xc/fonts/scaled/Type1/lcdxmr.afm - xc/fonts/scaled/Type1/lcdxmr.pfa - xc/fonts/scaled/Type1/lcdxro.afm - xc/fonts/scaled/Type1/lcdxro.pfa - xc/fonts/scaled/Type1/lcdxrr.afm - xc/fonts/scaled/Type1/lcdxrr.pfa - xc/fonts/scaled/Type1/lcdxso.afm - xc/fonts/scaled/Type1/lcdxso.pfa - xc/fonts/scaled/Type1/lcdxsr.afm - xc/fonts/scaled/Type1/lcdxsr.pfa - - See the debian/patches directory for all other changes to upstream - source. - -Debian copyright(s)/license(s): - -Unless otherwise noted, all modifications and additions to XFree86 found in -this Debian package bear the following copyright and license terms: - -Copyright 1996-2001 Software in the Public Interest, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Software in the Public -Interest, Inc. shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization from Software in the Public Interest, Inc. - -Upstream copyright(s)/license(s): - -******************************************************************************** - -1. XFree86 License - -XFree86 code without an explicit copyright is covered by the following copy- -right/license: - -Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- -NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the XFree86 Project shall not -be used in advertising or otherwise to promote the sale, use or other deal- -ings in this Software without prior written authorization from the XFree86 -Project. - -2. Other Licenses - -Portions of code are covered by the following licenses/copyrights: - -2.1 X Consortium - -Copyright (C) 1996 X Consortium - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X -CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the X Consortium shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from the X Consortium. - -X Window System is a trademark of X Consortium, Inc. - -2.2 Berkeley-based copyrights: - -2.2.1 General - -Redistribution and use in source and binary forms, with or without modifica- -tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- -CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- -CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- -ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED -OF THE POSSIBILITY OF SUCH DAMAGE. - -2.2.2 UCB/LBL - -Copyright (c) 1993 The Regents of the University of California. All rights -reserved. - -This software was developed by the Computer Systems Engineering group at -Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to -Berkeley. - -All advertising materials mentioning features or use of this software must -display the following acknowledgement: This product includes software devel- -oped by the University of California, Lawrence Berkeley Laboratory. - -Redistribution and use in source and binary forms, with or without modifica- -tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: This product includes soft- - ware developed by the University of California, Berkeley and its con- - tributors. - - 4. Neither the name of the University nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS- -CLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -2.3 NVIDIA Corp - -Copyright (c) 1996 NVIDIA, Corp. All rights reserved. - -NOTICE TO USER: The source code is copyrighted under U.S. and international -laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as -design patents pending on the design and interface of the NV chips. Users -and possessors of this source code are hereby granted a nonexclusive, roy- -alty-free copyright and design patent license to use this code in individual -and commercial software. - -Any use of this source code must include, in the user documentation and -internal comments to the code, notices to the end user as follows: - -Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. -and foreign countries. - -NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE -CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WAR- -RANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE -FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAM- -AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. - -2.4 GLX Public License - -GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License") - -Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby -grants permission to Recipient (defined below), under Recipient's copyrights -in the Original Software (defined below), to use, copy, modify, merge, pub- -lish, distribute, sublicense and/or sell copies of Subject Software (defined -below), and to permit persons to whom the Subject Software is furnished in -accordance with this License to do the same, subject to all of the following -terms and conditions, which Recipient accepts by engaging in any such use, -copying, modifying, merging, publishing, distributing, sublicensing or sell- -ing: - -1. Definitions. - - (a) "Original Software" means source code of computer software code - which is described in Exhibit A as Original Software. - - (b) "Modifications" means any addition to or deletion from the sub- - stance or structure of either the Original Software or any previous - Modifications. When Subject Software is released as a series of - files, a Modification means (i) any addition to or deletion from - the contents of a file containing Original Software or previous - Modifications and (ii) any new file that contains any part of the - Original Code or previous Modifications. - - (c) "Subject Software" means the Original Software or Modifications - or the combination of the Original Software and Modifications, or - portions of any of the foregoing. - - (d) "Recipient" means an individual or a legal entity exercising - rights under, and complying with all of the terms of, this License. - For legal entities, "Recipient" includes any entity which controls, - is controlled by, or is under common control with Recipient. For - purposes of this definition, "control" of an entity means (a) the - power, direct or indirect, to direct or manage such entity, or (b) - ownership of fifty percent (50%) or more of the outstanding shares - or beneficial ownership of such entity. - -2. Redistribution of Source Code Subject to These Terms. Redistributions of -Subject Software in source code form must retain the notice set forth in -Exhibit A, below, in every file. A copy of this License must be included in -any documentation for such Subject Software where the recipients' rights -relating to Subject Software are described. Recipient may distribute the -source code version of Subject Software under a license of Recipient's -choice, which may contain terms different from this License, provided that -(i) Recipient is in compliance with the terms of this License, and (ii) the -license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 -of this License, which terms may not be modified or superseded by any other -terms of such license. If Recipient distributes the source code version under -a different license Recipient must make it absolutely clear that any terms -which differ from this License are offered by Recipient alone, not by SGI. -Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as -a result of any such terms Recipient offers. - -3. Redistribution in Executable Form. The notice set forth in Exhibit A must -be conspicuously included in any notice in an executable version of Subject -Software, related documentation or collateral in which Recipient describes -the user's rights relating to the Subject Software. Recipient may distribute -the executable version of Subject Software under a license of Recipient's -choice, which may contain terms different from this License, provided that -(i) Recipient is in compliance with the terms of this License, and (ii) the -license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of -this License, which terms may not be modified or superseded by any other -terms of such license. If Recipient distributes the executable version under -a different license Recipient must make it absolutely clear that any terms -which differ from this License are offered by Recipient alone, not by SGI. -Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as -a result of any such terms Recipient offers. - -4. Termination. This License and the rights granted hereunder will terminate -automatically if Recipient fails to comply with terms herein and fails to -cure such breach within 30 days of the breach. Any sublicense to the Subject -Software which is properly granted shall survive any termination of this -License absent termination by the terms of such sublicense. Provisions which, -by their nature, must remain in effect beyond the termination of this License -shall survive. - -5. No Trademark Rights. This License does not grant any rights to use any -trade name, trademark or service mark whatsoever. No trade name, trademark or -service mark of SGI may be used to endorse or promote products derived from -the Subject Software without prior written permission of SGI. - -6. No Other Rights. This License does not grant any rights with respect to -the OpenGL API or to any software or hardware implementation thereof or to -any other software whatsoever, nor shall any other rights or licenses not -expressly granted hereunder arise by implication, estoppel or otherwise with -respect to the Subject Software. Title to and ownership of the Original Soft- -ware at all times remains with SGI. All rights in the Original Software not -expressly granted under this License are reserved. - -7. Compliance with Laws; Non-Infringement. Recipient shall comply with all -applicable laws and regulations in connection with use and distribution of -the Subject Software, including but not limited to, all export and import -control laws and regulations of the U.S. government and other countries. -Recipient may not distribute Subject Software that (i) in any way infringes -(directly or contributorily) the rights (including patent, copyright, trade -secret, trademark or other intellectual property rights of any kind) of any -other person or entity or (ii) breaches any representation or warranty, -express, implied or statutory, which under any applicable law it might be -deemed to have been distributed. - -8. Claims of Infringement. If Recipient at any time has knowledge of any one -or more third party claims that reproduction, modification, use, distribu- -tion, import or sale of Subject Software (including particular functionality -or code incorporated in Subject Software) infringes the third party's intel- -lectual property rights, Recipient must place in a well-identified web page -bearing the title "LEGAL" a description of each such claim and a description -of the party making each such claim in sufficient detail that a user of the -Subject Software will know whom to contact regarding the claim. Also, upon -gaining such knowledge of any such claim, Recipient must conspicuously -include the URL for such web page in the Exhibit A notice required under Sec- -tions 2 and 3, above, and in the text of any related documentation, license -agreement or collateral in which Recipient describes end user's rights relat- -ing to the Subject Software. If Recipient obtains such knowledge after it -makes Subject Software available to any other person or entity, Recipient -shall take other steps (such as notifying appropriate mailing lists or news- -groups) reasonably calculated to inform those who received the Subject Soft- -ware that new knowledge has been obtained. - -9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- -CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO -RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE -PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- -VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN -ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED -HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THE- -ORY, WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIA- -BILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR -ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY -CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK -STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER -COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF -THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY -TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO -THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO -NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, -SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT. - -11. Indemnity. Recipient shall be solely responsible for damages arising, -directly or indirectly, out of its utilization of rights under this License. -Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. -from and against any loss, liability, damages, costs or expenses (including -the payment of reasonable attorneys fees) arising out of Recipient's use, -modification, reproduction and distribution of the Subject Software or out of -any representation or warranty made by Recipient. - -12. U.S. Government End Users. The Subject Software is a "commercial item" -consisting of "commercial computer software" as such terms are defined in -title 48 of the Code of Federal Regulations and all U.S. Government End -Users acquire only the rights set forth in this License and are subject to -the terms of this License. - -13. Miscellaneous. This License represents the complete agreement concerning -subject matter hereof. If any provision of this License is held to be unen- -forceable, such provision shall be reformed so as to achieve as nearly as -possible the same economic effect as the original provision and the remainder -of this License will remain in effect. This License shall be governed by and -construed in accordance with the laws of the United States and the State of -California as applied to agreements entered into and to be performed entirely -within California between California residents. Any litigation relating to -this License shall be subject to the exclusive jurisdiction of the Federal -Courts of the Northern District of California (or, absent subject matter -jurisdiction in such courts, the courts of the State of California), with -venue lying exclusively in Santa Clara County, California, with the losing -party responsible for costs, including without limitation, court costs and -reasonable attorneys fees and expenses. The application of the United Nations -Convention on Contracts for the International Sale of Goods is expressly -excluded. Any law or regulation which provides that the language of a con- -tract shall be construed against the drafter shall not apply to this License. - -Exhibit A - -The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and -13 of the GLX Public License Version 1.0 (the "License"). You may not use -this file except in compliance with those sections of the License. You may -obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services, -2011 N. Shoreline Blvd., Mountain View, CA 94043 or at -http://www.sgi.com/software/opensource/glx/license.html. - -Software distributed under the License is distributed on an "AS IS" basis. -ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED -WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- -INFRINGEMENT. See the License for the specific language governing rights and -limitations under the License. - -The Original Software is GLX version 1.2 source code, released February, -1999. The developer of the Original Software is Silicon Graphics, Inc. Those -portions of the Subject Software created by Silicon Graphics, Inc. are Copy- -right (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. - -2.5 CID Font Code Public License - -CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License") - -Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI") -hereby grants permission to Recipient (defined below), under SGI's copyrights -in the Original Software (defined below), to use, copy, modify, merge, pub- -lish, distribute, sublicense and/or sell copies of Subject Software (defined -below) in both source code and executable form, and to permit persons to whom -the Subject Software is furnished in accordance with this License to do the -same, subject to all of the following terms and conditions, which Recipient -accepts by engaging in any such use, copying, modifying, merging, publica- -tion, distributing, sublicensing or selling: - -1. Definitions. - - a. "Original Software" means source code of computer software code - that is described in Exhibit A as Original Software. - - b. "Modifications" means any addition to or deletion from the sub- - stance or structure of either the Original Software or any previous - Modifications. When Subject Software is released as a series of - files, a Modification means (i) any addition to or deletion from - the contents of a file containing Original Software or previous - Modifications and (ii) any new file that contains any part of the - Original Code or previous Modifications. - - c. "Subject Software" means the Original Software or Modifications - or the combination of the Original Software and Modifications, or - portions of any of the foregoing. - - d. "Recipient" means an individual or a legal entity exercising - rights under the terms of this License. For legal entities, "Recip- - ient" includes any entity that controls, is controlled by, or is - under common control with Recipient. For purposes of this defini- - tion, "control" of an entity means (i) the power, direct or indi- - rect, to direct or manage such entity, or (ii) ownership of fifty - percent (50%) or more of the outstanding shares or beneficial own- - ership of such entity. - - e. "Required Notice" means the notice set forth in Exhibit A to - this License. - - f. "Accompanying Technology" means any software or other technology - that is not a Modification and that is distributed or made publicly - available by Recipient with the Subject Software. Separate soft- - ware files that do not contain any Original Software or any previ- - ous Modification shall not be deemed a Modification, even if such - software files are aggregated as part of a product, or in any - medium of storage, with any file that does contain Original Soft- - ware or any previous Modification. - -2. License Terms. All distribution of the Subject Software must be made sub- -ject to the terms of this License. A copy of this License and the Required -Notice must be included in any documentation for Subject Software where -Recipient's rights relating to Subject Software and/or any Accompanying Tech- -nology are described. Distributions of Subject Software in source code form -must also include the Required Notice in every file distributed. In addition, -a ReadMe file entitled "Important Legal Notice" must be distributed with each -distribution of one or more files that incorporate Subject Software. That -file must be included with distributions made in both source code and exe- -cutable form. A copy of the License and the Required Notice must be included -in that file. Recipient may distribute Accompanying Technology under a -license of Recipient's choice, which may contain terms different from this -License, provided that (i) Recipient is in compliance with the terms of this -License, (ii) such other license terms do not modify or supersede the terms -of this License as applicable to the Subject Software, (iii) Recipient hereby -indemnifies SGI for any liability incurred by SGI as a result of the distri- -bution of Accompanying Technology or the use of other license terms. - -3. Termination. This License and the rights granted hereunder will terminate -automatically if Recipient fails to comply with terms herein and fails to -cure such breach within 30 days of the breach. Any sublicense to the Subject -Software that is properly granted shall survive any termination of this -License absent termination by the terms of such sublicense. Provisions which, -by their nature, must remain in effect beyond the termination of this License -shall survive. - -4. Trademark Rights. This License does not grant any rights to use any trade -name, trademark or service mark whatsoever. No trade name, trademark or ser- -vice mark of SGI may be used to endorse or promote products derived from or -incorporating any Subject Software without prior written permission of SGI. - -5. No Other Rights. No rights or licenses not expressly granted hereunder -shall arise by implication, estoppel or otherwise. Title to and ownership of -the Original Software at all times remains with SGI. All rights in the Origi- -nal Software not expressly granted under this License are reserved. - -6. Compliance with Laws; Non-Infringement. Recipient shall comply with all -applicable laws and regulations in connection with use and distribution of -the Subject Software, including but not limited to, all export and import -control laws and regulations of the U.S. government and other countries. -Recipient may not distribute Subject Software that (i) in any way infringes -(directly or contributorily) the rights (including patent, copyright, trade -secret, trademark or other intellectual property rights of any kind) of any -other person or entity, or (ii) breaches any representation or warranty, -express, implied or statutory, which under any applicable law it might be -deemed to have been distributed. - -7. Claims of Infringement. If Recipient at any time has knowledge of any one -or more third party claims that reproduction, modification, use, distribu- -tion, import or sale of Subject Software (including particular functionality -or code incorporated in Subject Software) infringes the third party's intel- -lectual property rights, Recipient must place in a well-identified web page -bearing the title "LEGAL" a description of each such claim and a description -of the party making each such claim in sufficient detail that a user of the -Subject Software will know whom to contact regarding the claim. Also, upon -gaining such knowledge of any such claim, Recipient must conspicuously -include the URL for such web page in the Required Notice, and in the text of -any related documentation, license agreement or collateral in which Recipient -describes end user's rights relating to the Subject Software. If Recipient -obtains such knowledge after it makes Subject Software available to any other -person or entity, Recipient shall take other steps (such as notifying appro- -priate mailing lists or newsgroups) reasonably calculated to provide such -knowledge to those who received the Subject Software. - -8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, -WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT -LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- -CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO -RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE -PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- -VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN -ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED -HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, -WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY), -CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR -THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT -ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND -LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED. - -10. Indemnity. Recipient shall be solely responsible for damages arising, -directly or indirectly, out of its utilization of rights under this License. -Recipient will defend, indemnify and hold SGI and its successors and assigns -harmless from and against any loss, liability, damages, costs or expenses -(including the payment of reasonable attorneys fees) arising out of (Recipi- -ent's use, modification, reproduction and distribution of the Subject Soft- -ware or out of any representation or warranty made by Recipient. - -11. U.S. Government End Users. The Subject Software is a "commercial item" -consisting of "commercial computer software" as such terms are defined in -title 48 of the Code of Federal Regulations and all U.S. Government End Users -acquire only the rights set forth in this License and are subject to the -terms of this License. - -12. Miscellaneous. This License represents the complete agreement concerning -subject matter hereof. If any provision of this License is held to be unen- -forceable by any judicial or administrative authority having proper jurisdic- -tion with respect thereto, such provision shall be reformed so as to achieve -as nearly as possible the same economic effect as the original provision and -the remainder of this License will remain in effect. This License shall be -governed by and construed in accordance with the laws of the United States -and the State of California as applied to agreements entered into and to be -performed entirely within California between California residents. Any liti- -gation relating to this License shall be subject to the exclusive jurisdic- -tion of the Federal Courts of the Northern District of California (or, absent -subject matter jurisdiction in such courts, the courts of the State of Cali- -fornia), with venue lying exclusively in Santa Clara County, California, with -the losing party responsible for costs, including without limitation, court -costs and reasonable attorneys fees and expenses. The application of the -United Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation that provides that the language of -a contract shall be construed against the drafter shall not apply to this -License. - -Exhibit A - -Copyright (c) 1994-1999 Silicon Graphics, Inc. - -The contents of this file are subject to the CID Font Code Public License -Version 1.0 (the "License"). You may not use this file except in compliance -with the License. You may obtain a copy of the License at Silicon Graphics, -Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 -or at http://www.sgi.com/software/opensource/cid/license.html - -Software distributed under the License is distributed on an "AS IS" basis. -ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED -WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- -INFRINGEMENT. See the License for the specific language governing rights and -limitations under the License. - -The Original Software (as defined in the License) is CID font code that was -developed by Silicon Graphics, Inc. Those portions of the Subject Software -(as defined in the License) that were created by Silicon Graphics, Inc. are -Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved. - -[NOTE: When using this text in connection with Subject Software delivered -solely in object code form, Recipient may replace the words "this file" with -"this software" in both the first and second sentences.] - -Additional copyright(s)/license(s): - -******************************************************************************** - -SGI FREE SOFTWARE LICENSE B (Version 1.1 [02/22/2000]) - -1. Definitions. - -1.1. "Additional Notice Provisions" means such additional provisions as -appear in the Notice in Original Code under the heading "Additional Notice -Provisions." -1.2. "Covered Code" means the Original Code or Modifications, or any -combination thereof. -1.3. "Hardware" means any physical device that accepts input, processes -input, stores the results of processing, and/or provides output. -1.4. "Larger Work" means a work that combines Covered Code or portions -thereof with code not governed by the terms of this License. -1.5. "Licensable" means having the right to grant, to the maximum extent -possible, whether at the time of the initial grant or subsequently -acquired, any and all of the rights conveyed herein. -1.6. "License" means this document. -1.7. "Licensed Patents" means patent claims Licensable by SGI that are -infringed by the use or sale of Original Code or any Modifications provided -by SGI, or any combination thereof. -1.8. "Modifications" means any addition to or deletion from the substance -or structure of the Original Code or any previous Modifications. When -Covered Code is released as a series of files, a Modification is: - A. Any addition to the contents of a file containing Original Code and/or - addition to or deletion from the contents of a file containing previous - Modifications. - B. Any new file that contains any part of the Original Code or previous - Modifications. -1.9. "Notice" means any notice in Original Code or Covered Code, as -required by and in compliance with this License. -1.10. "Original Code" means source code of computer software code that is -described in the source code Notice required by Exhibit A as Original Code, -and updates and error corrections specifically thereto. -1.11. "Recipient" means an individual or a legal entity exercising rights -under, and complying with all of the terms of, this License or a future -version of this License issued under Section 8. For legal entities, -"Recipient" includes any entity that controls, is controlled by, or is -under common control with Recipient. For purposes of this definition, -"control" of an entity means (a) the power, direct or indirect, to direct -or manage such entity, or (b) ownership of fifty percent (50%) or more of -the outstanding shares or beneficial ownership of such entity. -1.12. "Recipient Patents" means patent claims Licensable by a Recipient -that are infringed by the use or sale of Original Code or any Modifications -provided by SGI, or any combination thereof. -1.13. "SGI" means Silicon Graphics, Inc. -1.14. "SGI Patents" means patent claims Licensable by SGI other than the -Licensed Patents. - -2. License Grant and Restrictions. - -2.1. SGI License Grant. Subject to the terms of this License and any third -party intellectual property claims, for the duration of intellectual -property protections inherent in the Original Code, SGI hereby grants -Recipient a worldwide, royalty­free, non­exclusive license, to do the -following: (i) under copyrights Licensable by SGI, to reproduce, -distribute, create derivative works from, and, to the extent applicable, -display and perform the Original Code and/or any Modifications provided by -SGI alone and/or as part of a Larger Work; and (ii) under any Licensable -Patents, to make, have made, use, sell, offer for sale, import and/or -otherwise transfer the Original Code and/or any Modifications provided by -SGI. Recipient accepts the terms and conditions of this License by -undertaking any of the aforementioned actions. The patent license shall -apply to the Covered Code if, at the time any related Modification is -added, such addition of the Modification causes such combination to be -covered by the Licensed Patents. The patent license in Section 2.1(ii) -shall not apply to any other combinations that include the Modification. -No patent license is provided under SGI Patents for infringements of SGI -Patents by Modifications not provided by SGI or combinations of Original -Code and Modifications not provided by SGI. - -2.2. Recipient License Grant. Subject to the terms of this License and any -third party intellectual property claims, Recipient hereby grants SGI and -any other Recipients a worldwide, royalty­free, non­exclusive license, -under any Recipient Patents, to make, have made, use, sell, offer for sale, -import and/or otherwise transfer the Original Code and/or any Modifications -provided by SGI. - -2.3. No License For Hardware Implementations. The licenses granted in -Section 2.1 and 2.2 are not applicable to implementation in Hardware of the -algorithms embodied in the Original Code or any Modifications provided by -SGI . - -3. Redistributions. - -3.1. Retention of Notice/Copy of License. The Notice set forth in Exhibit -A, below, must be conspicuously retained or included in any and all -redistributions of Covered Code. For distributions of the Covered Code in -source code form, the Notice must appear in every file that can include a -text comments field; in executable form, the Notice and a copy of this -License must appear in related documentation or collateral where the -Recipient's rights relating to Covered Code are described. Any Additional -Notice Provisions which actually appears in the Original Code must also be -retained or included in any and all redistributions of Covered Code. - -3.2. Alternative License. Provided that Recipient is in compliance with the -terms of this License, Recipient may, so long as without derogation of any -of SGI's rights in and to the Original Code, distribute the source code -and/or executable version(s) of Covered Code under (1) this License; (2) a -license identical to this License but for only such changes as are -necessary in order to clarify Recipient's role as licensor of -Modifications; and/or (3) a license of Recipient's choosing, containing -terms different from this License, provided that the license terms include -this Section 3 and Sections 4, 6, 7, 10, 12, and 13, which terms may not be -modified or superseded by any other terms of such license. If Recipient -elects to use any license other than this License, Recipient must make it -absolutely clear that any of its terms which differ from this License are -offered by Recipient alone, and not by SGI. It is emphasized that this -License is a limited license, and, regardless of the license form employed -by Recipient in accordance with this Section 3.2, Recipient may relicense -only such rights, in Original Code and Modifications by SGI, as it has -actually been granted by SGI in this License. - -3.3. Indemnity. Recipient hereby agrees to indemnify SGI for any liability -incurred by SGI as a result of any such alternative license terms Recipient -offers. - -4. Termination. This License and the rights granted hereunder will -terminate automatically if Recipient breaches any term herein and fails to -cure such breach within 30 days thereof. Any sublicense to the Covered Code -that is properly granted shall survive any termination of this License, -absent termination by the terms of such sublicense. Provisions that, by -their nature, must remain in effect beyond the termination of this License, -shall survive. - -5. No Trademark Or Other Rights. This License does not grant any rights to: -(i) any software apart from the Covered Code, nor shall any other rights or -licenses not expressly granted hereunder arise by implication, estoppel or -otherwise with respect to the Covered Code; (ii) any trade name, trademark -or service mark whatsoever, including without limitation any related right -for purposes of endorsement or promotion of products derived from the -Covered Code, without prior written permission of SGI; or (iii) any title -to or ownership of the Original Code, which shall at all times remains with -SGI. All rights in the Original Code not expressly granted under this -License are reserved. - -6. Compliance with Laws; Non­Infringement. There are various worldwide -laws, regulations, and executive orders applicable to dispositions of -Covered Code, including without limitation export, re­export, and import -control laws, regulations, and executive orders, of the U.S. government and -other countries, and Recipient is reminded it is obliged to obey such laws, -regulations, and executive orders. Recipient may not distribute Covered -Code that (i) in any way infringes (directly or contributorily) any -intellectual property rights of any kind of any other person or entity or -(ii) breaches any representation or warranty, express, implied or -statutory, to which, under any applicable law, it might be deemed to have -been subject. - -7. Claims of Infringement. If Recipient learns of any third party claim -that any disposition of Covered Code and/or functionality wholly or -partially infringes the third party's intellectual property rights, -Recipient will promptly notify SGI of such claim. - -8. Versions of the License. SGI may publish revised and/or new versions of -the License from time to time, each with a distinguishing version number. -Once Covered Code has been published under a particular version of the -License, Recipient may, for the duration of the license, continue to use it -under the terms of that version, or choose to use such Covered Code under -the terms of any subsequent version published by SGI. Subject to the -provisions of Sections 3 and 4 of this License, only SGI may modify the -terms applicable to Covered Code created under this License. - -9. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED "AS IS." ALL EXPRESS -AND IMPLIED WARRANTIES AND CONDITIONS ARE DISCLAIMED, INCLUDING, WITHOUT -LIMITATION, ANY IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, -SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, AND -NON­INFRINGEMENT. SGI ASSUMES NO RISK AS TO THE QUALITY AND PERFORMANCE OF -THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, SGI -ASSUMES NO COST OR LIABILITY FOR SERVICING, REPAIR OR CORRECTION. THIS -DISCLAIMER OF WARRANTY IS AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY -COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT SUBJECT TO THIS DISCLAIMER. - -10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES NOR LEGAL THEORY, -WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT -LIABILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE -FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF -ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, -WORK STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND -ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN -INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY -SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM -SGI's NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. -SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL -OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO -RECIPIENT. - -11. Indemnity. Recipient shall be solely responsible for damages arising, -directly or indirectly, out of its utilization of rights under this -License. Recipient will defend, indemnify and hold harmless Silicon -Graphics, Inc. from and against any loss, liability, damages, costs or -expenses (including the payment of reasonable attorneys fees) arising out -of Recipient's use, modification, reproduction and distribution of the -Covered Code or out of any representation or warranty made by Recipient. - -12. U.S. Government End Users. The Covered Code is a "commercial item" -consisting of "commercial computer software" as such terms are defined in -title 48 of the Code of Federal Regulations and all U.S. Government End -Users acquire only the rights set forth in this License and are subject to -the terms of this License. - -13. Miscellaneous. This License represents the complete agreement -concerning the its subject matter. If any provision of this License is held -to be unenforceable, such provision shall be reformed so as to achieve as -nearly as possible the same legal and economic effect as the original -provision and the remainder of this License will remain in effect. This -License shall be governed by and construed in accordance with the laws of -the United States and the State of California as applied to agreements -entered into and to be performed entirely within California between -California residents. Any litigation relating to this License shall be -subject to the exclusive jurisdiction of the Federal Courts of the Northern -District of California (or, absent subject matter jurisdiction in such -courts, the courts of the State of California), with venue lying -exclusively in Santa Clara County, California, with the losing party -responsible for costs, including without limitation, court costs and -reasonable attorneys fees and expenses. The application of the United -Nations Convention on Contracts for the International Sale of Goods is -expressly excluded. Any law or regulation that provides that the language -of a contract shall be construed against the drafter shall not apply to -this License. - -Exhibit A License Applicability. - -Except to the extent portions of this file are made subject to an -alternative license as permitted in the SGI Free Software License B, -Version 1.1 (the "License"), the contents of this file are subject only to -the provisions of the License. You may not use this file except in -compliance with the License. You may obtain a copy of the License at -Silicon Graphics, Inc., attn: Legal Services, 1600 Amphitheatre Parkway, -Mountain View, CA 94043­1351, or at: http://oss.sgi.com/projects/FreeB Note -that, as provided in the License, the Software is distributed on an "AS IS" -basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS DISCLAIMED, -INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND CONDITIONS OF -MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, -AND NON­INFRINGEMENT. Original Code. The Original Code is: [name of -software, version number, and release date], developed by Silicon Graphics, -Inc. The Original Code is Copyright (c) [dates of first publication, as -appearing in the Notice in the Original Code] Silicon Graphics, Inc. -Copyright in any portions created by third parties is as indicated -elsewhere herein. All Rights Reserved. - -Additional Notice Provisions: - -[such additional provisions, if any, as appear in the Notice in the -Original Code under the heading "Additional Notice Provisions"] diff --git a/fonts/licensehelv.txt b/fonts/licensehelv.txt new file mode 100644 index 0000000..0c39824 --- /dev/null +++ b/fonts/licensehelv.txt @@ -0,0 +1,876 @@ +The fonts were obtained from the debian package xfree86. +The copyright file from this package is included here. + + +Package: xfree86 +Obtained from: XFree86 CVS repository (anoncvs@anoncvs.xfree86.org:/cvs) +Upstream author(s): The XFree86 Project, Inc., et al. +Debian package author(s): Stephen Early, Mark Eichin, Branden Robinson + +Debian modifications to upstream sources: + + The following files were removed from the source package due to + non-DFSG-compliant licensing: + xc/fonts/scaled/Type1/COPYRIGHT.BH + xc/fonts/scaled/Type1/COPYRIGHT.IBM + xc/fonts/scaled/Type1/UTBI____.afm + xc/fonts/scaled/Type1/UTBI____.pfa + xc/fonts/scaled/Type1/UTB_____.afm + xc/fonts/scaled/Type1/UTB_____.pfa + xc/fonts/scaled/Type1/UTI_____.afm + xc/fonts/scaled/Type1/UTI_____.pfa + xc/fonts/scaled/Type1/UTRG____.afm + xc/fonts/scaled/Type1/UTRG____.pfa + xc/fonts/scaled/Type1/cour.afm + xc/fonts/scaled/Type1/cour.pfa + xc/fonts/scaled/Type1/courb.afm + xc/fonts/scaled/Type1/courb.pfa + xc/fonts/scaled/Type1/courbi.afm + xc/fonts/scaled/Type1/courbi.pfa + xc/fonts/scaled/Type1/couri.afm + xc/fonts/scaled/Type1/couri.pfa + xc/fonts/scaled/Type1/lcdxmo.afm + xc/fonts/scaled/Type1/lcdxmo.pfa + xc/fonts/scaled/Type1/lcdxmr.afm + xc/fonts/scaled/Type1/lcdxmr.pfa + xc/fonts/scaled/Type1/lcdxro.afm + xc/fonts/scaled/Type1/lcdxro.pfa + xc/fonts/scaled/Type1/lcdxrr.afm + xc/fonts/scaled/Type1/lcdxrr.pfa + xc/fonts/scaled/Type1/lcdxso.afm + xc/fonts/scaled/Type1/lcdxso.pfa + xc/fonts/scaled/Type1/lcdxsr.afm + xc/fonts/scaled/Type1/lcdxsr.pfa + + See the debian/patches directory for all other changes to upstream + source. + +Debian copyright(s)/license(s): + +Unless otherwise noted, all modifications and additions to XFree86 found in +this Debian package bear the following copyright and license terms: + +Copyright 1996-2001 Software in the Public Interest, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of Software in the Public +Interest, Inc. shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from Software in the Public Interest, Inc. + +Upstream copyright(s)/license(s): + +******************************************************************************** + +1. XFree86 License + +XFree86 code without an explicit copyright is covered by the following copy- +right/license: + +Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- +NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the XFree86 Project shall not +be used in advertising or otherwise to promote the sale, use or other deal- +ings in this Software without prior written authorization from the XFree86 +Project. + +2. Other Licenses + +Portions of code are covered by the following licenses/copyrights: + +2.1 X Consortium + +Copyright (C) 1996 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X +CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +X Window System is a trademark of X Consortium, Inc. + +2.2 Berkeley-based copyrights: + +2.2.1 General + +Redistribution and use in source and binary forms, with or without modifica- +tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- +CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- +CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- +ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +2.2.2 UCB/LBL + +Copyright (c) 1993 The Regents of the University of California. All rights +reserved. + +This software was developed by the Computer Systems Engineering group at +Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and contributed to +Berkeley. + +All advertising materials mentioning features or use of this software must +display the following acknowledgement: This product includes software devel- +oped by the University of California, Lawrence Berkeley Laboratory. + +Redistribution and use in source and binary forms, with or without modifica- +tion, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: This product includes soft- + ware developed by the University of California, Berkeley and its con- + tributors. + + 4. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DIS- +CLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +2.3 NVIDIA Corp + +Copyright (c) 1996 NVIDIA, Corp. All rights reserved. + +NOTICE TO USER: The source code is copyrighted under U.S. and international +laws. NVIDIA, Corp. of Sunnyvale, California owns the copyright and as +design patents pending on the design and interface of the NV chips. Users +and possessors of this source code are hereby granted a nonexclusive, roy- +alty-free copyright and design patent license to use this code in individual +and commercial software. + +Any use of this source code must include, in the user documentation and +internal comments to the code, notices to the end user as follows: + +Copyright (c) 1996 NVIDIA, Corp. NVIDIA design patents pending in the U.S. +and foreign countries. + +NVIDIA, CORP. MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE +CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WAR- +RANTY OF ANY KIND. NVIDIA, CORP. DISCLAIMS ALL WARRANTIES WITH REGARD TO +THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA, CORP. BE LIABLE +FOR ANY SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAM- +AGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. + +2.4 GLX Public License + +GLX PUBLIC LICENSE (Version 1.0 (2/11/99)) ("License") + +Subject to any third party claims, Silicon Graphics, Inc. ("SGI") hereby +grants permission to Recipient (defined below), under Recipient's copyrights +in the Original Software (defined below), to use, copy, modify, merge, pub- +lish, distribute, sublicense and/or sell copies of Subject Software (defined +below), and to permit persons to whom the Subject Software is furnished in +accordance with this License to do the same, subject to all of the following +terms and conditions, which Recipient accepts by engaging in any such use, +copying, modifying, merging, publishing, distributing, sublicensing or sell- +ing: + +1. Definitions. + + (a) "Original Software" means source code of computer software code + which is described in Exhibit A as Original Software. + + (b) "Modifications" means any addition to or deletion from the sub- + stance or structure of either the Original Software or any previous + Modifications. When Subject Software is released as a series of + files, a Modification means (i) any addition to or deletion from + the contents of a file containing Original Software or previous + Modifications and (ii) any new file that contains any part of the + Original Code or previous Modifications. + + (c) "Subject Software" means the Original Software or Modifications + or the combination of the Original Software and Modifications, or + portions of any of the foregoing. + + (d) "Recipient" means an individual or a legal entity exercising + rights under, and complying with all of the terms of, this License. + For legal entities, "Recipient" includes any entity which controls, + is controlled by, or is under common control with Recipient. For + purposes of this definition, "control" of an entity means (a) the + power, direct or indirect, to direct or manage such entity, or (b) + ownership of fifty percent (50%) or more of the outstanding shares + or beneficial ownership of such entity. + +2. Redistribution of Source Code Subject to These Terms. Redistributions of +Subject Software in source code form must retain the notice set forth in +Exhibit A, below, in every file. A copy of this License must be included in +any documentation for such Subject Software where the recipients' rights +relating to Subject Software are described. Recipient may distribute the +source code version of Subject Software under a license of Recipient's +choice, which may contain terms different from this License, provided that +(i) Recipient is in compliance with the terms of this License, and (ii) the +license terms include this Section 2 and Sections 3, 4, 7, 8, 10, 12 and 13 +of this License, which terms may not be modified or superseded by any other +terms of such license. If Recipient distributes the source code version under +a different license Recipient must make it absolutely clear that any terms +which differ from this License are offered by Recipient alone, not by SGI. +Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as +a result of any such terms Recipient offers. + +3. Redistribution in Executable Form. The notice set forth in Exhibit A must +be conspicuously included in any notice in an executable version of Subject +Software, related documentation or collateral in which Recipient describes +the user's rights relating to the Subject Software. Recipient may distribute +the executable version of Subject Software under a license of Recipient's +choice, which may contain terms different from this License, provided that +(i) Recipient is in compliance with the terms of this License, and (ii) the +license terms include this Section 3 and Sections 4, 7, 8, 10, 12 and 13 of +this License, which terms may not be modified or superseded by any other +terms of such license. If Recipient distributes the executable version under +a different license Recipient must make it absolutely clear that any terms +which differ from this License are offered by Recipient alone, not by SGI. +Recipient hereby agrees to indemnify SGI for any liability incurred by SGI as +a result of any such terms Recipient offers. + +4. Termination. This License and the rights granted hereunder will terminate +automatically if Recipient fails to comply with terms herein and fails to +cure such breach within 30 days of the breach. Any sublicense to the Subject +Software which is properly granted shall survive any termination of this +License absent termination by the terms of such sublicense. Provisions which, +by their nature, must remain in effect beyond the termination of this License +shall survive. + +5. No Trademark Rights. This License does not grant any rights to use any +trade name, trademark or service mark whatsoever. No trade name, trademark or +service mark of SGI may be used to endorse or promote products derived from +the Subject Software without prior written permission of SGI. + +6. No Other Rights. This License does not grant any rights with respect to +the OpenGL API or to any software or hardware implementation thereof or to +any other software whatsoever, nor shall any other rights or licenses not +expressly granted hereunder arise by implication, estoppel or otherwise with +respect to the Subject Software. Title to and ownership of the Original Soft- +ware at all times remains with SGI. All rights in the Original Software not +expressly granted under this License are reserved. + +7. Compliance with Laws; Non-Infringement. Recipient shall comply with all +applicable laws and regulations in connection with use and distribution of +the Subject Software, including but not limited to, all export and import +control laws and regulations of the U.S. government and other countries. +Recipient may not distribute Subject Software that (i) in any way infringes +(directly or contributorily) the rights (including patent, copyright, trade +secret, trademark or other intellectual property rights of any kind) of any +other person or entity or (ii) breaches any representation or warranty, +express, implied or statutory, which under any applicable law it might be +deemed to have been distributed. + +8. Claims of Infringement. If Recipient at any time has knowledge of any one +or more third party claims that reproduction, modification, use, distribu- +tion, import or sale of Subject Software (including particular functionality +or code incorporated in Subject Software) infringes the third party's intel- +lectual property rights, Recipient must place in a well-identified web page +bearing the title "LEGAL" a description of each such claim and a description +of the party making each such claim in sufficient detail that a user of the +Subject Software will know whom to contact regarding the claim. Also, upon +gaining such knowledge of any such claim, Recipient must conspicuously +include the URL for such web page in the Exhibit A notice required under Sec- +tions 2 and 3, above, and in the text of any related documentation, license +agreement or collateral in which Recipient describes end user's rights relat- +ing to the Subject Software. If Recipient obtains such knowledge after it +makes Subject Software available to any other person or entity, Recipient +shall take other steps (such as notifying appropriate mailing lists or news- +groups) reasonably calculated to inform those who received the Subject Soft- +ware that new knowledge has been obtained. + +9. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- +CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON- INFRINGING. SGI ASSUMES NO +RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE +PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- +VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN +ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED +HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THE- +ORY, WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIA- +BILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR +ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY +CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK +STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER +COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF +THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY +TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SGI's NEGLIGENCE TO +THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO +NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, +SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO RECIPIENT. + +11. Indemnity. Recipient shall be solely responsible for damages arising, +directly or indirectly, out of its utilization of rights under this License. +Recipient will defend, indemnify and hold harmless Silicon Graphics, Inc. +from and against any loss, liability, damages, costs or expenses (including +the payment of reasonable attorneys fees) arising out of Recipient's use, +modification, reproduction and distribution of the Subject Software or out of +any representation or warranty made by Recipient. + +12. U.S. Government End Users. The Subject Software is a "commercial item" +consisting of "commercial computer software" as such terms are defined in +title 48 of the Code of Federal Regulations and all U.S. Government End +Users acquire only the rights set forth in this License and are subject to +the terms of this License. + +13. Miscellaneous. This License represents the complete agreement concerning +subject matter hereof. If any provision of this License is held to be unen- +forceable, such provision shall be reformed so as to achieve as nearly as +possible the same economic effect as the original provision and the remainder +of this License will remain in effect. This License shall be governed by and +construed in accordance with the laws of the United States and the State of +California as applied to agreements entered into and to be performed entirely +within California between California residents. Any litigation relating to +this License shall be subject to the exclusive jurisdiction of the Federal +Courts of the Northern District of California (or, absent subject matter +jurisdiction in such courts, the courts of the State of California), with +venue lying exclusively in Santa Clara County, California, with the losing +party responsible for costs, including without limitation, court costs and +reasonable attorneys fees and expenses. The application of the United Nations +Convention on Contracts for the International Sale of Goods is expressly +excluded. Any law or regulation which provides that the language of a con- +tract shall be construed against the drafter shall not apply to this License. + +Exhibit A + +The contents of this file are subject to Sections 2, 3, 4, 7, 8, 10, 12 and +13 of the GLX Public License Version 1.0 (the "License"). You may not use +this file except in compliance with those sections of the License. You may +obtain a copy of the License at Silicon Graphics, Inc., attn: Legal Services, +2011 N. Shoreline Blvd., Mountain View, CA 94043 or at +http://www.sgi.com/software/opensource/glx/license.html. + +Software distributed under the License is distributed on an "AS IS" basis. +ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED +WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- +INFRINGEMENT. See the License for the specific language governing rights and +limitations under the License. + +The Original Software is GLX version 1.2 source code, released February, +1999. The developer of the Original Software is Silicon Graphics, Inc. Those +portions of the Subject Software created by Silicon Graphics, Inc. are Copy- +right (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved. + +2.5 CID Font Code Public License + +CID FONT CODE PUBLIC LICENSE (Version 1.0 (3/31/99))("License") + +Subject to any applicable third party claims, Silicon Graphics, Inc. ("SGI") +hereby grants permission to Recipient (defined below), under SGI's copyrights +in the Original Software (defined below), to use, copy, modify, merge, pub- +lish, distribute, sublicense and/or sell copies of Subject Software (defined +below) in both source code and executable form, and to permit persons to whom +the Subject Software is furnished in accordance with this License to do the +same, subject to all of the following terms and conditions, which Recipient +accepts by engaging in any such use, copying, modifying, merging, publica- +tion, distributing, sublicensing or selling: + +1. Definitions. + + a. "Original Software" means source code of computer software code + that is described in Exhibit A as Original Software. + + b. "Modifications" means any addition to or deletion from the sub- + stance or structure of either the Original Software or any previous + Modifications. When Subject Software is released as a series of + files, a Modification means (i) any addition to or deletion from + the contents of a file containing Original Software or previous + Modifications and (ii) any new file that contains any part of the + Original Code or previous Modifications. + + c. "Subject Software" means the Original Software or Modifications + or the combination of the Original Software and Modifications, or + portions of any of the foregoing. + + d. "Recipient" means an individual or a legal entity exercising + rights under the terms of this License. For legal entities, "Recip- + ient" includes any entity that controls, is controlled by, or is + under common control with Recipient. For purposes of this defini- + tion, "control" of an entity means (i) the power, direct or indi- + rect, to direct or manage such entity, or (ii) ownership of fifty + percent (50%) or more of the outstanding shares or beneficial own- + ership of such entity. + + e. "Required Notice" means the notice set forth in Exhibit A to + this License. + + f. "Accompanying Technology" means any software or other technology + that is not a Modification and that is distributed or made publicly + available by Recipient with the Subject Software. Separate soft- + ware files that do not contain any Original Software or any previ- + ous Modification shall not be deemed a Modification, even if such + software files are aggregated as part of a product, or in any + medium of storage, with any file that does contain Original Soft- + ware or any previous Modification. + +2. License Terms. All distribution of the Subject Software must be made sub- +ject to the terms of this License. A copy of this License and the Required +Notice must be included in any documentation for Subject Software where +Recipient's rights relating to Subject Software and/or any Accompanying Tech- +nology are described. Distributions of Subject Software in source code form +must also include the Required Notice in every file distributed. In addition, +a ReadMe file entitled "Important Legal Notice" must be distributed with each +distribution of one or more files that incorporate Subject Software. That +file must be included with distributions made in both source code and exe- +cutable form. A copy of the License and the Required Notice must be included +in that file. Recipient may distribute Accompanying Technology under a +license of Recipient's choice, which may contain terms different from this +License, provided that (i) Recipient is in compliance with the terms of this +License, (ii) such other license terms do not modify or supersede the terms +of this License as applicable to the Subject Software, (iii) Recipient hereby +indemnifies SGI for any liability incurred by SGI as a result of the distri- +bution of Accompanying Technology or the use of other license terms. + +3. Termination. This License and the rights granted hereunder will terminate +automatically if Recipient fails to comply with terms herein and fails to +cure such breach within 30 days of the breach. Any sublicense to the Subject +Software that is properly granted shall survive any termination of this +License absent termination by the terms of such sublicense. Provisions which, +by their nature, must remain in effect beyond the termination of this License +shall survive. + +4. Trademark Rights. This License does not grant any rights to use any trade +name, trademark or service mark whatsoever. No trade name, trademark or ser- +vice mark of SGI may be used to endorse or promote products derived from or +incorporating any Subject Software without prior written permission of SGI. + +5. No Other Rights. No rights or licenses not expressly granted hereunder +shall arise by implication, estoppel or otherwise. Title to and ownership of +the Original Software at all times remains with SGI. All rights in the Origi- +nal Software not expressly granted under this License are reserved. + +6. Compliance with Laws; Non-Infringement. Recipient shall comply with all +applicable laws and regulations in connection with use and distribution of +the Subject Software, including but not limited to, all export and import +control laws and regulations of the U.S. government and other countries. +Recipient may not distribute Subject Software that (i) in any way infringes +(directly or contributorily) the rights (including patent, copyright, trade +secret, trademark or other intellectual property rights of any kind) of any +other person or entity, or (ii) breaches any representation or warranty, +express, implied or statutory, which under any applicable law it might be +deemed to have been distributed. + +7. Claims of Infringement. If Recipient at any time has knowledge of any one +or more third party claims that reproduction, modification, use, distribu- +tion, import or sale of Subject Software (including particular functionality +or code incorporated in Subject Software) infringes the third party's intel- +lectual property rights, Recipient must place in a well-identified web page +bearing the title "LEGAL" a description of each such claim and a description +of the party making each such claim in sufficient detail that a user of the +Subject Software will know whom to contact regarding the claim. Also, upon +gaining such knowledge of any such claim, Recipient must conspicuously +include the URL for such web page in the Required Notice, and in the text of +any related documentation, license agreement or collateral in which Recipient +describes end user's rights relating to the Subject Software. If Recipient +obtains such knowledge after it makes Subject Software available to any other +person or entity, Recipient shall take other steps (such as notifying appro- +priate mailing lists or newsgroups) reasonably calculated to provide such +knowledge to those who received the Subject Software. + +8. DISCLAIMER OF WARRANTY. SUBJECT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, +WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT +LIMITATION, WARRANTIES THAT THE SUBJECT SOFTWARE IS FREE OF DEFECTS, MER- +CHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. SGI ASSUMES NO +RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE. SHOULD ANY SOFTWARE +PROVE DEFECTIVE IN ANY RESPECT, SGI ASSUMES NO COST OR LIABILITY FOR ANY SER- +VICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN +ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY SUBJECT SOFTWARE IS AUTHORIZED +HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +9. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, +WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT LIABILITY), +CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SUBJECT SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SUBJECT SOFTWARE. SOME JURISDICTIONS DO NOT +ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN DAMAGES, SO THIS EXCLUSION AND +LIMITATION MAY NOT APPLY TO RECIPIENT TO THE EXTENT SO DISALLOWED. + +10. Indemnity. Recipient shall be solely responsible for damages arising, +directly or indirectly, out of its utilization of rights under this License. +Recipient will defend, indemnify and hold SGI and its successors and assigns +harmless from and against any loss, liability, damages, costs or expenses +(including the payment of reasonable attorneys fees) arising out of (Recipi- +ent's use, modification, reproduction and distribution of the Subject Soft- +ware or out of any representation or warranty made by Recipient. + +11. U.S. Government End Users. The Subject Software is a "commercial item" +consisting of "commercial computer software" as such terms are defined in +title 48 of the Code of Federal Regulations and all U.S. Government End Users +acquire only the rights set forth in this License and are subject to the +terms of this License. + +12. Miscellaneous. This License represents the complete agreement concerning +subject matter hereof. If any provision of this License is held to be unen- +forceable by any judicial or administrative authority having proper jurisdic- +tion with respect thereto, such provision shall be reformed so as to achieve +as nearly as possible the same economic effect as the original provision and +the remainder of this License will remain in effect. This License shall be +governed by and construed in accordance with the laws of the United States +and the State of California as applied to agreements entered into and to be +performed entirely within California between California residents. Any liti- +gation relating to this License shall be subject to the exclusive jurisdic- +tion of the Federal Courts of the Northern District of California (or, absent +subject matter jurisdiction in such courts, the courts of the State of Cali- +fornia), with venue lying exclusively in Santa Clara County, California, with +the losing party responsible for costs, including without limitation, court +costs and reasonable attorneys fees and expenses. The application of the +United Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation that provides that the language of +a contract shall be construed against the drafter shall not apply to this +License. + +Exhibit A + +Copyright (c) 1994-1999 Silicon Graphics, Inc. + +The contents of this file are subject to the CID Font Code Public License +Version 1.0 (the "License"). You may not use this file except in compliance +with the License. You may obtain a copy of the License at Silicon Graphics, +Inc., attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043 +or at http://www.sgi.com/software/opensource/cid/license.html + +Software distributed under the License is distributed on an "AS IS" basis. +ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED +WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR PURPOSE OR OF NON- +INFRINGEMENT. See the License for the specific language governing rights and +limitations under the License. + +The Original Software (as defined in the License) is CID font code that was +developed by Silicon Graphics, Inc. Those portions of the Subject Software +(as defined in the License) that were created by Silicon Graphics, Inc. are +Copyright (c) 1994-1999 Silicon Graphics, Inc. All Rights Reserved. + +[NOTE: When using this text in connection with Subject Software delivered +solely in object code form, Recipient may replace the words "this file" with +"this software" in both the first and second sentences.] + +Additional copyright(s)/license(s): + +******************************************************************************** + +SGI FREE SOFTWARE LICENSE B (Version 1.1 [02/22/2000]) + +1. Definitions. + +1.1. "Additional Notice Provisions" means such additional provisions as +appear in the Notice in Original Code under the heading "Additional Notice +Provisions." +1.2. "Covered Code" means the Original Code or Modifications, or any +combination thereof. +1.3. "Hardware" means any physical device that accepts input, processes +input, stores the results of processing, and/or provides output. +1.4. "Larger Work" means a work that combines Covered Code or portions +thereof with code not governed by the terms of this License. +1.5. "Licensable" means having the right to grant, to the maximum extent +possible, whether at the time of the initial grant or subsequently +acquired, any and all of the rights conveyed herein. +1.6. "License" means this document. +1.7. "Licensed Patents" means patent claims Licensable by SGI that are +infringed by the use or sale of Original Code or any Modifications provided +by SGI, or any combination thereof. +1.8. "Modifications" means any addition to or deletion from the substance +or structure of the Original Code or any previous Modifications. When +Covered Code is released as a series of files, a Modification is: + A. Any addition to the contents of a file containing Original Code and/or + addition to or deletion from the contents of a file containing previous + Modifications. + B. Any new file that contains any part of the Original Code or previous + Modifications. +1.9. "Notice" means any notice in Original Code or Covered Code, as +required by and in compliance with this License. +1.10. "Original Code" means source code of computer software code that is +described in the source code Notice required by Exhibit A as Original Code, +and updates and error corrections specifically thereto. +1.11. "Recipient" means an individual or a legal entity exercising rights +under, and complying with all of the terms of, this License or a future +version of this License issued under Section 8. For legal entities, +"Recipient" includes any entity that controls, is controlled by, or is +under common control with Recipient. For purposes of this definition, +"control" of an entity means (a) the power, direct or indirect, to direct +or manage such entity, or (b) ownership of fifty percent (50%) or more of +the outstanding shares or beneficial ownership of such entity. +1.12. "Recipient Patents" means patent claims Licensable by a Recipient +that are infringed by the use or sale of Original Code or any Modifications +provided by SGI, or any combination thereof. +1.13. "SGI" means Silicon Graphics, Inc. +1.14. "SGI Patents" means patent claims Licensable by SGI other than the +Licensed Patents. + +2. License Grant and Restrictions. + +2.1. SGI License Grant. Subject to the terms of this License and any third +party intellectual property claims, for the duration of intellectual +property protections inherent in the Original Code, SGI hereby grants +Recipient a worldwide, royalty­free, non­exclusive license, to do the +following: (i) under copyrights Licensable by SGI, to reproduce, +distribute, create derivative works from, and, to the extent applicable, +display and perform the Original Code and/or any Modifications provided by +SGI alone and/or as part of a Larger Work; and (ii) under any Licensable +Patents, to make, have made, use, sell, offer for sale, import and/or +otherwise transfer the Original Code and/or any Modifications provided by +SGI. Recipient accepts the terms and conditions of this License by +undertaking any of the aforementioned actions. The patent license shall +apply to the Covered Code if, at the time any related Modification is +added, such addition of the Modification causes such combination to be +covered by the Licensed Patents. The patent license in Section 2.1(ii) +shall not apply to any other combinations that include the Modification. +No patent license is provided under SGI Patents for infringements of SGI +Patents by Modifications not provided by SGI or combinations of Original +Code and Modifications not provided by SGI. + +2.2. Recipient License Grant. Subject to the terms of this License and any +third party intellectual property claims, Recipient hereby grants SGI and +any other Recipients a worldwide, royalty­free, non­exclusive license, +under any Recipient Patents, to make, have made, use, sell, offer for sale, +import and/or otherwise transfer the Original Code and/or any Modifications +provided by SGI. + +2.3. No License For Hardware Implementations. The licenses granted in +Section 2.1 and 2.2 are not applicable to implementation in Hardware of the +algorithms embodied in the Original Code or any Modifications provided by +SGI . + +3. Redistributions. + +3.1. Retention of Notice/Copy of License. The Notice set forth in Exhibit +A, below, must be conspicuously retained or included in any and all +redistributions of Covered Code. For distributions of the Covered Code in +source code form, the Notice must appear in every file that can include a +text comments field; in executable form, the Notice and a copy of this +License must appear in related documentation or collateral where the +Recipient's rights relating to Covered Code are described. Any Additional +Notice Provisions which actually appears in the Original Code must also be +retained or included in any and all redistributions of Covered Code. + +3.2. Alternative License. Provided that Recipient is in compliance with the +terms of this License, Recipient may, so long as without derogation of any +of SGI's rights in and to the Original Code, distribute the source code +and/or executable version(s) of Covered Code under (1) this License; (2) a +license identical to this License but for only such changes as are +necessary in order to clarify Recipient's role as licensor of +Modifications; and/or (3) a license of Recipient's choosing, containing +terms different from this License, provided that the license terms include +this Section 3 and Sections 4, 6, 7, 10, 12, and 13, which terms may not be +modified or superseded by any other terms of such license. If Recipient +elects to use any license other than this License, Recipient must make it +absolutely clear that any of its terms which differ from this License are +offered by Recipient alone, and not by SGI. It is emphasized that this +License is a limited license, and, regardless of the license form employed +by Recipient in accordance with this Section 3.2, Recipient may relicense +only such rights, in Original Code and Modifications by SGI, as it has +actually been granted by SGI in this License. + +3.3. Indemnity. Recipient hereby agrees to indemnify SGI for any liability +incurred by SGI as a result of any such alternative license terms Recipient +offers. + +4. Termination. This License and the rights granted hereunder will +terminate automatically if Recipient breaches any term herein and fails to +cure such breach within 30 days thereof. Any sublicense to the Covered Code +that is properly granted shall survive any termination of this License, +absent termination by the terms of such sublicense. Provisions that, by +their nature, must remain in effect beyond the termination of this License, +shall survive. + +5. No Trademark Or Other Rights. This License does not grant any rights to: +(i) any software apart from the Covered Code, nor shall any other rights or +licenses not expressly granted hereunder arise by implication, estoppel or +otherwise with respect to the Covered Code; (ii) any trade name, trademark +or service mark whatsoever, including without limitation any related right +for purposes of endorsement or promotion of products derived from the +Covered Code, without prior written permission of SGI; or (iii) any title +to or ownership of the Original Code, which shall at all times remains with +SGI. All rights in the Original Code not expressly granted under this +License are reserved. + +6. Compliance with Laws; Non­Infringement. There are various worldwide +laws, regulations, and executive orders applicable to dispositions of +Covered Code, including without limitation export, re­export, and import +control laws, regulations, and executive orders, of the U.S. government and +other countries, and Recipient is reminded it is obliged to obey such laws, +regulations, and executive orders. Recipient may not distribute Covered +Code that (i) in any way infringes (directly or contributorily) any +intellectual property rights of any kind of any other person or entity or +(ii) breaches any representation or warranty, express, implied or +statutory, to which, under any applicable law, it might be deemed to have +been subject. + +7. Claims of Infringement. If Recipient learns of any third party claim +that any disposition of Covered Code and/or functionality wholly or +partially infringes the third party's intellectual property rights, +Recipient will promptly notify SGI of such claim. + +8. Versions of the License. SGI may publish revised and/or new versions of +the License from time to time, each with a distinguishing version number. +Once Covered Code has been published under a particular version of the +License, Recipient may, for the duration of the license, continue to use it +under the terms of that version, or choose to use such Covered Code under +the terms of any subsequent version published by SGI. Subject to the +provisions of Sections 3 and 4 of this License, only SGI may modify the +terms applicable to Covered Code created under this License. + +9. DISCLAIMER OF WARRANTY. COVERED CODE IS PROVIDED "AS IS." ALL EXPRESS +AND IMPLIED WARRANTIES AND CONDITIONS ARE DISCLAIMED, INCLUDING, WITHOUT +LIMITATION, ANY IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, +SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, AND +NON­INFRINGEMENT. SGI ASSUMES NO RISK AS TO THE QUALITY AND PERFORMANCE OF +THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, SGI +ASSUMES NO COST OR LIABILITY FOR SERVICING, REPAIR OR CORRECTION. THIS +DISCLAIMER OF WARRANTY IS AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY +COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT SUBJECT TO THIS DISCLAIMER. + +10. LIMITATION OF LIABILITY. UNDER NO CIRCUMSTANCES NOR LEGAL THEORY, +WHETHER TORT (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE OR STRICT +LIABILITY), CONTRACT, OR OTHERWISE, SHALL SGI OR ANY SGI LICENSOR BE LIABLE +FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF +ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, +WORK STOPPAGE, LOSS OF DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND +ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN +INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY +SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM +SGI's NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. +SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL +OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO +RECIPIENT. + +11. Indemnity. Recipient shall be solely responsible for damages arising, +directly or indirectly, out of its utilization of rights under this +License. Recipient will defend, indemnify and hold harmless Silicon +Graphics, Inc. from and against any loss, liability, damages, costs or +expenses (including the payment of reasonable attorneys fees) arising out +of Recipient's use, modification, reproduction and distribution of the +Covered Code or out of any representation or warranty made by Recipient. + +12. U.S. Government End Users. The Covered Code is a "commercial item" +consisting of "commercial computer software" as such terms are defined in +title 48 of the Code of Federal Regulations and all U.S. Government End +Users acquire only the rights set forth in this License and are subject to +the terms of this License. + +13. Miscellaneous. This License represents the complete agreement +concerning the its subject matter. If any provision of this License is held +to be unenforceable, such provision shall be reformed so as to achieve as +nearly as possible the same legal and economic effect as the original +provision and the remainder of this License will remain in effect. This +License shall be governed by and construed in accordance with the laws of +the United States and the State of California as applied to agreements +entered into and to be performed entirely within California between +California residents. Any litigation relating to this License shall be +subject to the exclusive jurisdiction of the Federal Courts of the Northern +District of California (or, absent subject matter jurisdiction in such +courts, the courts of the State of California), with venue lying +exclusively in Santa Clara County, California, with the losing party +responsible for costs, including without limitation, court costs and +reasonable attorneys fees and expenses. The application of the United +Nations Convention on Contracts for the International Sale of Goods is +expressly excluded. Any law or regulation that provides that the language +of a contract shall be construed against the drafter shall not apply to +this License. + +Exhibit A License Applicability. + +Except to the extent portions of this file are made subject to an +alternative license as permitted in the SGI Free Software License B, +Version 1.1 (the "License"), the contents of this file are subject only to +the provisions of the License. You may not use this file except in +compliance with the License. You may obtain a copy of the License at +Silicon Graphics, Inc., attn: Legal Services, 1600 Amphitheatre Parkway, +Mountain View, CA 94043­1351, or at: http://oss.sgi.com/projects/FreeB Note +that, as provided in the License, the Software is distributed on an "AS IS" +basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS DISCLAIMED, +INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND CONDITIONS OF +MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, +AND NON­INFRINGEMENT. Original Code. The Original Code is: [name of +software, version number, and release date], developed by Silicon Graphics, +Inc. The Original Code is Copyright (c) [dates of first publication, as +appearing in the Notice in the Original Code] Silicon Graphics, Inc. +Copyright in any portions created by third parties is as indicated +elsewhere herein. All Rights Reserved. + +Additional Notice Provisions: + +[such additional provisions, if any, as appear in the Notice in the +Original Code under the heading "Additional Notice Provisions"] diff --git a/fonts/licensesourcesans.txt b/fonts/licensesourcesans.txt new file mode 100644 index 0000000..d154618 --- /dev/null +++ b/fonts/licensesourcesans.txt @@ -0,0 +1,93 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/fonts/sourcesans.ttf b/fonts/sourcesans.ttf new file mode 100644 index 0000000..ffe2786 Binary files /dev/null and b/fonts/sourcesans.ttf differ diff --git a/glosdshader.cc b/glosdshader.cc old mode 100755 new mode 100644 diff --git a/glosdshader.h b/glosdshader.h old mode 100755 new mode 100644 diff --git a/glshader.h b/glshader.h old mode 100755 new mode 100644 diff --git a/log.h b/log.h old mode 100755 new mode 100644 diff --git a/main.cc b/main.cc index d837754..237b233 100644 --- a/main.cc +++ b/main.cc @@ -68,7 +68,7 @@ extern "C" #include "mtdraspberry.h" #include "remotelinux.h" #include "ledraspberry.h" -#include "osdopengl.h" +#include "osdopenvg.h" #include "audioomx.h" #include "videoomx.h" @@ -129,7 +129,7 @@ int main(int argc, char** argv) debugEnabled = true; // and... case 'n': daemonize = false; - break; + break; case 's': setServer = optarg; break; @@ -141,7 +141,7 @@ int main(int argc, char** argv) return 1; } } - + // Init global vars ------------------------------------------------------------------------------------------------ logger = new Log(); timers = new Timers(); @@ -160,7 +160,7 @@ int main(int argc, char** argv) command = new Command(); wol = new Wol(); sleeptimer = new Sleeptimer(); - + if (!logger || !remote || !mtd || !led || !osd || !video || !audio || !boxstack || !command || !wol || !sleeptimer) { printf("Could not create objects. Memory problems?\n"); @@ -262,7 +262,7 @@ int main(int argc, char** argv) success = led->init(((RemoteMVP*)remote)->getDevice()); #else success = led->init(-1); -#endif +#endif if (success) { logger->log("Core", Log::INFO, "LED module initialised"); diff --git a/osdmvp.h b/osdmvp.h index 5cdad84..5c23c63 100644 --- a/osdmvp.h +++ b/osdmvp.h @@ -35,7 +35,7 @@ class OsdMVP : public Osd { public: OsdMVP(); - ~OsdMVP(); + virtual ~OsdMVP(); int init(void* device); int shutdown(); diff --git a/osdopengl.cc b/osdopengl.cc index 3abbaf7..a62a2bd 100644 --- a/osdopengl.cc +++ b/osdopengl.cc @@ -443,7 +443,7 @@ void OsdOpenGL::EndPainting() { void OsdOpenGL::Blank() { BeginPainting(); - glClearColor(0.15f, 0.25f, 0.35f, 1.0f); // change this to black after testing + glClearColor(0.15f, 1.f, 0.35f, 1.0f); // change this to black after testing glClear( GL_COLOR_BUFFER_BIT ); glClear( GL_DEPTH_BUFFER_BIT ); EndPainting(); diff --git a/osdopenvg.cc b/osdopenvg.cc new file mode 100644 index 0000000..46bc4a1 --- /dev/null +++ b/osdopenvg.cc @@ -0,0 +1,942 @@ +/* + Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +#include "osdopenvg.h" +#include "mtd.h" +#include "videoomx.h" +#include + +#include "message.h" +#include "command.h" + +#include +#include +#include + +using namespace Magick; + +extern uint8_t font_data[] asm("_binary_fonts_sourcesans_ttf_start"); +extern uint8_t font_data_end[] asm("_binary_fonts_sourcesans_ttf_end"); +extern uint8_t vdr_data[] asm("_binary_other_vdrhires_jpg_start"); +extern uint8_t vdr_data_end[] asm("_binary_other_vdrhires_jpg_end"); +extern uint8_t wallpaper_data[] asm("_binary_other_wallpaper720p_jpg_start"); +extern uint8_t wallpaper_data_end[] asm("_binary_other_wallpaper720p_jpg_end"); + + +#define BACKBUFFER_WIDTH 1280 +#define BACKBUFFER_HEIGHT 720 + + +OsdOpenVG::OsdOpenVG() +{ + vgmutex.Lock(); + taskmutex.Lock(); + lastrendertime=getTimeMS(); + display_height=0; + display_width=0; + mode=0; + aspect_correction=1.; + + wait_id=1; + +} + +OsdOpenVG::~OsdOpenVG() +{ + + if (initted) + { + shutdown(); + } + + + vgmutex.Unlock(); + taskmutex.Unlock(); +} + + + +int OsdOpenVG::init(void* device) +{ + if (initted) return 0; + Video* video = Video::getInstance(); + //window=*((HWND*)device); + + // May be this device specific part should go to a device specific child class + + //init broadcom chipset (Move to video?) + + + //First get connection to egl + egl_display=eglGetDisplay(EGL_DEFAULT_DISPLAY); + + if (egl_display==EGL_NO_DISPLAY) { + Log::getInstance()->log("OSD", Log::WARN, "Could not get egl display! %x",eglGetError()); + vgmutex.Unlock(); + return 0; + } + + + + if (eglInitialize(egl_display, NULL, NULL)==EGL_FALSE) { + Log::getInstance()->log("OSD", Log::WARN, "Initialising display failed! %x",eglGetError()); + vgmutex.Unlock(); + return 0; + } + + + const char *query_str=eglQueryString(egl_display,EGL_CLIENT_APIS); + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",eglGetError()); + query_str=eglQueryString(egl_display,EGL_EXTENSIONS); + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",eglGetError()); + + if (eglBindAPI(EGL_OPENVG_API)==EGL_FALSE) { + Log::getInstance()->log("OSD", Log::WARN, "Binding openvg api failed! %x",eglGetError()); + vgmutex.Unlock(); + return 0; + } + + const EGLint attributs[]={ + EGL_RED_SIZE,8,EGL_GREEN_SIZE, 8,EGL_BLUE_SIZE, 8,EGL_ALPHA_SIZE, 8, + EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_PBUFFER_BIT, + EGL_CONFORMANT, EGL_OPENVG_BIT, + EGL_NONE + }; // Here, we might have to select the resolution! + + + EGLint number; + + if (eglChooseConfig(egl_display, attributs, &egl_ourconfig, 1, &number)==EGL_FALSE) { + Log::getInstance()->log("OSD", Log::WARN, "Choosing egl config failed! %x",eglGetError()); + vgmutex.Unlock(); + return 0; + } + + + + egl_context=eglCreateContext(egl_display,egl_ourconfig,NULL,NULL); + if (egl_context==EGL_NO_CONTEXT) { + Log::getInstance()->log("OSD", Log::WARN, "Creating egl context failed! %x",eglGetError()); + vgmutex.Unlock(); + return 0; + } + + // warning broadcom specific, get display size! + display_width=display_height=0; + if (graphics_get_display_size(0, &display_width, &display_height)<0) { + Log::getInstance()->log("OSD", Log::WARN, "Getting display size failed! (BCM API) "); + vgmutex.Unlock(); + return 0; + } + Log::getInstance()->log("OSD", Log::NOTICE, "Displaysize is %d x %d ",display_width, display_height); + VC_RECT_T dst_rect ={0,0,display_width,display_height}; + VC_RECT_T src_rect={0,0,BACKBUFFER_WIDTH <<16,BACKBUFFER_HEIGHT<<16}; + VC_RECT_T src_rect_bg={0,0,1<<16,1<<16}; + VC_RECT_T src_rect_im={0,0,1,1}; + + uint32_t back_image_ptr; + bcm_backres=vc_dispmanx_resource_create(VC_IMAGE_RGB888,1,1,&back_image_ptr); + unsigned int color=0x00FF0000; + vc_dispmanx_resource_write_data(bcm_backres,VC_IMAGE_RGB888,4,&color,&src_rect_im); + + DISPMANX_UPDATE_HANDLE_T bcm_update; + bcm_display=vc_dispmanx_display_open(0); + bcm_update=vc_dispmanx_update_start(0); + bcm_element=vc_dispmanx_element_add(bcm_update,bcm_display, + 2,&dst_rect, 0, + &src_rect,DISPMANX_PROTECTION_NONE,0, 0, (DISPMANX_TRANSFORM_T) 0); + + + bcm_background=vc_dispmanx_element_add(bcm_update,bcm_display, + 0,&dst_rect,bcm_backres , + &src_rect_bg,DISPMANX_PROTECTION_NONE,0, 0, (DISPMANX_TRANSFORM_T) 0); + + vc_dispmanx_update_submit_sync(bcm_update); + + + + static EGL_DISPMANX_WINDOW_T nativewindow; + nativewindow.element=bcm_element; + nativewindow.height=BACKBUFFER_HEIGHT; + nativewindow.width=BACKBUFFER_WIDTH; + + egl_surface = eglCreateWindowSurface(egl_display,egl_ourconfig, &nativewindow,NULL ); + if (egl_surface==EGL_NO_SURFACE) { + Log::getInstance()->log("OSD", Log::WARN, "Creating egl window surface failed!"); + vgmutex.Unlock(); + return 0; + } + Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current in1%d",syscall(SYS_gettid)); + if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) { + Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed"); + vgmutex.Unlock(); + return 0; + } + // Test stuff + + query_str=(const char*)vgGetString(VG_VERSION) ; + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",vgGetError()); + + query_str=(const char*)vgGetString(VG_VENDOR) ; + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",vgGetError()); + + query_str=(const char*)vgGetString(VG_RENDERER) ; + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",vgGetError()); + + query_str=(const char*)vgGetString(VG_EXTENSIONS) ; + if (query_str) Log::getInstance()->logLongString("OSD", Log::NOTICE, query_str); + else Log::getInstance()->log("OSD", Log::WARN, "Could not query display %x",vgGetError()); + + + + + + + + + + aspect_correction= ((float)BACKBUFFER_HEIGHT)/576.f/(((float)BACKBUFFER_WIDTH)/720.f); + initPaths(); + if (!loadFont()) { + return 0; + } + + eglSwapInterval(egl_display, 1 ); + + Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current out 1%d",syscall(SYS_gettid)); + eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); + //Now we will create the Screen + initted = 1; // must set this here or create surface won't work + + + if (((VideoOMX*)Video::getInstance())->initUsingOSDObjects()!=1) { //call Video for init stuff + return 0; + } + InitializeMagick(""); + + pthread_cond_init(&vgtaskCond, NULL); + pthread_mutex_init(&vgtaskCondMutex, NULL); + + threadStart(); + taskmutex.Unlock(); + vgmutex.Unlock(); + + + return 1; +} + + +void OsdOpenVG::initPaths() +{ + + + VGPath current; + current=vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F,1.f,0.f, + 0,0,VG_PATH_CAPABILITY_ALL); + + vguLine(current,0.f,0.f,1.f,0.f); + // HorzLine + std_paths[HorzLine]=current; + + current=vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F,1.f,0.f, + 0,0,VG_PATH_CAPABILITY_ALL); + vguLine(current,0.f,0.f,0.f,1.f); + // VertLine + std_paths[VertLine]=current; + + current=vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F,1.f,0.f, + 0,0,VG_PATH_CAPABILITY_ALL); + //vguRect(current,0.f,0.f,1.f,1.f); + vguRect(current,0.f,0.f,1.f,1.f); + // Rectabgle + std_paths[Rectangle]=current; + + current=vgCreatePath(VG_PATH_FORMAT_STANDARD, + VG_PATH_DATATYPE_F,1.f,0.f, + 0,0,0); + vguEllipse(current,0.f,0.f,1.f,1.f); + // Point + std_paths[Point]=current; + +} + +void OsdOpenVG::destroyPaths() +{ + vgDestroyPath(std_paths[HorzLine]); + vgDestroyPath(std_paths[VertLine]); + vgDestroyPath(std_paths[Rectangle]); + vgDestroyPath(std_paths[Point]); + +} + + +int OsdOpenVG::shutdown() +{ + if (!initted) return 0; + + initted = 0; + Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark1"); + threadStop(); + Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark2"); + processTasks(); + Log::getInstance()->log("OSD", Log::DEBUG, "shutdown mark3"); + + taskmutex.Lock(); + vgmutex.Lock(); + (((VideoOMX*)Video::getInstance())->shutdownUsingOSDObjects()); + + FT_Done_Face(ft_face); + vgDestroyFont(vgfont); + destroyPaths(); + vgClear(0,0,BACKBUFFER_WIDTH,BACKBUFFER_HEIGHT); + eglSwapBuffers(egl_display, egl_surface); + Log::getInstance()->log("OSD", Log::DEBUG, "Making egl current out final"); + eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); + eglDestroySurface(egl_display,egl_surface); + eglDestroyContext(egl_display,egl_context); + eglTerminate(egl_display ); + + DISPMANX_UPDATE_HANDLE_T bcm_update; + bcm_update=vc_dispmanx_update_start(0); + + vc_dispmanx_element_remove(bcm_update,bcm_element); + vc_dispmanx_element_remove(bcm_update,bcm_background); + vc_dispmanx_update_submit_sync(bcm_update); + vc_dispmanx_resource_delete(bcm_backres); + vc_dispmanx_display_close(bcm_display); + + + + return 1; +} + + +void OsdOpenVG::threadMethod() +{ + // We have to claim the egl context for this thread + + if (eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context)== EGL_FALSE) { + Log::getInstance()->log("OSD", Log::WARN, "Making egl Current failed in thread %x",eglGetError()); + return; + } + int ts=0; + while (true) + { + ts=1; + unsigned int waittime=1; + + if (initted) { + + long long time1 = getTimeMS(); + if ((time1 - lastrendertime) > 200) {//5 fps for OSD updates are enough, avoids tearing + InternalRendering(); + lastrendertime = getTimeMS(); + + } + if (processTasks()) ts=0; + } + threadCheckExit(); + if (ts!=0) { + struct timespec target_time; + clock_gettime(CLOCK_REALTIME,&target_time); + target_time.tv_nsec+=1000000LL*ts; + if (target_time.tv_nsec>999999999) { + target_time.tv_nsec-=1000000000L; + target_time.tv_sec+=1; + } + threadLock(); + threadWaitForSignalTimed(&target_time); + threadUnlock(); + } + //Sleep(1); + } + //eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ); +} + + +void OsdOpenVG::threadPostStopCleanup() +{ + //Doing nothing + //goo; +} + + + + + + +void OsdOpenVG::InternalRendering(){ + vgmutex.Lock(); + float colclear[]={1.f,1.0f,1.f,1.f}; + vgSetfv(VG_CLEAR_COLOR,4,colclear); + vgClear(0,0,BACKBUFFER_WIDTH,BACKBUFFER_HEIGHT); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); + + + drawSurfaces(); //iterate through and draws all commands + + //Show it to the user! + eglSwapBuffers(egl_display, egl_surface); + vgmutex.Unlock(); + +} + +/*font stuff*/ + +float OsdOpenVG::getFontHeight() +{ + return font_height; //dummy +} +float OsdOpenVG::getCharWidth(wchar_t c) +{ + unsigned int glyph_index=FT_Get_Char_Index(ft_face,c); + return font_exp_x[glyph_index]; +} + +int OsdOpenVG::loadFont() +{ + int error=FT_Init_FreeType(&ft_library); + float font_size=16.f; + if (error) + { + Log::getInstance()->log("OSD", Log::WARN, "Could not load freetype %x",error); + return 0; + } + + error=FT_New_Memory_Face(ft_library,font_data,font_data_end-font_data,0,&ft_face ); + if (error) { + Log::getInstance()->log("OSD", Log::WARN, "Could not load font face %x",error); + return 0; + } + error=FT_Set_Char_Size(ft_face,0,font_size*64,0,0 /*dpi*/); + if (error) { + FT_Done_Face(ft_face); + Log::getInstance()->log("OSD", Log::WARN, "Could not set face size %x",error); + return 0; + } + vgfont=vgCreateFont(0); + FT_ULong cur_char; + FT_UInt glyph; + font_height=ft_face->size->metrics.height/64.f; + cur_char = FT_Get_First_Char(ft_face,&glyph); + vector segments; + vector coord; + segments.reserve(256); + coord.reserve(1024); + //Log::getInstance()->log("OSD", Log::DEBUG, "Create Glyph test %d %x %x %d",cur_char,font_data_end,font_data,glyph); + while (glyph !=0) + { + error=FT_Load_Glyph(ft_face,glyph,FT_LOAD_DEFAULT); + if (error){ + FT_Done_Face(ft_face); + Log::getInstance()->log("OSD", Log::WARN, "Could not load glyph %x",error); + return 0; + } + VGPath path; + FT_Outline ot=ft_face->glyph->outline; + segments.clear(); + coord.clear(); + + if (ot.n_contours ==0) { + path=VG_INVALID_HANDLE; + } else { + path=vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, + 1.0f,0.f,0,0,VG_PATH_CAPABILITY_ALL); + + /* convert glyph */ + FT_Vector *pt=ot.points; + const char *tags=ot.tags; + const short* cont=ot.contours; + short n_cont=ot.n_contours; + short n_point=ot.n_points; + short last_cont=0; + for (short point=0;n_cont!=0;cont++,n_cont--) { + short next_cont=*cont+1; + bool first=true; + char last_tag=0; + short first_point=point; + //Log::getInstance()->log("OSD", Log::DEBUG, "runs %d",*cont); + for (;pointlog("OSD", Log::DEBUG, "tag %d point %d %d: %d %d",tag,fpoint.x,fpoint.y,point,n_point); + if (first) { + segments.push_back(VG_MOVE_TO); + first=false; + } else if (tag &0x1) { //on curve + if (last_tag &0x1) { + segments.push_back(VG_LINE_TO); + } else if (last_tag &0x2){ + segments.push_back(VG_CUBIC_TO); + } else { + segments.push_back(VG_QUAD_TO); + } + + } else { + if (!(tag &0x2)){ + if (!(last_tag &0x1)) { + segments.push_back(VG_QUAD_TO); + int coord_size=coord.size(); + VGfloat x=(coord[coord_size-2]+ ((float)fpoint.x)/64.f)*0.5f*aspect_correction; + VGfloat y=(coord[coord_size-1]+(font_size- ((float)fpoint.y)/64.f))*0.5f; + coord.push_back(x); + coord.push_back(y); + } + } + + + } + last_tag=tag; + coord.push_back(((float)fpoint.x)*aspect_correction/64.); + coord.push_back(font_size-((float)fpoint.y)/64.); + //Log::getInstance()->log("OSD", Log::DEBUG, "Create APD Glyph coord %d %d %g %g",fpoint.x,fpoint.y,coord[coord.size()-2],coord[coord.size()-1]); + } + if (!(last_tag &0x1)) { + if (last_tag &0x2) { + segments.push_back(VG_CUBIC_TO); + } else { + segments.push_back(VG_QUAD_TO); + } + coord.push_back(((float)pt[first_point].x)*aspect_correction/64.); + coord.push_back(font_size-((float)pt[first_point].y)/64.); + } + //segments.push_back(VG_CLOSE_PATH); + + + } + vgAppendPathData(path,segments.size(),&segments[0],&coord[0]); + int n=0; + /* for (int m=0;mlog("OSD", Log::DEBUG, "Move To %g %g",coord[n],coord[n+1]);n+=2; break; + case VG_LINE_TO: + Log::getInstance()->log("OSD", Log::DEBUG, "Line To %g %g",coord[n],coord[n+1]);n+=2; break; + case VG_CUBIC_TO: + Log::getInstance()->log("OSD", Log::DEBUG, "Cubic To %g %g %g %g %g %g",coord[n],coord[n+1],coord[n+2],coord[n+3],coord[n+4],coord[n+5]);n+=6; break; + case VG_QUAD_TO: + Log::getInstance()->log("OSD", Log::DEBUG, "Quad To %g %g %g %g",coord[n],coord[n+1],coord[n+2],coord[n+3]);n+=4; break; + case VG_CLOSE_PATH: + Log::getInstance()->log("OSD", Log::DEBUG, "Close Path"); break; + } + + }*/ + //vguRect(path,0.f,0.f,1.f,1.f); + //Log::getInstance()->log("OSD", Log::DEBUG, "Create APD Glyph %d %x",segments.size(),vgGetError()); + } + VGfloat ori[]={0.f,0.f}; + VGfloat esp[]={ft_face->glyph->advance.x/64.f*aspect_correction,ft_face->glyph->advance.y/64.f}; + font_exp_x[glyph]=ft_face->glyph->advance.x/64.f*aspect_correction; //recalculate + + vgSetGlyphToPath(vgfont,glyph,path,VG_FALSE,ori,esp); + //Log::getInstance()->log("OSD", Log::DEBUG, "Create Glyph %d %d %x",path,glyph,vgGetError()); + if (path!=VG_INVALID_HANDLE) { + vgDestroyPath(path); + } + cur_char = FT_Get_Next_Char(ft_face,cur_char,&glyph); + } + return 1; +} + + +void OsdOpenVG::drawSetTrans(SurfaceCommands & sc) +{ + vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); + vgLoadIdentity(); + vgScale(((float)BACKBUFFER_WIDTH)/720.f, -((float)BACKBUFFER_HEIGHT)/576.f); + vgTranslate(0.f+sc.x,-576.f+sc.y); + + vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE); + vgLoadIdentity(); + vgScale(((float)BACKBUFFER_WIDTH)/720.f, -((float)BACKBUFFER_HEIGHT)/576.f); + vgTranslate(0.f+sc.x,-576.f+sc.y); + + vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); + vgLoadIdentity(); + vgScale(((float)BACKBUFFER_WIDTH)/720.f, -((float)BACKBUFFER_HEIGHT)/576.f); + vgTranslate(0.f+sc.x,-576.f+sc.y); + + + + //vgTranslate(0.f+sc.x,576.f-sc.y); + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Translate %g %g",sc.x,sc.y); + +} +void OsdOpenVG::executeDrawCommand(SVGCommand & command) +{ + + VGfloat save_matrix[9]; + switch (command.instr) { + case DrawPath: { + vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); + // VGuint rgba; + // rgba = vgGetColor((VGPaint) command.reference); + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Path %d %x %g %g %g %g",command.reference,command.target.path_index,command.x,command.y,command.w,command.h); + //vgSeti(VG_FILL_RULE,); + + vgGetMatrix(save_matrix); + vgSetPaint((VGPaint) command.reference,VG_FILL_PATH); + vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH); + vgTranslate(command.x,command.y); + vgScale(command.w,command.h); + vgDrawPath(std_paths[command.target.path_index],VG_FILL_PATH); + vgLoadMatrix(save_matrix); + } break; + case DrawImage: { + vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); + vgGetMatrix(save_matrix); + vgTranslate(command.x,command.y); + //vgScale(command.w,command.h); + if (command.reference) { //special behaviout for bw images they act as a mask on the current paint + vgSetPaint((VGPaint) command.reference,VG_FILL_PATH); + vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH); + vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_STENCIL); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); + vgScale(aspect_correction,1.f); + } else { + //vgScale(720.f/((float)BACKBUFFER_WIDTH), 576.f/((float)BACKBUFFER_HEIGHT)); + vgScale(aspect_correction,1.f); + vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL); + } + + + //vgLoadIdentity(); + //vgTranslate(200.f,500.f); + //vgScale(100.f,100.f); + + vgDrawImage((VGImage) command.target.image); + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw Image %d %x %g %g %g %g %x",command.reference,command.target.image,command.x,command.y,command.w,command.h, + // vgGetError()); + if (command.reference) { + vgSeti(VG_IMAGE_MODE,VG_DRAW_IMAGE_NORMAL); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); + } + vgLoadMatrix(save_matrix); + } break; + case DrawGlyph: { + vgSeti(VG_MATRIX_MODE, VG_MATRIX_GLYPH_USER_TO_SURFACE); + vgGetMatrix(save_matrix); + vgSetPaint((VGPaint) command.reference,VG_FILL_PATH); + vgSetPaint((VGPaint) command.reference,VG_STROKE_PATH); + vgTranslate(command.x,command.y); + // vgLoadIdentity(); + // vgTranslate(500.,500.); + //vgScale(18.f,18.f); + VGfloat gori[]={0.,0.}; + vgSetfv(VG_GLYPH_ORIGIN,2,gori); + + unsigned int glyph_index=FT_Get_Char_Index(ft_face,command.target.textchar); + vgDrawGlyph(vgfont,glyph_index,VG_FILL_PATH,VG_FALSE); + //vgDrawPath(std_paths[Rectangle],VG_FILL_PATH); + /* Log::getInstance()->log("OSD", Log::DEBUG, "Draw Glyph %d %c %d %g %g %x",command.reference,command.target.textchar,glyph_index,command.x,command.y, + vgGetError());*/ + vgLoadMatrix(save_matrix); + vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE); + } break; + case DrawTTchar:{ + + }break; + } +} + +unsigned int OsdOpenVG::handleTask(OpenVGCommand& command) +{ + switch (command.task){ + case OVGdestroyImageRef: { + vgDestroyImage((VGImage)command.param1); + return 0; + } break; + case OVGdestroyPaint: { + Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint Destroy %d ",command.param1); + vgDestroyPaint((VGPaint)command.param1); + return 0; + } break; + case OVGcreateImageRGBA: { + return vgCreateImage(VG_sRGBA_8888,command.param1, command.param2, + VG_IMAGE_QUALITY_NONANTIALIASED| + VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + } break; + case OVGcreateMonoBitmap: { + VGImage handle=vgCreateImage(VG_A_1,command.param1, command.param2, + VG_IMAGE_QUALITY_NONANTIALIASED| + VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create mono %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + unsigned int buffer_len=(command.param1*command.param2)>>3; + unsigned char * buffer=(unsigned char*)malloc(buffer_len); + unsigned char * r_buffer1=buffer; + const unsigned char * r_buffer2=(const unsigned char *)command.data; + unsigned char *buffer_end=buffer+buffer_len; + while (r_buffer1!=buffer_end) { + unsigned char byte=*r_buffer2; + *r_buffer1=((byte * 0x0802LU & 0x22110LU) | (byte * 0x8020LU & 0x88440LU)) * 0x10101LU >> 16; + r_buffer1++;r_buffer2++; + } + + + vgImageSubData(handle,buffer,command.param1>>3, + VG_A_1,0,0,command.param1, command.param2); + free(buffer); + // Log::getInstance()->log("OSD", Log::DEBUG, "Draw create mono2 %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + return handle; + } break; + case OVGcreateImageFile: { + VGImage handle; + try{ + Image *imagefile=(Image*)command.data; + Blob imageblob; + imagefile->write(&imageblob,"RGBA"); + + + handle=vgCreateImage(VG_sXBGR_8888,imagefile->columns(),imagefile->rows(), + VG_IMAGE_QUALITY_NONANTIALIASED| + VG_IMAGE_QUALITY_FASTER|VG_IMAGE_QUALITY_BETTER); + // Log::getInstance()->log("OSD", Log::DEBUG, "Draw create image details %d %d %x mark1",imagefile->columns(),imagefile->rows(),*(unsigned int*)imageblob.data()); + vgImageSubData(handle,imageblob.data(),imagefile->columns()*4, + VG_sXBGR_8888,0,0,imagefile->columns(),imagefile->rows()); + // Log::getInstance()->log("OSD", Log::DEBUG, "Draw create image details %d %d %x mark2",imagefile->columns(),imagefile->rows(),*(unsigned int*)imageblob.data()); + delete imagefile; + }catch( Exception &error_ ) + { + Log::getInstance()->log("OSD", Log::DEBUG, "Libmagick hT: %s",error_.what()); + + return 0; + } + + //Log::getInstance()->log("OSD", Log::DEBUG, "Draw create file %d %d %x %d",command.param1,command.param2,vgGetError(),handle); + return handle; + } break; + case OVGcreateColorRef :{ + VGPaint handle; + handle=vgCreatePaint(); + vgSetParameteri(handle, VG_PAINT_TYPE, VG_PAINT_TYPE_COLOR); + vgSetColor(handle,command.param1); + VGuint rgba; + rgba = vgGetColor((VGPaint)handle); + Log::getInstance()->log("OSD", Log::DEBUG, "Draw Paint %d %x %x",handle,command.param1,rgba); + return handle; + } break; + case OVGimageUploadLine: { + vgImageSubData((VGImage)command.param1,command.data,0,VG_sARGB_8888,0,command.param2,command.param3,1); + return 0; + } break; + + } +} + +bool OsdOpenVG::processTasks() +{ + bool worked=false; + taskmutex.Lock(); + vgmutex.Lock(); + while (vgcommands.size()>0) + { + OpenVGCommand &comm=vgcommands.front(); + OpenVGResponse resp; + resp.result=handleTask(comm); + resp.id=comm.id; + if (comm.id) { + vgresponses.push_back(resp); + } + vgcommands.pop_front(); + taskmutex.Unlock(); + vgmutex.Unlock(); + //threadCheckExit(); + pthread_mutex_lock(&vgtaskCondMutex); + pthread_cond_signal(&vgtaskCond); + pthread_mutex_unlock(&vgtaskCondMutex); + taskmutex.Lock(); + vgmutex.Lock(); + worked=true; + } + taskmutex.Unlock(); + vgmutex.Unlock(); + + return worked; +} + +bool OsdOpenVG::haveOpenVGResponse(unsigned int id,unsigned int * resp) +{ + taskmutex.Lock(); + if (vgresponses.size()>0) + { + deque::iterator itty=vgresponses.begin(); + while (itty!=vgresponses.end()) + { + if ((*itty).id==id) { + *resp=(*itty).result; + taskmutex.Unlock(); + return true; + } + itty++; + } + } + taskmutex.Unlock(); + return false; +} + + +unsigned int OsdOpenVG::putOpenVGCommand(OpenVGCommand& comm,bool wait) +{ + taskmutex.Lock(); + if (wait){ + comm.id=wait_id; + wait_id++; + } else { + comm.id=0; // we are not waiting + } + vgcommands.push_back(comm); + taskmutex.Unlock(); + threadSignal(); + while (wait) { + unsigned int resp; + if (!haveOpenVGResponse(comm.id,&resp)) { + struct timespec target_time; + clock_gettime(CLOCK_REALTIME,&target_time); + target_time.tv_nsec+=1000000LL*100; + if (target_time.tv_nsec>999999999) { + target_time.tv_nsec-=1000000000L; + target_time.tv_sec+=1; + } + pthread_mutex_lock(&vgtaskCondMutex); + pthread_cond_timedwait(&vgtaskCond, &vgtaskCondMutex,&target_time); + pthread_mutex_unlock(&vgtaskCondMutex); + } else { + return resp; + } + } + return 0; +} + +void OsdOpenVG::imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data) +{ + vgImageSubData((VGImage)index,data,0,VG_sARGB_8888,0,j,width,1); + + struct OpenVGCommand comm; + comm.task=OVGimageUploadLine; + comm.param1=index; + comm.param2=j; + comm.param3=width; + comm.data=data; + putOpenVGCommand(comm,true); +} + +void OsdOpenVG::destroyImageRef(ImageIndex index) +{ + struct OpenVGCommand comm; + comm.task=OVGdestroyImageRef; + comm.param1=index; + putOpenVGCommand(comm,false); +} + +ImageIndex OsdOpenVG::createJpeg(const char* fileName, int *width,int *height) +{ + Image* magicimage=NULL; + bool mem=false; + struct OpenVGCommand comm; + comm.task=OVGcreateImageFile; + + try{ + // Now figure out, if it is a special case + if (strcmp(fileName,"/vdr.jpg")==0) { + magicimage=new Image(Blob(vdr_data,vdr_data_end-vdr_data)); + *height=100; // this is faked so that the system does use the old coordinate system + *width=ceil(190.f*aspect_correction); + Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm vdr.jpg"); + } else if (strcmp(fileName,"/wallpaperPAL.jpg")==0) { + magicimage=new Image(Blob(wallpaper_data,wallpaper_data_end-wallpaper_data)); + *width=720; // this is faked so that the system does use the old coordinate system + *height=576; + Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm wallpaperPAL.jpg"); + } else { + magicimage=new Image(); + magicimage->read(fileName); + Log::getInstance()->log("OSD", Log::DEBUG, "LoadIm file: %s",fileName); + *width=ceil(magicimage->baseColumns()*aspect_correction); // this is faked so that the system does use the old coordinate system + *height=magicimage->baseRows(); + } + + }catch( Exception &error_ ) + { + Log::getInstance()->log("OSD", Log::DEBUG, "Libmagick: %s",error_.what()); + + return 0; + } + comm.data=magicimage; + return putOpenVGCommand(comm,true); +} + +ImageIndex OsdOpenVG::createMonoBitmap(void *base,int width,int height) +{ + struct OpenVGCommand comm; + comm.task=OVGcreateMonoBitmap; + comm.param1=width; + comm.param2=height; + comm.data=base; + return putOpenVGCommand(comm,true); +} + +ImageIndex OsdOpenVG::createImageRGBA(int width,int height) +{ + struct OpenVGCommand comm; + comm.task=OVGcreateImageRGBA; + comm.param1=width; + comm.param2=height; + return putOpenVGCommand(comm,true); +} + +void OsdOpenVG::destroyStyleRef(unsigned int index) +{ + struct OpenVGCommand comm; + comm.task=OVGdestroyPaint; + comm.param1=index; + putOpenVGCommand(comm,false); +} + +unsigned int OsdOpenVG::createStyleRef(const DrawStyle &c) +{ + unsigned int col=c.rgba(); + struct OpenVGCommand comm; + comm.task=OVGcreateColorRef; + comm.param1=col<<8 | (col &0xff000000)>>24; + comm.data=&c; + return putOpenVGCommand(comm,true); +} + +unsigned int OsdOpenVG::createColorRef(const Colour &c) +{ + unsigned int col=c.rgba(); + struct OpenVGCommand comm; + comm.task=OVGcreateColorRef; + comm.param1=col<<8 | (col &0xff000000)>>24; + comm.data=&c; + return putOpenVGCommand(comm,true); +} + + diff --git a/osdopenvg.h b/osdopenvg.h new file mode 100644 index 0000000..3d4e5f4 --- /dev/null +++ b/osdopenvg.h @@ -0,0 +1,152 @@ +/* + Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef OSDOPENVG_H +#define OSDOPENVG_H + +#include + + +#include +#include +#include +#include + + + +#include "osdvector.h" +#include "defines.h" +#include "log.h" +#include "threadp.h" +#include "mutex.h" +#include "videoomx.h" + +#include + +#include +#include FT_FREETYPE_H + +enum OpenVGTask { + OVGdestroyImageRef, + OVGdestroyPaint, + OVGcreateImageRGBA, + OVGcreateMonoBitmap, + OVGcreateColorRef, + OVGimageUploadLine, + OVGcreateImageFile +}; + +struct OpenVGCommand +{ + enum OpenVGTask task; + const void *data; + unsigned int param1,param2,param3; + unsigned int id; //only set an id if you are waiting +}; + +struct OpenVGResponse{ + unsigned int id; + unsigned int result; +}; + + +class OsdOpenVG : public OsdVector, public Thread_TYPE +{ + public: + OsdOpenVG(); + virtual ~OsdOpenVG(); + + int init(void* device); + int shutdown(); + + + float getFontHeight(); + float getCharWidth(wchar_t c); + void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data); + + +protected: + /*osd vector implementation*/ + void destroyImageRef(ImageIndex index); + ImageIndex createJpeg(const char* fileName, int *width,int *height); + ImageIndex createMonoBitmap(void *base,int width,int height); + ImageIndex createImageRGBA(int width,int height); + void destroyStyleRef(unsigned int index); + unsigned int createStyleRef(const DrawStyle &c); + unsigned int createColorRef(const Colour &c); + + void drawSetTrans(SurfaceCommands & sc); + void executeDrawCommand(SVGCommand & command); + + void initPaths(); + void destroyPaths(); + VGPath std_paths[Point+1]; + long long lastrendertime; + void InternalRendering(); + + + + Mutex vgmutex; + Mutex taskmutex; + pthread_cond_t vgtaskCond; + pthread_mutex_t vgtaskCondMutex; + deque vgcommands; + deque vgresponses; + bool processTasks(); + bool haveOpenVGResponse(unsigned int id,unsigned int * resp); + unsigned int putOpenVGCommand(OpenVGCommand& comm,bool wait); + unsigned int handleTask(OpenVGCommand& command); + unsigned int wait_id; + + FT_Library ft_library; + FT_Face ft_face; + VGFont vgfont; + int loadFont(); + map font_exp_x; + + + + void threadMethod(); + void threadPostStopCleanup(); + + + /* BCM specific */ + + uint32_t display_height; + uint32_t display_width; + DISPMANX_DISPLAY_HANDLE_T bcm_display; + DISPMANX_ELEMENT_HANDLE_T bcm_element; + DISPMANX_ELEMENT_HANDLE_T bcm_background; + DISPMANX_RESOURCE_HANDLE_T bcm_backres; + + uint32_t mode; + + + EGLDisplay egl_display; + EGLSurface egl_surface; + EGLContext egl_context; + EGLConfig egl_ourconfig; + float font_height; + float aspect_correction; + + +}; + +#endif diff --git a/osdvector.cc b/osdvector.cc new file mode 100644 index 0000000..5663fa9 --- /dev/null +++ b/osdvector.cc @@ -0,0 +1,336 @@ +/* + Copyright 2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "osdvector.h" +#include "surfacevector.h" + +OsdVector::OsdVector() +{ + setlocale(LC_CTYPE,"C.UTF-8"); +} + +OsdVector::~OsdVector() +{ + +} + + +int OsdVector::getFD() +{ + return 0; +} + +void OsdVector::screenShot(const char* fileName) +{ + //Do nothing, +} + +Surface * OsdVector::createNewSurface() +{ + return new SurfaceVector(this); +} + +void OsdVector::BeginPainting() +{ + surfaces_mutex.Lock(); +} +void OsdVector::EndPainting() +{ + surfaces_mutex.Unlock(); +} + +void OsdVector::Blank() +{ + // do nothing? remove this one? +} + +void OsdVector::drawSurfaces() +{ + surfaces_mutex.Lock(); + list todraw; //First figure out if a surfaces is below another surface + list::iterator itty1=scommands.begin(); + while (itty1!=scommands.end()) { + list::iterator itty2=itty1; + itty2++; + bool hidden=false; + while (itty2!=scommands.end()) { + SurfaceCommands & ref1=*itty1; + SurfaceCommands & ref2=*itty2; + if (ref1.x>=ref2.x && ref1.y>=ref2.y + && (ref1.x+ref1.w) <= (ref2.x+ref2.w) + && (ref1.y+ref1.h) <= (ref2.y+ref2.h) ) { + hidden=true; + break; + } + itty2++; + } + if (!hidden) { // we are not hidden, perfect + todraw.push_back(&(*itty1)); + } + itty1++; + } + //Now go through all surfaces and draw them + list::iterator curdraw=todraw.begin(); + while (curdraw!=todraw.end()) { + drawSetTrans(*(*curdraw)); + list::iterator commands=(*(*curdraw)).commands.begin(); + list::iterator end=(*(*curdraw)).commands.end(); + while (commands!=end) { + executeDrawCommand(*commands); + commands++; + } + curdraw++; + } + + surfaces_mutex.Unlock(); +} + + +void OsdVector::updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width, + list& commands) +{ + surfaces_mutex.Lock(); + //First determine it is already in our system + list::iterator itty=scommands.begin(); + while (itty!=scommands.end()) { + if ((*itty).surf==surf) { + //decrease the references + dereferenceSVGCommand((*itty).commands); + break; + } + itty++; + } + // if not insert it + if (itty==scommands.end()) { + SurfaceCommands new_sc; + new_sc.surf=surf; + new_sc.x=x; + new_sc.y=y; + new_sc.w=width; + new_sc.h=height; + itty=scommands.insert(itty,new_sc); + } + // then clear and copy + (*itty).commands.clear(); + (*itty).commands=commands; + //increase the references + list::iterator sitty=(*itty).commands.begin(); + while (sitty!=(*itty).commands.end()) + { + incStyleRef((*sitty).getRef()); + ImageIndex ii=(*sitty).getImageIndex(); + if (ii) incImageRef(ii); + sitty++; + } + cleanupOrphanedRefs(); + + surfaces_mutex.Unlock(); +} + +void OsdVector::removeSurface(const SurfaceVector *surf) +{ + surfaces_mutex.Lock(); + //First determine it is already in our system + list::iterator itty=scommands.begin(); + while (itty!=scommands.end()) { + if ((*itty).surf==surf) { + dereferenceSVGCommand((*itty).commands); + (*itty).commands.clear(); + scommands.erase(itty); + break; + } + itty++; + } + surfaces_mutex.Unlock(); + +} + +void OsdVector::dereferenceSVGCommand(list& commands ) +{ + + list::iterator sitty = commands.begin(); + while (sitty != commands.end()) { + removeStyleRef((*sitty).getRef()); + ImageIndex ii = (*sitty).getImageIndex(); + if (ii) removeImageRef(ii); + sitty++; + } +} + +void OsdVector::referenceSVGCommand(list& commands ) +{ + list::iterator sitty=commands.begin(); + while (sitty!=commands.end()) + { + incStyleRef((*sitty).getRef()); + ImageIndex ii=(*sitty).getImageIndex(); + if (ii) incImageRef(ii); + sitty++; + } +} + +void OsdVector::incImageRef(ImageIndex index) +{ + if (images_ref.find(index)==images_ref.end()) { + images_ref[index]=1; + } else { + images_ref[index]++; + } +} + +void OsdVector::removeImageRef(const ImageIndex ref) +{ + images_ref[ref]--; +} + +void OsdVector::cleanupOrphanedRefs() +{ // Do some garbage collection + map::iterator iitty=images_ref.begin(); + while (iitty!=images_ref.end()) { + int count=(*iitty).second; + if (count==0) { + ImageIndex ref=(*iitty).first; + images_ref.erase(iitty++); + destroyImageRef(ref); + } else ++iitty; + } + map::iterator sitty=styles_ref.begin(); + while (sitty!=styles_ref.end()) { + int count=(*sitty).second; + if (count==0) { + unsigned int ref=(*sitty).first; + styles_ref.erase(sitty++); + destroyStyleRef(ref); + } else ++sitty; + + } +} + + +unsigned int OsdVector::getImageRef(ImageIndex index) +{ + if (images_ref.find(index)==images_ref.end()) { + return -1; + } else { + return images_ref[index]; + } +} + +void OsdVector::incStyleRef(unsigned int index) +{ + if (styles_ref.find(index)==styles_ref.end()) { + styles_ref[index]=1; + } else { + styles_ref[index]++; + } +} + +void OsdVector::removeStyleRef(unsigned int index) +{ + styles_ref[index]--; +} + +unsigned int OsdVector::getStyleRef(const DrawStyle &c) +{ + unsigned int style_handle=0; + if (styles.find(pair((Colour*)&c,c.rgba()))==styles.end()) + { + style_handle=styles[pair((Colour*)&c,c.rgba())]=createStyleRef(c); + } else { + style_handle=styles[pair((Colour*)&c,c.rgba())]; + //Now check if the handle is valid + if (styles_ref.find(style_handle)==styles_ref.end()) { + //invalid handle recreate + style_handle=styles[pair((Colour*)&c,c.rgba())]=createStyleRef(c); + } + } + incStyleRef(style_handle); + return style_handle; +} + +unsigned int OsdVector::getColorRef(const Colour &c) +{ + unsigned int style_handle=0; + if (styles.find(pair((Colour*)&c,c.rgba()))==styles.end()) + { + style_handle=styles[pair((Colour*)&c,c.rgba())]=createColorRef(c); + } else { + style_handle=styles[pair((Colour*)&c,c.rgba())]; + if (styles_ref.find(style_handle)==styles_ref.end()) { + //invalid handle recreate + style_handle=styles[pair((Colour*)&c,c.rgba())]=createColorRef(c); + } + } + incStyleRef(style_handle); + return style_handle; +} + +unsigned int OsdVector::getStyleRef(unsigned int index) +{ + if (styles_ref.find(index)==styles_ref.end()) { + return -1; + } else { + return styles_ref[index]; + } +} + +ImageIndex OsdVector::getJpegRef(const char* fileName, int *width,int *height) +{ + ImageIndex image_handle=0; + if (jpegs.find(fileName)==jpegs.end()) + { + image_handle=jpegs[fileName]=createJpeg(fileName,width,height); + } else { + image_handle=jpegs[fileName]; + *width=0; + *height=0; + if (images_ref.find(image_handle)==images_ref.end()) { + //invalid handle recreate + image_handle=jpegs[fileName]=createJpeg(fileName,width,height); + } + } + incImageRef(image_handle); + return image_handle; +} + +ImageIndex OsdVector::getMonoBitmapRef(void *base,int width,int height) +{ + ImageIndex image_handle; + if (monobitmaps.find(base)==monobitmaps.end()) + { + image_handle=monobitmaps[base]=createMonoBitmap(base,width,height); + } else { + image_handle=monobitmaps[base]; + if (images_ref.find(image_handle)==images_ref.end()) { + //invalid handle recreate + image_handle=monobitmaps[base]=createMonoBitmap(base,width,height); + } + } + incImageRef(image_handle); + return image_handle; +} + +ImageIndex OsdVector::getImageRGBA(int width,int height) +{ + ImageIndex image_handle; + image_handle=createImageRGBA(width,height); + incImageRef(image_handle); + return image_handle; +} diff --git a/osdvector.h b/osdvector.h new file mode 100644 index 0000000..13b49c4 --- /dev/null +++ b/osdvector.h @@ -0,0 +1,201 @@ +/* + Copyright 2004-2005 Chris Tallon, 2006,2011-2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef OSDVECTOR_H +#define OSDVECTOR_H +#include "osd.h" +#include "mutex.h" +#include "colour.h" +#include +#include +#include + +#include "teletextdecodervbiebu.h" + +enum SVGCommandInstr { + DrawPath, + DrawGlyph, + DrawImage, + DrawTTchar +}; +enum PathIndex { + HorzLine, + VertLine, + Rectangle, + Point +}; + +typedef unsigned int ImageIndex; + +class SVGCommand +{ +public: + SVGCommand(float ix, float iy,float iw,float ih,PathIndex path,unsigned int ref) + { + instr=DrawPath; + x=ix; + y=iy; + w=iw; + h=ih; + target.path_index=path; + reference=ref; + }; + SVGCommand(float ix, float iy,float iw,float ih,ImageIndex image_in,unsigned int ref) + { + instr=DrawImage; + x=ix; + y=iy; + w=iw; + h=ih; + target.image=image_in; + reference=ref; + }; + SVGCommand(float ix, float iy,float iw,float ih,unsigned int ttchar_in) + { + instr=DrawTTchar; + x=ix; + y=iy; + w=iw; + h=ih; + reference=0; + target.ttchar=ttchar_in; + }; + SVGCommand(float ix, float iy,wchar_t char_in,unsigned int ref) + { + instr=DrawGlyph; + x=ix; + y=iy; + w=0; + h=0; + reference=ref; + target.textchar=char_in; + }; + + bool Test(float tx,float ty,float tw, float th) + { + return (x>=tx) && (y>=ty) && ((x+w)<=(tx+tw)) && ((y+h)<=(ty+th)); + } + unsigned int getRef(){return reference;}; + ImageIndex getImageIndex() { + if (instr!=DrawImage) return 0; + else return target.image; + }; + SVGCommandInstr instr; + float x,y,w,h; + unsigned int reference; + union { + PathIndex path_index; //path_index + wchar_t textchar; + ImageIndex image; + unsigned int ttchar; + } target; +}; + +class SurfaceVector; + +struct SurfaceCommands{ + const SurfaceVector* surf; + list commands; + float x,y,w,h; +}; + + +class OsdVector : public Osd +{ + public: + OsdVector(); + virtual ~OsdVector(); + + + int getFD(); + + void screenShot(const char* fileName); + + Surface * createNewSurface(); + void BeginPainting(); + void EndPainting(); + + void Blank(); + + void updateOrAddSurface(const SurfaceVector *surf,float x,float y,float height,float width, + list& commands); + void removeSurface(const SurfaceVector *surf); + + virtual float getFontHeight()=0; + virtual float getCharWidth(wchar_t c)=0; + + virtual ImageIndex getJpegRef(const char* fileName, int *width,int *height); + virtual ImageIndex getMonoBitmapRef(void *base,int width,int height); + virtual ImageIndex getImageRGBA(int width,int height); + virtual void imageUploadLine(ImageIndex index,unsigned int j,unsigned int width,void *data)=0; + void removeImageRef(const ImageIndex ref); + unsigned int getColorRef(const Colour &c); //internally this is the same as getStyleRef + unsigned int getStyleRef(const DrawStyle &c); + virtual void removeStyleRef(unsigned int ref); + + + int charSet() {return 2;}; //UTF-8 + + + +protected: + + void incImageRef(ImageIndex index); + unsigned int getImageRef(ImageIndex index); + virtual void destroyImageRef(ImageIndex index)=0; + virtual ImageIndex createJpeg(const char* fileName, int *width,int *height)=0; + virtual ImageIndex createMonoBitmap(void *base,int width,int height)=0; + virtual ImageIndex createImageRGBA(int width,int height)=0; + + map images_ref; + map monobitmaps; + map jpegs; + + void incStyleRef(unsigned int index); + unsigned int getStyleRef(ImageIndex index); + virtual void destroyStyleRef(unsigned int index)=0; + map,unsigned int> styles; + map styles_ref; + virtual unsigned int createStyleRef(const DrawStyle &c)=0; + virtual unsigned int createColorRef(const Colour &c)=0; + + void dereferenceSVGCommand(list& commands ); + void referenceSVGCommand(list& commands ); + void cleanupOrphanedRefs(); + + + + virtual void drawSetTrans(SurfaceCommands & sc)=0; + virtual void executeDrawCommand(SVGCommand & command)=0; + + + + + list scommands; + + Mutex surfaces_mutex; + + void drawSurfaces(); +}; + + + + +#endif diff --git a/other/licence.txt b/other/licence.txt index f780226..7c3b49e 100644 --- a/other/licence.txt +++ b/other/licence.txt @@ -3,6 +3,10 @@ vdr.jpg is lifted from VDR's home page which states: Any information posted on these pages is freely available to anybody. All source code published here is protected by the GNU general public licence." +Note: +VDR Logo (c) by Jan Grell +Licensed under Creative Commons Licence. + ------------------------------------------------------------------ wallpaper.jpg is actually blue-bend.jpg from the KDE wallpapers. diff --git a/other/vdrhires.jpg b/other/vdrhires.jpg new file mode 100644 index 0000000..03145c3 Binary files /dev/null and b/other/vdrhires.jpg differ diff --git a/other/wallpaper720p.jpg b/other/wallpaper720p.jpg new file mode 100644 index 0000000..4f6eb56 Binary files /dev/null and b/other/wallpaper720p.jpg differ diff --git a/surface.cc b/surface.cc index f8556fa..40b61b7 100644 --- a/surface.cc +++ b/surface.cc @@ -166,9 +166,9 @@ int Surface::drawTextCentre(const char* text, int x, int y, const DrawStyle& c) else return drawText(text, x, y, c); } -int Surface::getCharWidth(char c) +float Surface::getCharWidth(wchar_t c) { - return font->width[(unsigned char) c]; + return (float)font->width[(unsigned char) c]; } int Surface::getFontHeight() @@ -176,6 +176,12 @@ int Surface::getFontHeight() return font->spacing; } + wchar_t Surface::getWChar(const char* str, unsigned int *length) + { + *length=1; + return *str; + } + //Moved from Teletext view in order to allow device depend optimizations Colour Surface::enumTeletextColorToCoulour(enumTeletextColor ttcol) @@ -313,7 +319,7 @@ void Surface::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height, endFastDraw(); } -void Surface::drawPoint(int x, int y, Colour& c, bool fastdraw) +void Surface::drawPoint(int x, int y, DrawStyle& c, bool fastdraw) { drawPixel(x,y,c,fastdraw); } diff --git a/surface.h b/surface.h index 294f6a6..5777d9c 100644 --- a/surface.h +++ b/surface.h @@ -56,7 +56,8 @@ class Surface static Surface* getScreen(); virtual int getFontHeight(); - virtual int getCharWidth(char c); + virtual float getCharWidth(wchar_t c); + virtual wchar_t getWChar(const char* str, unsigned int *length); virtual int drawText(const char* text, int x, int y, const DrawStyle& c); virtual int drawText(const char* text, int x, int y, int width, const DrawStyle& c); @@ -72,7 +73,7 @@ class Surface virtual void drawHorzLine(int x1, int x2, int y, const DrawStyle& c)=0; virtual void drawVertLine(int x, int y1, int y2, const DrawStyle& c)=0; virtual void drawBitmap(int x, int y, const Bitmap& bm)=0; - virtual void drawPoint(int x, int y, Colour& c, bool fastdraw=false); // This draws a point, must not be a pixel + virtual void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel virtual void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); virtual int updateToScreen(int sx, int sy, int w, int h, int dx, int dy)=0; virtual void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b)=0; diff --git a/surfacedirectfb.h b/surfacedirectfb.h index 9fc9b79..e1870ea 100644 --- a/surfacedirectfb.h +++ b/surfacedirectfb.h @@ -44,7 +44,7 @@ class SurfaceDirectFB : public Surface { public: SurfaceDirectFB(int id = 0); - ~SurfaceDirectFB(); + virtual ~SurfaceDirectFB(); int create(UINT width, UINT height); void display(); diff --git a/surfacemvp.h b/surfacemvp.h index 1bcb37d..02db48b 100644 --- a/surfacemvp.h +++ b/surfacemvp.h @@ -154,7 +154,7 @@ class SurfaceMVP : public Surface { public: SurfaceMVP(int id = 0); - ~SurfaceMVP(); + virtual ~SurfaceMVP(); int create(UINT width, UINT height); void display(); diff --git a/surfacevector.cc b/surfacevector.cc new file mode 100644 index 0000000..6637aa4 --- /dev/null +++ b/surfacevector.cc @@ -0,0 +1,278 @@ +/* + Copyright 2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include "surfacevector.h" +#include "bitmap.h" +#include +#include + +SurfaceVector::SurfaceVector(OsdVector* vosd) +{ + + osd=vosd; +} + +SurfaceVector::~SurfaceVector() +{ + osd->removeSurface(this); + list::iterator itty=commands.begin(); + while (itty!=commands.end()) + { + osd->removeStyleRef((*itty).getRef()); // We remove the Style reference, so that osd can free stuff + ImageIndex ii=(*itty).getImageIndex(); + if (ii) osd->removeImageRef(ii); + itty++; + } +} + + +int SurfaceVector::getFontHeight() +{ + return osd->getFontHeight(); +} + +float SurfaceVector::getCharWidth(wchar_t c) +{ + return osd->getCharWidth(c); +} + +wchar_t SurfaceVector::getWChar(const char* str, unsigned int *length) +{ + int mlength=0; + int max_length=4; + wchar_t tempo[1]; + size_t num_bytes=1; + if (str[0]=='\0') { + *length=1; + return '\0'; + } else if (str[1]=='\0'){ + max_length=2; + } else if (str[2]=='\0'){ + max_length=3; + } + mbstate_t state; + memset((void*)&state,0,sizeof(state)); + num_bytes=mbrtowc(tempo, str, max_length, &state); + if (num_bytes!=((size_t) -1) && num_bytes!=((size_t) -2)) + { + *length=num_bytes; + return *tempo; + } + *length=1; + return '?'; +} + + +int SurfaceVector::drawText(const char* text, int x, int y, const DrawStyle& c){ + return drawText(text, x, y, 0, c); +} + +int SurfaceVector::drawText(const char* text, int x, int y, int width, const DrawStyle& c) +{ + float shift=0.; + const char *run=text; + mbstate_t state; + wchar_t tempo[1]; + size_t num_bytes=1; + size_t length=strlen(text); + memset((void*)&state,0,sizeof(state)); + command_mutex.Lock(); + num_bytes=mbrtowc(tempo, run, length, &state); + while (num_bytes!=((size_t) -1) && num_bytes!=((size_t) -2) && length>0) + { + unsigned int ref=osd->getStyleRef(c); + commands.push_back(SVGCommand(x+shift,y,*tempo,ref)); + shift+=osd->getCharWidth(*tempo); + length -= num_bytes; + run += num_bytes; + if (shift>width && width >0) { + command_mutex.Unlock(); + return 1; + } + num_bytes=mbrtowc(tempo, run, length, &state); + } + command_mutex.Unlock(); + return 1; + +} +int SurfaceVector::drawTextRJ(const char* text, int x, int y, const DrawStyle& c) +{ + float shift=0.; + const char *run=text; + mbstate_t state; + wchar_t tempo[1]; + size_t num_bytes=1; + size_t length=strlen(text); + memset((void*)&state,0,sizeof(state)); + + num_bytes=mbrtowc(tempo, run, length, &state); + while (num_bytes!=((size_t) -1) && num_bytes!=((size_t) -2) && length>0) + { + shift+=osd->getCharWidth(*tempo); + length -= num_bytes; + run += num_bytes; + num_bytes=mbrtowc(tempo, run, length, &state); + } + return drawText(text, x-shift, y, c); +} + +int SurfaceVector::drawTextCentre(const char* text, int x, int y, const DrawStyle& c) +{ + float shift=0; + const char *run=text; + mbstate_t state; + wchar_t tempo[1]; + size_t num_bytes=1; + size_t length=strlen(text); + memset((void*)&state,0,sizeof(state)); + + num_bytes=mbrtowc(tempo, run, length, &state); + while (num_bytes!=((size_t) -1) && num_bytes!=((size_t) -2) && length>0) + { + shift+=osd->getCharWidth(*tempo); + length -= num_bytes; + run += num_bytes; + num_bytes=mbrtowc(tempo, run, length, &state); + } + return drawText(text, x-shift/2., y, c); +} + +void SurfaceVector::drawJpeg(const char *fileName,int x, int y,int *width, int *height) +{ + command_mutex.Lock(); + ImageIndex image=osd->getJpegRef(fileName,width,height); + commands.push_back(SVGCommand(x,y,*height,*width,image,0)); + command_mutex.Unlock(); +} + +int SurfaceVector::create(UINT width, UINT height) +{ + sheight=height; + swidth=width; + return 1; +} +void SurfaceVector::display() +{ + //nothing this is really mvp specific +} + +int SurfaceVector::fillblt(int x, int y, int width, int height, const DrawStyle& c) +{ + command_mutex.Lock(); + removeCommands(x,y,width,height); // remove commands below the box + unsigned int ref=osd->getStyleRef(c); + commands.push_back(SVGCommand(x,y,width,height,Rectangle,ref)); + command_mutex.Unlock(); + return 1; + +} +void SurfaceVector::drawHorzLine(int x1, int x2, int y, const DrawStyle& c) +{ + command_mutex.Lock(); + unsigned int ref=osd->getStyleRef(c); + commands.push_back(SVGCommand(x1,y,x2-x1,1,HorzLine,ref)); + command_mutex.Unlock(); +} + +void SurfaceVector::drawVertLine(int x, int y1, int y2, const DrawStyle& c){ + command_mutex.Lock(); + unsigned int ref=osd->getStyleRef(c); + commands.push_back(SVGCommand(x,y1,1,y2-y1,VertLine,ref)); + command_mutex.Unlock(); +} + +void SurfaceVector::drawBitmap(int x, int y, const Bitmap& bm) +{ + //this is complicated + command_mutex.Lock(); + ImageIndex image=osd->getImageRGBA(bm.getWidth(),bm.getHeight()); + unsigned int * data=(unsigned int*)malloc(sizeof(unsigned int)*bm.getWidth()); + for (UINT j = 0; j < bm.getHeight(); ++j){ + for (UINT i = 0; i < bm.getWidth(); ++i) + { + data[i]=bm.getColour(i,j); + } + osd->imageUploadLine(image,j,bm.getWidth(),data); + } + free(data); + commands.push_back(SVGCommand(x,y,bm.getHeight(),bm.getWidth(),image,0)); + command_mutex.Unlock(); +} + +void SurfaceVector::drawPoint(int x, int y, DrawStyle& c, bool fastdraw){ + if (!fastdraw) command_mutex.Lock(); + unsigned int ref=osd->getStyleRef(c); + commands.push_back(SVGCommand(x,y,1,1,Point,ref)); + if (!fastdraw) command_mutex.Unlock(); +} +void SurfaceVector::drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour) +{ + command_mutex.Lock(); + ImageIndex image=osd->getMonoBitmapRef(base,width,height); + unsigned int ref=osd->getColorRef(nextColour); + commands.push_back(SVGCommand(dx,dy,height,width,image,ref)); + command_mutex.Unlock(); +} + + +int SurfaceVector::removeCommands(float x,float y,float width,float height) +{ + // we iterate through all old commands in order to remove commands hidden by this rectangle + list::iterator itty=commands.begin(); + while (itty!=commands.end()) + { + if ((*itty).Test(x,y,width,height) ) { + osd->removeStyleRef((*itty).getRef()); // We remove the Style reference, so that osd can free stuff + ImageIndex ii=(*itty).getImageIndex(); + if (ii) osd->removeImageRef(ii); + itty=commands.erase(itty); + } else { + itty++; + } + } + return 1; + +} + +int SurfaceVector::updateToScreen(int sx, int sy, int w, int h, int dx, int dy) +{ + // ok this method really works in a pixel oriented way + command_mutex.Lock(); + osd->updateOrAddSurface(this,dx-sx,dy-sy,swidth,sheight,commands); + command_mutex.Unlock(); + return 1; +} + + +/* This is for systems which need a locking of the drawing surface to speed up drawing */ +void SurfaceVector::startFastDraw() { + command_mutex.Lock(); +} +void SurfaceVector::endFastDraw() { + command_mutex.Unlock(); +} + + +void SurfaceVector::drawTTChar(int ox, int oy,int x, int y, cTeletextChar c) +{ + command_mutex.Lock(); + commands.push_back(SVGCommand(ox,oy,x,y,c.getInternal())); + command_mutex.Unlock(); +} diff --git a/surfacevector.h b/surfacevector.h new file mode 100644 index 0000000..9a78174 --- /dev/null +++ b/surfacevector.h @@ -0,0 +1,93 @@ +/* + Copyright 2012 Marten Richter + + This file is part of VOMP. + + VOMP 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. + + VOMP 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 VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef SURFACEVECTOR_H +#define SURFACEVECTOR_H + +#include "surface.h" +#include "osdvector.h" + +#include + + +class SurfaceVector : public Surface +{ + public: + SurfaceVector(OsdVector* vosd); + virtual ~SurfaceVector(); + + int getFontHeight(); + float getCharWidth(wchar_t c); + wchar_t getWChar(const char* str, unsigned int *length); + + int drawText(const char* text, int x, int y, const DrawStyle& c); + int drawText(const char* text, int x, int y, int width, const DrawStyle& c); + int drawTextRJ(const char* text, int x, int y, const DrawStyle& c); + int drawTextCentre(const char* text, int x, int y, const DrawStyle& c); + + void drawJpeg(const char *fileName,int x, int y,int *width, int *height); + + int create(UINT width, UINT height); + void display(); + + int fillblt(int x, int y, int width, int height, const DrawStyle& c); + void drawHorzLine(int x1, int x2, int y, const DrawStyle& c); + void drawVertLine(int x, int y1, int y2, const DrawStyle& c); + void drawBitmap(int x, int y, const Bitmap& bm); + void drawPoint(int x, int y, DrawStyle& c, bool fastdraw=false); // This draws a point, must not be a pixel + void drawMonoBitmap(UCHAR* base, int dx, int dy, unsigned int height,unsigned int width, Colour& nextColour); + int updateToScreen(int sx, int sy, int w, int h, int dx, int dy); + + + /* This is for system which need a locking of the drawing surface to speed up drawing */ + void startFastDraw(); + void endFastDraw() ; + + + void drawTTChar(int ox, int oy,int x, int y, cTeletextChar c); + + void readPixel(int x, int y, unsigned char* r, unsigned char* g, unsigned char* b){}; + void screenShot(const char* fileName){}; + + protected: + + + int removeCommands(float x,float y,float width,float height); + + list commands; + int swidth, sheight; + Mutex command_mutex; + OsdVector* osd; + + void drawPixel(int x, int y, unsigned int c, bool fastdraw){}; // these are not supported! + void drawPixel(int x, int y, Colour& c, bool fastdraw){}; + + +}; + + + + + + + + + +#endif diff --git a/teletextdecodervbiebu.h b/teletextdecodervbiebu.h index 123486b..124ba83 100644 --- a/teletextdecodervbiebu.h +++ b/teletextdecodervbiebu.h @@ -234,6 +234,9 @@ public: { c=(Blink)?(c|BLINK):(c&~BLINK); } inline cTeletextChar ToBlink(bool Blink) { return cTeletextChar((Blink)?(c|BLINK):(c&~BLINK)); } + + inline void setInternal(unsigned int cc) {c=cc;}; + inline unsigned int getInternal() {return c;}; bool operator==(cTeletextChar &chr) { return c==chr.c; } bool operator!=(cTeletextChar &chr) { return c!=chr.c; } diff --git a/vchannellist.cc b/vchannellist.cc index d49955c..65a4859 100644 --- a/vchannellist.cc +++ b/vchannellist.cc @@ -149,7 +149,7 @@ void VChannelList::doShowingBar() char showing[200]; sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions()); - rectangle(220, 385, 220+160, 385+25, DrawStyle::VIEWBACKGROUND); + rectangle(220, 385,160, 25, DrawStyle::VIEWBACKGROUND); drawText(showing, 220, 385, DrawStyle::LIGHTTEXT); } diff --git a/vepg.cc b/vepg.cc index a8c79b2..c60f1cf 100644 --- a/vepg.cc +++ b/vepg.cc @@ -709,22 +709,25 @@ void VEpg::paintCell(Event* event, int yOffset, const DrawStyle& bg, const DrawS rectangle(x, y, w, h, bg); char* tt = new char[strlen(event->title) + 1]; strcpy (tt, event->title); - int textWidth = 0; - for (UINT textPos = 0; textPos < strlen(tt); textPos++) + float textWidth = 0; + unsigned int cur_length=1; + unsigned int text_max=strlen(tt); + UINT textPos; + for (textPos = 0; textPos w) // text will not fit in cell { - textWidth = textPos; break; } textWidth += thisCharWidth; } - char* tT = new char[textWidth]; - if(textWidth > 1) + char* tT = new char[textPos+1]; + if(textPos > 0) { - strncpy(tT, tt, textWidth - 1); - tT[textWidth - 1] = '\0'; + strncpy(tT, tt, textPos ); + tT[textPos ] = '\0'; surface->drawText(tT, x+2, y, fg); } delete tT; diff --git a/videoomx.cc b/videoomx.cc index 13704f6..3a219e9 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -22,9 +22,10 @@ #include "audioomx.h" #include "mtdraspberry.h" #include "demuxer.h" -#include "osdopengl.h" #include "vdr.h" #include "woptionpane.h" +#include "osdopenvg.h" + // temp #include "log.h" diff --git a/vscreensaver.cc b/vscreensaver.cc index 91e8543..fd5d4ea 100644 --- a/vscreensaver.cc +++ b/vscreensaver.cc @@ -83,8 +83,8 @@ void VScreensaver::threadMethod() fx = x[0] = 50; fy = y[0] = 50; - Colour black=(Colour)DrawStyle::BLACK; - Colour light=(Colour)DrawStyle::SELECTHIGHLIGHT; + DrawStyle &black=DrawStyle::BLACK; + DrawStyle &light=DrawStyle::SELECTHIGHLIGHT; while(1) { diff --git a/wsymbol.h b/wsymbol.h index 4cb59c9..026627d 100644 --- a/wsymbol.h +++ b/wsymbol.h @@ -29,6 +29,7 @@ class WSymbol : public Boxx public: WSymbol(); + //TODO add vector based Symbols void draw(); UCHAR nextSymbol; Colour nextColour; diff --git a/wtabbar.h b/wtabbar.h index 6b49f5a..db70ccd 100644 --- a/wtabbar.h +++ b/wtabbar.h @@ -40,7 +40,7 @@ class WTabBar : public Boxx { public: WTabBar(); - ~WTabBar(); + virtual ~WTabBar(); void addTab(const char* name, Boxx* boxx); int handleCommand(int command); bool mouseMove(int x, int y) ;