~ubuntu-branches/ubuntu/saucy/libjpeg-turbo/saucy-security

« back to all changes in this revision

Viewing changes to transupp.c

  • Committer: Package Import Robot
  • Author(s): Fathi Boudra
  • Date: 2013-07-28 16:52:51 UTC
  • mfrom: (1.1.3) (9.1.1 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130728165251-7vg6wszhm941kdej
Tags: 1.3.0-0ubuntu1
* New upstream release.
  - drop debian/patches/branch-updates.diff
  - refresh tjunittest.patch (now renamed to install-tjunittest.patch)
* Update debian/control:
  - add myself to Uploaders.
* Update debian/copyright:
  - add RSA Data Security copyright (md5).
* Update debian/libturbojpeg.install:
  - install libturbojpeg.so.0* (needed by tjunittest and tjbench).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * transupp.c
3
3
 *
4
 
 * Copyright (C) 1997-2009, Thomas G. Lane, Guido Vollbeding.
 
4
 * This file was part of the Independent JPEG Group's software:
 
5
 * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
 
6
 * Modifications:
5
7
 * Copyright (C) 2010, D. R. Commander.
6
 
 * This file is part of the Independent JPEG Group's software.
7
8
 * For conditions of distribution and use, see the accompanying README file.
8
9
 *
9
10
 * This file contains image transformation routines and other utility code
782
783
 * The routine returns TRUE if the spec string is valid, FALSE if not.
783
784
 *
784
785
 * The crop spec string should have the format
785
 
 *      <width>x<height>{+-}<xoffset>{+-}<yoffset>
 
786
 *      <width>[f]x<height>[f]{+-}<xoffset>{+-}<yoffset>
786
787
 * where width, height, xoffset, and yoffset are unsigned integers.
787
788
 * Each of the elements can be omitted to indicate a default value.
788
789
 * (A weakness of this style is that it is not possible to omit xoffset
804
805
    /* fetch width */
805
806
    if (! jt_read_integer(&spec, &info->crop_width))
806
807
      return FALSE;
807
 
    info->crop_width_set = JCROP_POS;
 
808
    if (*spec == 'f' || *spec == 'F') {
 
809
      spec++;
 
810
      info->crop_width_set = JCROP_FORCE;
 
811
    } else
 
812
      info->crop_width_set = JCROP_POS;
808
813
  }
809
 
  if (*spec == 'x' || *spec == 'X') {   
 
814
  if (*spec == 'x' || *spec == 'X') {
810
815
    /* fetch height */
811
816
    spec++;
812
817
    if (! jt_read_integer(&spec, &info->crop_height))
813
818
      return FALSE;
814
 
    info->crop_height_set = JCROP_POS;
 
819
    if (*spec == 'f' || *spec == 'F') {
 
820
      spec++;
 
821
      info->crop_height_set = JCROP_FORCE;
 
822
    } else
 
823
      info->crop_height_set = JCROP_POS;
815
824
  }
816
825
  if (*spec == '+' || *spec == '-') {
817
826
    /* fetch xoffset */
996
1005
    else
997
1006
      yoffset = info->crop_yoffset;
998
1007
    /* Now adjust so that upper left corner falls at an iMCU boundary */
999
 
    info->output_width =
1000
 
      info->crop_width + (xoffset % info->iMCU_sample_width);
1001
 
    info->output_height =
1002
 
      info->crop_height + (yoffset % info->iMCU_sample_height);
 
1008
    if (info->crop_width_set == JCROP_FORCE)
 
1009
      info->output_width = info->crop_width;
 
1010
    else
 
1011
      info->output_width =
 
1012
        info->crop_width + (xoffset % info->iMCU_sample_width);
 
1013
    if (info->crop_height_set == JCROP_FORCE)
 
1014
      info->output_height = info->crop_height;
 
1015
    else
 
1016
      info->output_height =
 
1017
        info->crop_height + (yoffset % info->iMCU_sample_height);
1003
1018
    /* Save x/y offsets measured in iMCUs */
1004
1019
    info->x_crop_offset = xoffset / info->iMCU_sample_width;
1005
1020
    info->y_crop_offset = yoffset / info->iMCU_sample_height;