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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1780253002: DM: better SkDocument error message. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-03-10 (Thursday) 13:12:56 EST Created 4 years, 9 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
« 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 2015 Google Inc. 2 * Copyright 2015 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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SkAndroidCodec.h" 9 #include "SkAndroidCodec.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 canvas->readPixels(dst, 0, 0); 996 canvas->readPixels(dst, 0, 0);
997 if (FLAGS_abandonGpuContext) { 997 if (FLAGS_abandonGpuContext) {
998 factory.abandonContexts(); 998 factory.abandonContexts();
999 } 999 }
1000 return ""; 1000 return "";
1001 } 1001 }
1002 1002
1003 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1003 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1004 1004
1005 static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) { 1005 static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
1006 // Print the given DM:Src to a document, breaking on 8.5x11 pages. 1006 if (src.size().isEmpty()) {
1007 return "Source has empty dimensions";
1008 }
1007 SkASSERT(doc); 1009 SkASSERT(doc);
1008 int width = src.size().width(), 1010 int width = src.size().width(),
1009 height = src.size().height(); 1011 height = src.size().height();
1010 1012
1011 if (FLAGS_multiPage) { 1013 if (FLAGS_multiPage) {
1014 // Print the given DM:Src to a document, breaking on 8.5x11 pages.
1012 const int kLetterWidth = 612, // 8.5 * 72 1015 const int kLetterWidth = 612, // 8.5 * 72
1013 kLetterHeight = 792; // 11 * 72 1016 kLetterHeight = 792; // 11 * 72
1014 const SkRect letter = SkRect::MakeWH(SkIntToScalar(kLetterWidth), 1017 const SkRect letter = SkRect::MakeWH(SkIntToScalar(kLetterWidth),
1015 SkIntToScalar(kLetterHeight)); 1018 SkIntToScalar(kLetterHeight));
1016 1019
1017 int xPages = ((width - 1) / kLetterWidth) + 1; 1020 int xPages = ((width - 1) / kLetterWidth) + 1;
1018 int yPages = ((height - 1) / kLetterHeight) + 1; 1021 int yPages = ((height - 1) / kLetterHeight) + 1;
1019 1022
1020 for (int y = 0; y < yPages; ++y) { 1023 for (int y = 0; y < yPages; ++y) {
1021 for (int x = 0; x < xPages; ++x) { 1024 for (int x = 0; x < xPages; ++x) {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 skr.visit<void>(i, drawsAsSingletonPictures); 1495 skr.visit<void>(i, drawsAsSingletonPictures);
1493 } 1496 }
1494 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1497 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1495 1498
1496 canvas->drawPicture(macroPic); 1499 canvas->drawPicture(macroPic);
1497 return check_against_reference(bitmap, src, fSink); 1500 return check_against_reference(bitmap, src, fSink);
1498 }); 1501 });
1499 } 1502 }
1500 1503
1501 } // namespace DM 1504 } // namespace DM
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