Browse Source

Merge pull request #618 from brendandahl/boundingbox

Fix bounding box for xobjects and patterns
Artur Adib 14 years ago
parent
commit
ea20f91791
  1. 8
      pdf.js
  2. 9
      test/test.py

8
pdf.js

@ -5600,7 +5600,9 @@ var CanvasGraphics = (function canvasGraphics() {
var bbox = stream.dict.get('BBox'); var bbox = stream.dict.get('BBox');
if (bbox && isArray(bbox) && 4 == bbox.length) { if (bbox && isArray(bbox) && 4 == bbox.length) {
this.rectangle.apply(this, bbox); var width = bbox[2] - bbox[0];
var height = bbox[3] - bbox[1];
this.rectangle(bbox[0], bbox[1], width, height);
this.clip(); this.clip();
this.endPath(); this.endPath();
} }
@ -6355,7 +6357,9 @@ var TilingPattern = (function tilingPattern() {
graphics.transform.apply(graphics, tmpTranslate); graphics.transform.apply(graphics, tmpTranslate);
if (bbox && isArray(bbox) && 4 == bbox.length) { if (bbox && isArray(bbox) && 4 == bbox.length) {
graphics.rectangle.apply(graphics, bbox); var bboxWidth = bbox[2] - bbox[0];
var bboxHeight = bbox[3] - bbox[1];
graphics.rectangle(bbox[0], bbox[1], bboxWidth, bboxHeight);
graphics.clip(); graphics.clip();
graphics.endPath(); graphics.endPath();
} }

9
test/test.py

@ -435,9 +435,9 @@ def checkEq(task, results, browser, masterMode):
# NB: this follows the format of Mozilla reftest # NB: this follows the format of Mozilla reftest
# output so that we can reuse its reftest-analyzer # output so that we can reuse its reftest-analyzer
# script # script
print >>eqLog, 'REFTEST TEST-UNEXPECTED-FAIL |', browser +'-'+ taskId +'-page'+ str(page + 1), '| image comparison (==)' eqLog.write('REFTEST TEST-UNEXPECTED-FAIL | ' + browser +'-'+ taskId +'-page'+ str(page + 1) + ' | image comparison (==)\n')
print >>eqLog, 'REFTEST IMAGE 1 (TEST):', snapshot eqLog.write('REFTEST IMAGE 1 (TEST): ' + snapshot + '\n')
print >>eqLog, 'REFTEST IMAGE 2 (REFERENCE):', ref eqLog.write('REFTEST IMAGE 2 (REFERENCE): ' + ref + '\n')
passed = False passed = False
State.numEqFailures += 1 State.numEqFailures += 1
@ -456,7 +456,8 @@ def checkEq(task, results, browser, masterMode):
if passed: if passed:
print 'TEST-PASS | eq test', task['id'], '| in', browser print 'TEST-PASS | eq test', task['id'], '| in', browser
if State.eqLog:
State.eqLog.close();
def checkFBF(task, results, browser): def checkFBF(task, results, browser):
round0, round1 = results[0], results[1] round0, round1 = results[0], results[1]

Loading…
Cancel
Save