📄 gfxlib.c
字号:
/* openbios/vulcan/gfxLib.c, stbbios *//*------------------------------------------------------------------------------+|| This source code has been made available to you by IBM on an AS-IS| basis. Anyone receiving this source is licensed under IBM| copyrights to use it in any way he or she deems fit, including| copying it, modifying it, compiling it, and redistributing it either| with or without modifications. No license under IBM patents or| patent applications is to be implied by the copyright license.|| Any user of this software should understand that IBM cannot provide| technical support for this software and will not be responsible for| any consequences resulting from the use of this software.|| Any person who transfers this source code or any derivative work| must include the IBM copyright notice, this paragraph, and the| preceding two paragraphs in the transferred software.|| COPYRIGHT I B M CORPORATION 1995| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M|-------------------------------------------------------------------------------|-------------------------------------------------------------------------------|| File Name: gfxLib.c|| Function: STB OSD Boot logo support for Vulcan|| Author: Yang Yudong|| Change Activity-|| Date Description of Change BY| --------- --------------------- ---| 09-Jan-02 Created YYD| 24-Apr-02 taken from Vesta VK|------------------------------------------------------------------------------*/#undef DEBUG//#define DEBUG#include <ppcLib.h>#include <eval.h>#include <bootlogo.h>#include <string.h>extern nvram_t confdata;// public data structure that should be initialized by gfxLib.c#ifdef __GNUC__#pragma pack(1)#endiftypedef struct osdhdr { // basic osd hdr, 64 bits unsigned color_table_update : 1; unsigned region_hsize : 8; // we always use 8 bit color mode, so is high_color mode unsigned shade_level : 4; unsigned high_color : 1; // always 1 for 256 color mode unsigned start_row : 9; unsigned start_column : 9; unsigned link_addr : 16; unsigned color_resolution : 1; // always 0 for 256 color mode unsigned region_vsize : 9; unsigned pixel_resolution : 1; unsigned blend_level : 4; unsigned force_transparency : 1; // extended hdr unsigned extlink_addr :19; unsigned extlink_addr_lsb :4; unsigned hsb_ext :2; unsigned h_ext :1; // set to 1 unsigned dcus :1; unsigned shade_ext :2; unsigned dcub :1; unsigned blend_ext :2; unsigned h_fir_scaling :4; unsigned titling_ctrl :2; unsigned anti_flicker :2; unsigned res2 :4; unsigned chroma_lnk_en :1; unsigned chroma_lnk :19; // palette section 512 unsigned chars unsigned short palette[256]; // bitmap data should follow here} osdhdr_t;static struct gfx_palette{ unsigned char r, g, b;} webpalette[256] = { // from 000-215 216 color web safe palette {0xff, 0xff, 0xff }, // 000 {0xff, 0xff, 0xcc }, // 001 {0xff, 0xff, 0x99 }, // 002 {0xff, 0xff, 0x66 }, // 003 {0xff, 0xff, 0x33 }, // 004 {0xff, 0xff, 0x00 }, // 005 {0xff, 0xcc, 0xff }, // 006 {0xff, 0xcc, 0xcc }, // 007 {0xff, 0xcc, 0x99 }, // 008 {0xff, 0xcc, 0x66 }, // 009 {0xff, 0xcc, 0x33 }, // 010 {0xff, 0xcc, 0x00 }, // 011 {0xff, 0x99, 0xff }, // 012 {0xff, 0x99, 0xcc }, // 013 {0xff, 0x99, 0x99 }, // 014 {0xff, 0x99, 0x66 }, // 015 {0xff, 0x99, 0x33 }, // 016 {0xff, 0x99, 0x00 }, // 017 {0xff, 0x66, 0xff }, // 018 {0xff, 0x66, 0xcc }, // 019 {0xff, 0x66, 0x99 }, // 020 {0xff, 0x66, 0x66 }, // 021 {0xff, 0x66, 0x33 }, // 022 {0xff, 0x66, 0x00 }, // 023 {0xff, 0x33, 0xff }, // 024 {0xff, 0x33, 0xcc }, // 025 {0xff, 0x33, 0x99 }, // 026 {0xff, 0x33, 0x66 }, // 027 {0xff, 0x33, 0x33 }, // 028 {0xff, 0x33, 0x00 }, // 029 {0xff, 0x00, 0xff }, // 030 {0xff, 0x00, 0xcc }, // 031 {0xff, 0x00, 0x99 }, // 032 {0xff, 0x00, 0x66 }, // 033 {0xff, 0x00, 0x33 }, // 034 {0xff, 0x00, 0x00 }, // 035 {0xcc, 0xff, 0xff }, // 036 {0xcc, 0xff, 0xcc }, // 037 {0xcc, 0xff, 0x99 }, // 038 {0xcc, 0xff, 0x66 }, // 039 {0xcc, 0xff, 0x33 }, // 040 {0xcc, 0xff, 0x00 }, // 041 {0xcc, 0xcc, 0xff }, // 042 {0xcc, 0xcc, 0xcc }, // 043 {0xcc, 0xcc, 0x99 }, // 044 {0xcc, 0xcc, 0x66 }, // 045 {0xcc, 0xcc, 0x33 }, // 046 {0xcc, 0xcc, 0x00 }, // 047 {0xcc, 0x99, 0xff }, // 048 {0xcc, 0x99, 0xcc }, // 049 {0xcc, 0x99, 0x99 }, // 050 {0xcc, 0x99, 0x66 }, // 051 {0xcc, 0x99, 0x33 }, // 052 {0xcc, 0x99, 0x00 }, // 053 {0xcc, 0x66, 0xff }, // 054 {0xcc, 0x66, 0xcc }, // 055 {0xcc, 0x66, 0x99 }, // 056 {0xcc, 0x66, 0x66 }, // 057 {0xcc, 0x66, 0x33 }, // 058 {0xcc, 0x66, 0x00 }, // 059 {0xcc, 0x33, 0xff }, // 060 {0xcc, 0x33, 0xcc }, // 061 {0xcc, 0x33, 0x99 }, // 062 {0xcc, 0x33, 0x66 }, // 063 {0xcc, 0x33, 0x33 }, // 064 {0xcc, 0x33, 0x00 }, // 065 {0xcc, 0x00, 0xff }, // 066 {0xcc, 0x00, 0xcc }, // 067 {0xcc, 0x00, 0x99 }, // 068 {0xcc, 0x00, 0x66 }, // 069 {0xcc, 0x00, 0x33 }, // 070 {0xcc, 0x00, 0x00 }, // 071 {0x99, 0xff, 0xff }, // 072 {0x99, 0xff, 0xcc }, // 073 {0x99, 0xff, 0x99 }, // 074 {0x99, 0xff, 0x66 }, // 075 {0x99, 0xff, 0x33 }, // 076 {0x99, 0xff, 0x00 }, // 077 {0x99, 0xcc, 0xff }, // 078 {0x99, 0xcc, 0xcc }, // 079 {0x99, 0xcc, 0x99 }, // 080 {0x99, 0xcc, 0x66 }, // 081 {0x99, 0xcc, 0x33 }, // 082 {0x99, 0xcc, 0x00 }, // 083 {0x99, 0x99, 0xff }, // 084 {0x99, 0x99, 0xcc }, // 085 {0x99, 0x99, 0x99 }, // 086 {0x99, 0x99, 0x66 }, // 087 {0x99, 0x99, 0x33 }, // 088 {0x99, 0x99, 0x00 }, // 089 {0x99, 0x66, 0xff }, // 090 {0x99, 0x66, 0xcc }, // 091 {0x99, 0x66, 0x99 }, // 092 {0x99, 0x66, 0x66 }, // 093 {0x99, 0x66, 0x33 }, // 094 {0x99, 0x66, 0x00 }, // 095 {0x99, 0x33, 0xff }, // 096 {0x99, 0x33, 0xcc }, // 097 {0x99, 0x33, 0x99 }, // 098 {0x99, 0x33, 0x66 }, // 099 {0x99, 0x33, 0x33 }, // 100 {0x99, 0x33, 0x00 }, // 101 {0x99, 0x00, 0xff }, // 102 {0x99, 0x00, 0xcc }, // 103 {0x99, 0x00, 0x99 }, // 104 {0x99, 0x00, 0x66 }, // 105 {0x99, 0x00, 0x33 }, // 106 {0x99, 0x00, 0x00 }, // 107 {0x66, 0xff, 0xff }, // 108 {0x66, 0xff, 0xcc }, // 109 {0x66, 0xff, 0x99 }, // 110 {0x66, 0xff, 0x66 }, // 111 {0x66, 0xff, 0x33 }, // 112 {0x66, 0xff, 0x00 }, // 113 {0x66, 0xcc, 0xff }, // 114 {0x66, 0xcc, 0xcc }, // 115 {0x66, 0xcc, 0x99 }, // 116 {0x66, 0xcc, 0x66 }, // 117 {0x66, 0xcc, 0x33 }, // 118 {0x66, 0xcc, 0x00 }, // 119 {0x66, 0x99, 0xff }, // 120 {0x66, 0x99, 0xcc }, // 121 {0x66, 0x99, 0x99 }, // 122 {0x66, 0x99, 0x66 }, // 123 {0x66, 0x99, 0x33 }, // 124 {0x66, 0x99, 0x00 }, // 125 {0x66, 0x66, 0xff }, // 126 {0x66, 0x66, 0xcc }, // 127 {0x66, 0x66, 0x99 }, // 128 {0x66, 0x66, 0x66 }, // 129 {0x66, 0x66, 0x33 }, // 130 {0x66, 0x66, 0x00 }, // 131 {0x66, 0x33, 0xff }, // 132 {0x66, 0x33, 0xcc }, // 133 {0x66, 0x33, 0x99 }, // 134 {0x66, 0x33, 0x66 }, // 135 {0x66, 0x33, 0x33 }, // 136 {0x66, 0x33, 0x00 }, // 137 {0x66, 0x00, 0xff }, // 138 {0x66, 0x00, 0xcc }, // 139 {0x66, 0x00, 0x99 }, // 140 {0x66, 0x00, 0x66 }, // 141 {0x66, 0x00, 0x33 }, // 142 {0x66, 0x00, 0x00 }, // 143 {0x33, 0xff, 0xff }, // 144 {0x33, 0xff, 0xcc }, // 145 {0x33, 0xff, 0x99 }, // 146 {0x33, 0xff, 0x66 }, // 147 {0x33, 0xff, 0x33 }, // 148 {0x33, 0xff, 0x00 }, // 149 {0x33, 0xcc, 0xff }, // 150 {0x33, 0xcc, 0xcc }, // 151 {0x33, 0xcc, 0x99 }, // 152 {0x33, 0xcc, 0x66 }, // 153 {0x33, 0xcc, 0x33 }, // 154 {0x33, 0xcc, 0x00 }, // 155 {0x33, 0x99, 0xff }, // 156 {0x33, 0x99, 0xcc }, // 157 {0x33, 0x99, 0x99 }, // 158 {0x33, 0x99, 0x66 }, // 159 {0x33, 0x99, 0x33 }, // 160 {0x33, 0x99, 0x00 }, // 161 {0x33, 0x66, 0xff }, // 162 {0x33, 0x66, 0xcc }, // 163 {0x33, 0x66, 0x99 }, // 164 {0x33, 0x66, 0x66 }, // 165 {0x33, 0x66, 0x33 }, // 166 {0x33, 0x66, 0x00 }, // 167 {0x33, 0x33, 0xff }, // 168 {0x33, 0x33, 0xcc }, // 169 {0x33, 0x33, 0x99 }, // 170 {0x33, 0x33, 0x66 }, // 171 {0x33, 0x33, 0x33 }, // 172 {0x33, 0x33, 0x00 }, // 173 {0x33, 0x00, 0xff }, // 174 {0x33, 0x00, 0xcc }, // 175 {0x33, 0x00, 0x99 }, // 176 {0x33, 0x00, 0x66 }, // 177 {0x33, 0x00, 0x33 }, // 178 {0x33, 0x00, 0x00 }, // 179 {0x00, 0xff, 0xff }, // 180 {0x00, 0xff, 0xcc }, // 181 {0x00, 0xff, 0x99 }, // 182 {0x00, 0xff, 0x66 }, // 183 {0x00, 0xff, 0x33 }, // 184 {0x00, 0xff, 0x00 }, // 185 {0x00, 0xcc, 0xff }, // 186 {0x00, 0xcc, 0xcc }, // 187 {0x00, 0xcc, 0x99 }, // 188 {0x00, 0xcc, 0x66 }, // 189 {0x00, 0xcc, 0x33 }, // 190 {0x00, 0xcc, 0x00 }, // 191 {0x00, 0x99, 0xff }, // 192 {0x00, 0x99, 0xcc }, // 193 {0x00, 0x99, 0x99 }, // 194 {0x00, 0x99, 0x66 }, // 195 {0x00, 0x99, 0x33 }, // 196 {0x00, 0x99, 0x00 }, // 197 {0x00, 0x66, 0xff }, // 198 {0x00, 0x66, 0xcc }, // 199 {0x00, 0x66, 0x99 }, // 200 {0x00, 0x66, 0x66 }, // 201 {0x00, 0x66, 0x33 }, // 202 {0x00, 0x66, 0x00 }, // 203 {0x00, 0x33, 0xff }, // 204 {0x00, 0x33, 0xcc }, // 205 {0x00, 0x33, 0x99 }, // 206 {0x00, 0x33, 0x66 }, // 207 {0x00, 0x33, 0x33 }, // 208 {0x00, 0x33, 0x00 }, // 209 {0x00, 0x00, 0xff }, // 210 {0x00, 0x00, 0xcc }, // 211 {0x00, 0x00, 0x99 }, // 212 {0x00, 0x00, 0x66 }, // 213 {0x00, 0x00, 0x33 }, // 214 {0x00, 0x00, 0x00 }, // 215 // from 216 to 248, 32 level grey scale {0x00, 0x00, 0x00 }, // 216 {0x08, 0x08, 0x08 }, // 217 {0x10, 0x10, 0x10 }, // 218 {0x18, 0x18, 0x18 }, // 219 {0x20, 0x20, 0x20 }, // 220 {0x28, 0x28, 0x28 }, // 221 {0x30, 0x30, 0x30 }, // 222 {0x38, 0x38, 0x38 }, // 223 {0x40, 0x40, 0x40 }, // 224 {0x48, 0x48, 0x48 }, // 225 {0x50, 0x50, 0x50 }, // 226 {0x58, 0x58, 0x58 }, // 227 {0x60, 0x60, 0x60 }, // 228 {0x68, 0x68, 0x68 }, // 229 {0x70, 0x70, 0x70 }, // 230 {0x78, 0x78, 0x78 }, // 231 {0x80, 0x80, 0x80 }, // 232 {0x88, 0x88, 0x88 }, // 233 {0x90, 0x90, 0x90 }, // 234 {0x98, 0x98, 0x98 }, // 235 {0xa0, 0xa0, 0xa0 }, // 236 {0xa8, 0xa8, 0xa8 }, // 237 {0xb0, 0xb0, 0xb0 }, // 238 {0xb8, 0xb8, 0xb8 }, // 239 {0xc0, 0xc0, 0xc0 }, // 240 {0xc8, 0xc8, 0xc8 }, // 241 {0xd0, 0xd0, 0xd0 }, // 242 {0xd8, 0xd8, 0xd8 }, // 243 {0xe0, 0xe0, 0xe0 }, // 244 {0xe8, 0xe8, 0xe8 }, // 245 {0xf0, 0xf0, 0xf0 }, // 246
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -