| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 2 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 3 * Copyright (C) 2007 Apple Inc. | 3 * Copyright (C) 2007 Apple Inc. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height()); | 371 printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height()); |
| 372 | 372 |
| 373 float pageHeight; | 373 float pageHeight; |
| 374 printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels),
0, 0, 1, pageHeight); | 374 printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels),
0, 0, 1, pageHeight); |
| 375 | 375 |
| 376 const float pageWidth = pageSizeInPixels.width(); | 376 const float pageWidth = pageSizeInPixels.width(); |
| 377 const Vector<IntRect>& pageRects = printContext.pageRects(); | 377 const Vector<IntRect>& pageRects = printContext.pageRects(); |
| 378 int totalHeight = pageRects.size() * (pageSizeInPixels.height() + 1) - 1; | 378 int totalHeight = pageRects.size() * (pageSizeInPixels.height() + 1) - 1; |
| 379 | 379 |
| 380 // Fill the whole background by white. | 380 // Fill the whole background by white. |
| 381 graphicsContext.setFillColor(Color(255, 255, 255), ColorSpaceDeviceRGB); | 381 graphicsContext.setFillColor(Color(255, 255, 255)); |
| 382 graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight)); | 382 graphicsContext.fillRect(FloatRect(0, 0, pageWidth, totalHeight)); |
| 383 | 383 |
| 384 graphicsContext.save(); | 384 graphicsContext.save(); |
| 385 graphicsContext.translate(0, totalHeight); | 385 graphicsContext.translate(0, totalHeight); |
| 386 graphicsContext.scale(FloatSize(1, -1)); | 386 graphicsContext.scale(FloatSize(1, -1)); |
| 387 | 387 |
| 388 int currentHeight = 0; | 388 int currentHeight = 0; |
| 389 for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) { | 389 for (size_t pageIndex = 0; pageIndex < pageRects.size(); pageIndex++) { |
| 390 // Draw a line for a page boundary if this isn't the first page. | 390 // Draw a line for a page boundary if this isn't the first page. |
| 391 if (pageIndex > 0) { | 391 if (pageIndex > 0) { |
| 392 graphicsContext.save(); | 392 graphicsContext.save(); |
| 393 graphicsContext.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB
); | 393 graphicsContext.setStrokeColor(Color(0, 0, 255)); |
| 394 graphicsContext.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB); | 394 graphicsContext.setFillColor(Color(0, 0, 255)); |
| 395 graphicsContext.drawLine(IntPoint(0, currentHeight), | 395 graphicsContext.drawLine(IntPoint(0, currentHeight), |
| 396 IntPoint(pageWidth, currentHeight)); | 396 IntPoint(pageWidth, currentHeight)); |
| 397 graphicsContext.restore(); | 397 graphicsContext.restore(); |
| 398 } | 398 } |
| 399 | 399 |
| 400 graphicsContext.save(); | 400 graphicsContext.save(); |
| 401 graphicsContext.translate(0, currentHeight); | 401 graphicsContext.translate(0, currentHeight); |
| 402 printContext.spoolPage(graphicsContext, pageIndex, pageWidth); | 402 printContext.spoolPage(graphicsContext, pageIndex, pageWidth); |
| 403 graphicsContext.restore(); | 403 graphicsContext.restore(); |
| 404 | 404 |
| 405 currentHeight += pageSizeInPixels.height() + 1; | 405 currentHeight += pageSizeInPixels.height() + 1; |
| 406 } | 406 } |
| 407 | 407 |
| 408 graphicsContext.restore(); | 408 graphicsContext.restore(); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } | 411 } |
| OLD | NEW |