~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to backend/dvi/mdvi-lib/dviread.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2011-04-14 16:20:57 UTC
  • mfrom: (1.6.4 upstream)
  • mto: (1.3.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: james.westby@ubuntu.com-20110414162057-0ofhbd139zs6ev6y
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
15
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
 */
18
18
 
19
19
#include <config.h>
1166
1166
        (a), (b) > 0 ? '+' : '-', \
1167
1167
        (b) > 0 ? (b) : -(b), (c)
1168
1168
 
1169
 
/*
1170
 
 * Draw rules with some sort of antialias support. Usefult for high-rate
1171
 
 * scale factors.
1172
 
 */ 
1173
 
 
1174
1169
static void draw_shrink_rule (DviContext *dvi, int x, int y, Uint w, Uint h, int f)
1175
1170
{               
1176
 
        int hs, vs, npixels;
1177
1171
        Ulong fg, bg;
1178
 
        Ulong *pixels;
1179
 
        
1180
 
        hs = dvi->params.hshrink;
1181
 
        vs = dvi->params.vshrink;
 
1172
 
1182
1173
        fg = dvi->curr_fg;
1183
1174
        bg = dvi->curr_bg;
1184
1175
 
1185
 
        if (MDVI_ENABLED(dvi, MDVI_PARAM_ANTIALIASED)) {
1186
 
                npixels = vs * hs + 1;
1187
 
                pixels = get_color_table(&dvi->device, npixels, bg, fg,
1188
 
                                         dvi->params.gamma, dvi->params.density);
1189
 
        
1190
 
                if (pixels) {
1191
 
                    int color;
1192
 
                    
1193
 
                    /*  Lines with width 1 should be perfectly visible
1194
 
                     *  in shrink about 15. That is the reason of constant
1195
 
                     */
1196
 
                     
1197
 
                    color = (pow (vs / h * hs, 2) + pow (hs / w * vs, 2)) / 225;
1198
 
                    if (color < npixels) {
1199
 
                        fg = pixels[color];
1200
 
                    } else {    
1201
 
                        fg = pixels[npixels - 1];
1202
 
                    }
1203
 
                }
1204
 
        }
1205
 
 
1206
1176
        mdvi_push_color (dvi, fg, bg);
1207
1177
        dvi->device.draw_rule(dvi, x, y, w, h, f);
1208
1178
        mdvi_pop_color (dvi);
1537
1507
        Int32   arg;
1538
1508
        
1539
1509
        arg = dugetn(dvi, opcode - DVI_XXX1 + 1);
 
1510
        if (arg <= 0) {
 
1511
                dvierr(dvi, _("malformed special length\n"));
 
1512
                return -1;
 
1513
        }
1540
1514
        s = mdvi_malloc(arg + 1);
1541
1515
        dread(dvi, s, arg);
1542
1516
        s[arg] = 0;