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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 return false; | 1942 return false; |
1943 } | 1943 } |
1944 | 1944 |
1945 if (page < 0 || page >= pages()) { | 1945 if (page < 0 || page >= pages()) { |
1946 return false; | 1946 return false; |
1947 } | 1947 } |
1948 | 1948 |
1949 PdfContext pdfContext(fPdfDoc); | 1949 PdfContext pdfContext(fPdfDoc); |
1950 | 1950 |
1951 SkPdfNativeTokenizer* tokenizer = fPdfDoc->tokenizerOfPage(page, pdfContext.
fTmpPageAllocator); | 1951 SkPdfNativeTokenizer* tokenizer = fPdfDoc->tokenizerOfPage(page, pdfContext.
fTmpPageAllocator); |
| 1952 if (!tokenizer) { |
| 1953 // TODO(edisonn): report/warning/debug |
| 1954 return false; |
| 1955 } |
1952 | 1956 |
1953 pdfContext.fOriginalMatrix = SkMatrix::I(); | 1957 pdfContext.fOriginalMatrix = SkMatrix::I(); |
1954 pdfContext.fGraphicsState.fResources = fPdfDoc->pageResources(page); | 1958 pdfContext.fGraphicsState.fResources = fPdfDoc->pageResources(page); |
1955 | 1959 |
1956 gPdfContext = &pdfContext; | 1960 gPdfContext = &pdfContext; |
1957 | 1961 |
1958 // TODO(edisonn): get matrix stuff right. | 1962 // TODO(edisonn): get matrix stuff right. |
1959 SkScalar z = SkIntToScalar(0); | 1963 SkScalar z = SkIntToScalar(0); |
1960 SkScalar w = dst.width(); | 1964 SkScalar w = dst.width(); |
1961 SkScalar h = dst.height(); | 1965 SkScalar h = dst.height(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2040 } |
2037 | 2041 |
2038 SkRect SkPdfRenderer::MediaBox(int page) const { | 2042 SkRect SkPdfRenderer::MediaBox(int page) const { |
2039 SkASSERT(fPdfDoc); | 2043 SkASSERT(fPdfDoc); |
2040 return fPdfDoc->MediaBox(page); | 2044 return fPdfDoc->MediaBox(page); |
2041 } | 2045 } |
2042 | 2046 |
2043 size_t SkPdfRenderer::bytesUsed() const { | 2047 size_t SkPdfRenderer::bytesUsed() const { |
2044 return fPdfDoc ? fPdfDoc->bytesUsed() : 0; | 2048 return fPdfDoc ? fPdfDoc->bytesUsed() : 0; |
2045 } | 2049 } |
OLD | NEW |