Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(787)

Side by Side Diff: experimental/PdfViewer/SkPdfRenderer.cpp

Issue 23125015: pdfviewer: if the resources are missing, exit (right now inheritance is not implemented) (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 if (!skobj->isContentsAStream(pdfContext->fPdfDoc)) { 1034 if (!skobj->isContentsAStream(pdfContext->fPdfDoc)) {
1035 return kNYI_SkPdfResult; 1035 return kNYI_SkPdfResult;
1036 } 1036 }
1037 1037
1038 SkPdfStream* stream = skobj->getContentsAsStream(pdfContext->fPdfDoc); 1038 SkPdfStream* stream = skobj->getContentsAsStream(pdfContext->fPdfDoc);
1039 1039
1040 if (!stream) { 1040 if (!stream) {
1041 return kIgnoreError_SkPdfResult; 1041 return kIgnoreError_SkPdfResult;
1042 } 1042 }
1043 1043
1044 pdfContext->fGraphicsState.fResources = skobj->Resources(pdfContext->fPdfDoc );
1045
1046 if (!pdfContext->fGraphicsState.fResources) {
1047 return kIgnoreError_SkPdfResult; // probably it is null because we have not implemented yet inheritance
1048 }
1049
1044 if (CheckRecursiveRendering::IsInRendering(skobj)) { 1050 if (CheckRecursiveRendering::IsInRendering(skobj)) {
1045 // Oops, corrupt PDF! 1051 // Oops, corrupt PDF!
1046 return kIgnoreError_SkPdfResult; 1052 return kIgnoreError_SkPdfResult;
1047 } 1053 }
1048 CheckRecursiveRendering checkRecursion(skobj); 1054 CheckRecursiveRendering checkRecursion(skobj);
1049 1055
1050 1056
1051 PdfOp_q(pdfContext, canvas, NULL); 1057 PdfOp_q(pdfContext, canvas, NULL);
1052 1058
1053
1054 if (skobj->Resources(pdfContext->fPdfDoc)) {
1055 pdfContext->fGraphicsState.fResources = skobj->Resources(pdfContext->fPd fDoc);
1056 }
1057
1058 // TODO(edisonn): MediaBox can be inherited!!!! 1059 // TODO(edisonn): MediaBox can be inherited!!!!
1059 SkRect bbox = skobj->MediaBox(pdfContext->fPdfDoc); 1060 SkRect bbox = skobj->MediaBox(pdfContext->fPdfDoc);
1060 if (skobj->has_Group()) { 1061 if (skobj->has_Group()) {
1061 SkPdfTransparencyGroupDictionary* tgroup = skobj->Group(pdfContext->fPdf Doc); 1062 SkPdfTransparencyGroupDictionary* tgroup = skobj->Group(pdfContext->fPdf Doc);
1062 doGroup_before(pdfContext, canvas, bbox, tgroup, true); 1063 doGroup_before(pdfContext, canvas, bbox, tgroup, true);
1063 } else { 1064 } else {
1064 canvas->save(); 1065 canvas->save();
1065 } 1066 }
1066 1067
1067 1068
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
2906 2907
2907 rect = SkRect::MakeWH(width, height); 2908 rect = SkRect::MakeWH(width, height);
2908 2909
2909 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght)); 2910 setup_bitmap(output, (int)SkScalarToDouble(width), (int)SkScalarToDouble(hei ght));
2910 2911
2911 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output))); 2912 SkAutoTUnref<SkDevice> device(SkNEW_ARGS(SkDevice, (*output)));
2912 SkCanvas canvas(device); 2913 SkCanvas canvas(device);
2913 2914
2914 return renderer.renderPage(page, &canvas, rect); 2915 return renderer.renderPage(page, &canvas, rect);
2915 } 2916 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698