OLD | NEW |
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 "Resources.h" | 9 #include "Resources.h" |
10 #include "SkAndroidCodec.h" | 10 #include "SkAndroidCodec.h" |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 doc->beginPage(SkIntToScalar(width), SkIntToScalar(height)); | 1256 doc->beginPage(SkIntToScalar(width), SkIntToScalar(height)); |
1257 if (!canvas) { | 1257 if (!canvas) { |
1258 return "SkDocument::beginPage(w,h) returned nullptr"; | 1258 return "SkDocument::beginPage(w,h) returned nullptr"; |
1259 } | 1259 } |
1260 Error err = src.draw(i, canvas); | 1260 Error err = src.draw(i, canvas); |
1261 if (!err.isEmpty()) { | 1261 if (!err.isEmpty()) { |
1262 return err; | 1262 return err; |
1263 } | 1263 } |
1264 doc->endPage(); | 1264 doc->endPage(); |
1265 } | 1265 } |
1266 if (!doc->close()) { | 1266 doc->close(); |
1267 return "SkDocument::close() returned false"; | |
1268 } | |
1269 dst->flush(); | 1267 dst->flush(); |
1270 return ""; | 1268 return ""; |
1271 } | 1269 } |
1272 | 1270 |
1273 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ | 1271 Error PDFSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ |
1274 SkDocument::PDFMetadata metadata; | 1272 SkDocument::PDFMetadata metadata; |
1275 metadata.fTitle = src.name(); | 1273 metadata.fTitle = src.name(); |
1276 metadata.fSubject = "rendering correctness test"; | 1274 metadata.fSubject = "rendering correctness test"; |
1277 metadata.fCreator = "Skia/DM"; | 1275 metadata.fCreator = "Skia/DM"; |
1278 sk_sp<SkDocument> doc = SkDocument::MakePDF(dst, SK_ScalarDefaultRasterDPI, | 1276 sk_sp<SkDocument> doc = SkDocument::MakePDF(dst, SK_ScalarDefaultRasterDPI, |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 Error err = src.draw(&rec); | 1708 Error err = src.draw(&rec); |
1711 if (!err.isEmpty()) { | 1709 if (!err.isEmpty()) { |
1712 return err; | 1710 return err; |
1713 } | 1711 } |
1714 dl->draw(canvas); | 1712 dl->draw(canvas); |
1715 return check_against_reference(bitmap, src, fSink); | 1713 return check_against_reference(bitmap, src, fSink); |
1716 }); | 1714 }); |
1717 } | 1715 } |
1718 | 1716 |
1719 } // namespace DM | 1717 } // namespace DM |
OLD | NEW |