~ubuntu-branches/ubuntu/precise/poppler/precise-proposed

« back to all changes in this revision

Viewing changes to poppler/Gfx.cc

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-12-13 12:51:26 UTC
  • mfrom: (1.5.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101213125126-v88rtmpszuv46f22
Tags: 0.14.5-0ubuntu1
* New upstream release
* debian/control:
  - Use standards-version 3.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
536
536
  drawText = gFalse;
537
537
  maskHaveCSPattern = gFalse;
538
538
  mcStack = NULL;
 
539
  parser = NULL;
539
540
 
540
541
  // start the resource stack
541
542
  res = new GfxResources(xref, resDict, NULL);
590
591
  drawText = gFalse;
591
592
  maskHaveCSPattern = gFalse;
592
593
  mcStack = NULL;
 
594
  parser = NULL;
593
595
 
594
596
  // start the resource stack
595
597
  res = new GfxResources(xref, resDict, NULL);
1250
1252
  }
1251
1253
  for (i = 0; i < 4; ++i) {
1252
1254
    obj1.arrayGet(i, &obj2);
1253
 
    bbox[i] = obj2.getNum();
 
1255
    if (likely(obj2.isNum())) bbox[i] = obj2.getNum();
 
1256
    else {
 
1257
      obj2.free();
 
1258
      obj1.free();
 
1259
      error(getPos(), "Bad form bounding box (non number)");
 
1260
      return;
 
1261
    }
1254
1262
    obj2.free();
1255
1263
  }
1256
1264
  obj1.free();
1260
1268
  if (obj1.isArray()) {
1261
1269
    for (i = 0; i < 6; ++i) {
1262
1270
      obj1.arrayGet(i, &obj2);
1263
 
      m[i] = obj2.getNum();
 
1271
      if (likely(obj2.isNum())) m[i] = obj2.getNum();
 
1272
      else m[i] = 0;
1264
1273
      obj2.free();
1265
1274
    }
1266
1275
  } else {
1531
1540
      for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
1532
1541
        if (args[i].isNum()) {
1533
1542
          color.c[i] = dblToCol(args[i].getNum());
 
1543
        } else {
 
1544
          color.c[i] = 0; // TODO Investigate if this is what Adobe does
1534
1545
        }
1535
1546
      }
1536
1547
      state->setFillColor(&color);
1550
1561
    for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) {
1551
1562
      if (args[i].isNum()) {
1552
1563
        color.c[i] = dblToCol(args[i].getNum());
 
1564
      } else {
 
1565
        color.c[i] = 0; // TODO Investigate if this is what Adobe does
1553
1566
      }
1554
1567
    }
1555
1568
    state->setFillColor(&color);
1574
1587
      for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) {
1575
1588
        if (args[i].isNum()) {
1576
1589
          color.c[i] = dblToCol(args[i].getNum());
 
1590
        } else {
 
1591
          color.c[i] = 0; // TODO Investigate if this is what Adobe does
1577
1592
        }
1578
1593
      }
1579
1594
      state->setStrokeColor(&color);
1593
1608
    for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) {
1594
1609
      if (args[i].isNum()) {
1595
1610
        color.c[i] = dblToCol(args[i].getNum());
 
1611
      } else {
 
1612
        color.c[i] = 0; // TODO Investigate if this is what Adobe does
1596
1613
      }
1597
1614
    }
1598
1615
    state->setStrokeColor(&color);
4225
4242
  }
4226
4243
  for (i = 0; i < 4; ++i) {
4227
4244
    bboxObj.arrayGet(i, &obj1);
4228
 
    bbox[i] = obj1.getNum();
4229
 
    obj1.free();
 
4245
    if (likely(obj1.isNum())) {
 
4246
      bbox[i] = obj1.getNum();
 
4247
      obj1.free();
 
4248
    } else {
 
4249
      obj1.free();
 
4250
      error(getPos(), "Bad form bounding box value");
 
4251
      return;
 
4252
    }
4230
4253
  }
4231
4254
  bboxObj.free();
4232
4255
 
4235
4258
  if (matrixObj.isArray()) {
4236
4259
    for (i = 0; i < 6; ++i) {
4237
4260
      matrixObj.arrayGet(i, &obj1);
4238
 
      m[i] = obj1.getNum();
 
4261
      if (likely(obj1.isNum())) m[i] = obj1.getNum();
 
4262
      else m[i] = 0;
4239
4263
      obj1.free();
4240
4264
    }
4241
4265
  } else {
4449
4473
  obj.free();
4450
4474
 
4451
4475
  // make stream
4452
 
  str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
4453
 
  str = str->addFilters(&dict);
 
4476
  if (parser->getStream()) {
 
4477
    str = new EmbedStream(parser->getStream(), &dict, gFalse, 0);
 
4478
    str = str->addFilters(&dict);
 
4479
  } else {
 
4480
    str = NULL;
 
4481
    dict.free();
 
4482
  }
4454
4483
 
4455
4484
  return str;
4456
4485
}
4651
4680
    }
4652
4681
    for (i = 0; i < 4; ++i) {
4653
4682
      bboxObj.arrayGet(i, &obj1);
4654
 
      bbox[i] = obj1.getNum();
4655
 
      obj1.free();
 
4683
      if (likely(obj1.isNum())) {
 
4684
        bbox[i] = obj1.getNum();
 
4685
        obj1.free();
 
4686
      } else {
 
4687
        obj1.free();
 
4688
        error(getPos(), "Bad form bounding box value");
 
4689
        return;
 
4690
      }
4656
4691
    }
4657
4692
    bboxObj.free();
4658
4693