~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to grub-core/gfxmenu/gui_image.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-05-17 23:59:10 UTC
  • mto: (17.3.55 sid)
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: james.westby@ubuntu.com-20110517235910-ma8u889vyjdfro27
Tags: upstream-1.99
ImportĀ upstreamĀ versionĀ 1.99

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
static grub_err_t
102
102
rescale_image (grub_gui_image_t self)
103
103
{
 
104
  signed width;
 
105
  signed height;
 
106
 
104
107
  if (! self->raw_bitmap)
105
108
    {
106
109
      if (self->bitmap)
111
114
      return grub_errno;
112
115
    }
113
116
 
114
 
  unsigned width = self->bounds.width;
115
 
  unsigned height = self->bounds.height;
 
117
  width = self->bounds.width;
 
118
  height = self->bounds.height;
116
119
 
117
120
  if (self->bitmap
118
 
      && (grub_video_bitmap_get_width (self->bitmap) == width)
119
 
      && (grub_video_bitmap_get_height (self->bitmap) == height))
 
121
      && ((signed) grub_video_bitmap_get_width (self->bitmap) == width)
 
122
      && ((signed) grub_video_bitmap_get_height (self->bitmap) == height))
120
123
    {
121
124
      /* Nothing to do; already the right size.  */
122
125
      return grub_errno;
131
134
 
132
135
  /* Create a scaled bitmap, unless the requested size is the same
133
136
     as the raw size -- in that case a reference is made.  */
134
 
  if (grub_video_bitmap_get_width (self->raw_bitmap) == width
135
 
      && grub_video_bitmap_get_height (self->raw_bitmap) == height)
 
137
  if ((signed) grub_video_bitmap_get_width (self->raw_bitmap) == width
 
138
      && (signed) grub_video_bitmap_get_height (self->raw_bitmap) == height)
136
139
    {
137
140
      self->bitmap = self->raw_bitmap;
138
141
      return grub_errno;
139
142
    }
140
143
 
141
144
  /* Don't scale to an invalid size.  */
142
 
  if (width == 0 || height == 0)
 
145
  if (width <= 0 || height <= 0)
143
146
    return grub_errno;
144
147
 
145
148
  /* Create the scaled bitmap.  */