OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPdfRenderer.h" | 8 #include "SkPdfRenderer.h" |
9 | 9 |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 2718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2729 } | 2729 } |
2730 | 2730 |
2731 SkPdfResult PdfCompatibilitySectionLooper::consumeToken(PdfToken& token) { | 2731 SkPdfResult PdfCompatibilitySectionLooper::consumeToken(PdfToken& token) { |
2732 return fParent->consumeToken(token); | 2732 return fParent->consumeToken(token); |
2733 } | 2733 } |
2734 | 2734 |
2735 void PdfCompatibilitySectionLooper::loop() { | 2735 void PdfCompatibilitySectionLooper::loop() { |
2736 PdfOp_q(fPdfContext, fCanvas, NULL); | 2736 PdfOp_q(fPdfContext, fCanvas, NULL); |
2737 | 2737 |
2738 PdfToken token; | 2738 PdfToken token; |
2739 while (readToken(fTokenizer, &token)) { | 2739 while (fTokenizer->readToken(&token)) { |
2740 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "BX") ==
0) { | 2740 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "BX") ==
0) { |
2741 SkPdfTokenLooper* looper = new PdfCompatibilitySectionLooper(); | 2741 SkPdfTokenLooper* looper = new PdfCompatibilitySectionLooper(); |
2742 looper->setUp(this); | 2742 looper->setUp(this); |
2743 looper->loop(); | 2743 looper->loop(); |
2744 delete looper; | 2744 delete looper; |
2745 } else { | 2745 } else { |
2746 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "EX"
) == 0) break; | 2746 if (token.fType == kKeyword_TokenType && strcmp(token.fKeyword, "EX"
) == 0) break; |
2747 fParent->consumeToken(token); | 2747 fParent->consumeToken(token); |
2748 } | 2748 } |
2749 } | 2749 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2897 | 2897 |
2898 rect = SkRect::MakeWH(width, height); | 2898 rect = SkRect::MakeWH(width, height); |
2899 | 2899 |
2900 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); | 2900 setup_bitmap(output, SkScalarCeilToInt(width), SkScalarCeilToInt(height)); |
2901 | 2901 |
2902 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); | 2902 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (*output))); |
2903 SkCanvas canvas(device); | 2903 SkCanvas canvas(device); |
2904 | 2904 |
2905 return renderer->renderPage(page, &canvas, rect); | 2905 return renderer->renderPage(page, &canvas, rect); |
2906 } | 2906 } |
OLD | NEW |