| 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 SkPdfReal* vtx = pdfContext->fPdfDoc->createReal(tx); | 835 SkPdfReal* vtx = pdfContext->fPdfDoc->createReal(tx); |
| 836 pdfContext->fObjectStack.push(vtx); | 836 pdfContext->fObjectStack.push(vtx); |
| 837 | 837 |
| 838 SkPdfReal* vty = pdfContext->fPdfDoc->createReal(ty); | 838 SkPdfReal* vty = pdfContext->fPdfDoc->createReal(ty); |
| 839 pdfContext->fObjectStack.push(vty); | 839 pdfContext->fObjectStack.push(vty); |
| 840 | 840 |
| 841 PdfResult ret = PdfOp_Td(pdfContext, canvas, looper); | 841 PdfResult ret = PdfOp_Td(pdfContext, canvas, looper); |
| 842 | 842 |
| 843 // TODO(edisonn): delete all the objects after rendering was complete, in th
is way pdf is rendered faster | 843 // TODO(edisonn): delete all the objects after rendering was complete, in th
is way pdf is rendered faster |
| 844 // and the cleanup can happen while the user looks at the image | 844 // and the cleanup can happen while the user looks at the image |
| 845 delete _ty; | |
| 846 delete vtx; | |
| 847 delete vty; | |
| 848 | 845 |
| 849 return ret; | 846 return ret; |
| 850 } | 847 } |
| 851 | 848 |
| 852 static PdfResult PdfOp_Tm(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLoop
er** looper) { | 849 static PdfResult PdfOp_Tm(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLoop
er** looper) { |
| 853 double f = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); | 850 double f = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); |
| 854 double e = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); | 851 double e = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); |
| 855 double d = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); | 852 double d = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); |
| 856 double c = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); | 853 double c = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); |
| 857 double b = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); | 854 double b = pdfContext->fObjectStack.top()->numberValue(); pdfContext->fObjec
tStack.pop(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 880 //where Tl is the current leading parameter in the text state | 877 //where Tl is the current leading parameter in the text state |
| 881 static PdfResult PdfOp_T_star(PdfContext* pdfContext, SkCanvas* canvas, PdfToken
Looper** looper) { | 878 static PdfResult PdfOp_T_star(PdfContext* pdfContext, SkCanvas* canvas, PdfToken
Looper** looper) { |
| 882 SkPdfReal* zero = pdfContext->fPdfDoc->createReal(0.0); | 879 SkPdfReal* zero = pdfContext->fPdfDoc->createReal(0.0); |
| 883 SkPdfReal* tl = pdfContext->fPdfDoc->createReal(pdfContext->fGraphicsState.f
TextLeading); | 880 SkPdfReal* tl = pdfContext->fPdfDoc->createReal(pdfContext->fGraphicsState.f
TextLeading); |
| 884 | 881 |
| 885 pdfContext->fObjectStack.push(zero); | 882 pdfContext->fObjectStack.push(zero); |
| 886 pdfContext->fObjectStack.push(tl); | 883 pdfContext->fObjectStack.push(tl); |
| 887 | 884 |
| 888 PdfResult ret = PdfOp_Td(pdfContext, canvas, looper); | 885 PdfResult ret = PdfOp_Td(pdfContext, canvas, looper); |
| 889 | 886 |
| 890 delete zero; // TODO(edisonn): do not alocate and delete constants! | |
| 891 delete tl; | |
| 892 | |
| 893 return ret; | 887 return ret; |
| 894 } | 888 } |
| 895 | 889 |
| 896 static PdfResult PdfOp_m(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLoope
r** looper) { | 890 static PdfResult PdfOp_m(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLoope
r** looper) { |
| 897 if (pdfContext->fGraphicsState.fPathClosed) { | 891 if (pdfContext->fGraphicsState.fPathClosed) { |
| 898 pdfContext->fGraphicsState.fPath.reset(); | 892 pdfContext->fGraphicsState.fPath.reset(); |
| 899 pdfContext->fGraphicsState.fPathClosed = false; | 893 pdfContext->fGraphicsState.fPathClosed = false; |
| 900 } | 894 } |
| 901 | 895 |
| 902 pdfContext->fGraphicsState.fCurPosY = pdfContext->fObjectStack.top()->number
Value(); pdfContext->fObjectStack.pop(); | 896 pdfContext->fGraphicsState.fCurPosY = pdfContext->fObjectStack.top()->number
Value(); pdfContext->fObjectStack.pop(); |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2012 | 2006 |
| 2013 void SkPdfRenderer::unload() { | 2007 void SkPdfRenderer::unload() { |
| 2014 delete fPdfDoc; | 2008 delete fPdfDoc; |
| 2015 fPdfDoc = NULL; | 2009 fPdfDoc = NULL; |
| 2016 } | 2010 } |
| 2017 | 2011 |
| 2018 SkRect SkPdfRenderer::MediaBox(int page) const { | 2012 SkRect SkPdfRenderer::MediaBox(int page) const { |
| 2019 SkASSERT(fPdfDoc); | 2013 SkASSERT(fPdfDoc); |
| 2020 return fPdfDoc->MediaBox(page); | 2014 return fPdfDoc->MediaBox(page); |
| 2021 } | 2015 } |
| OLD | NEW |