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 16 matching lines...) Expand all Loading... |
27 #include "SkOSFile.h" | 27 #include "SkOSFile.h" |
28 #include "SkOpts.h" | 28 #include "SkOpts.h" |
29 #include "SkPictureData.h" | 29 #include "SkPictureData.h" |
30 #include "SkPictureRecorder.h" | 30 #include "SkPictureRecorder.h" |
31 #include "SkRandom.h" | 31 #include "SkRandom.h" |
32 #include "SkRecordDraw.h" | 32 #include "SkRecordDraw.h" |
33 #include "SkRecorder.h" | 33 #include "SkRecorder.h" |
34 #include "SkSVGCanvas.h" | 34 #include "SkSVGCanvas.h" |
35 #include "SkStream.h" | 35 #include "SkStream.h" |
36 #include "SkTLogic.h" | 36 #include "SkTLogic.h" |
37 #include "SkXMLWriter.h" | |
38 #include "SkSwizzler.h" | 37 #include "SkSwizzler.h" |
39 #include <functional> | 38 #include <functional> |
40 | 39 |
41 #if defined(SK_BUILD_FOR_WIN) | 40 #if defined(SK_BUILD_FOR_WIN) |
42 #include "SkAutoCoInitialize.h" | 41 #include "SkAutoCoInitialize.h" |
43 #endif | 42 #endif |
44 | 43 |
45 #if defined(SK_TEST_QCMS) | 44 #if defined(SK_TEST_QCMS) |
46 #include "qcms.h" | 45 #include "qcms.h" |
47 #endif | 46 #endif |
48 | 47 |
| 48 #if defined(SK_XML) |
| 49 #include "SkXMLWriter.h" |
| 50 #endif |
| 51 |
49 DEFINE_bool(multiPage, false, "For document-type backends, render the source" | 52 DEFINE_bool(multiPage, false, "For document-type backends, render the source" |
50 " into multiple pages"); | 53 " into multiple pages"); |
51 DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"
); | 54 DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?"
); |
52 | 55 |
53 using sk_gpu_test::GrContextFactory; | 56 using sk_gpu_test::GrContextFactory; |
54 | 57 |
55 namespace DM { | 58 namespace DM { |
56 | 59 |
57 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} | 60 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} |
58 | 61 |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 } | 1201 } |
1199 recorder.finishRecordingAsPicture()->serialize(dst); | 1202 recorder.finishRecordingAsPicture()->serialize(dst); |
1200 return ""; | 1203 return ""; |
1201 } | 1204 } |
1202 | 1205 |
1203 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 1206 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
1204 | 1207 |
1205 SVGSink::SVGSink() {} | 1208 SVGSink::SVGSink() {} |
1206 | 1209 |
1207 Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ | 1210 Error SVGSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const
{ |
| 1211 #if defined(SK_XML) |
1208 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst)); | 1212 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(dst)); |
1209 SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create( | 1213 SkAutoTUnref<SkCanvas> canvas(SkSVGCanvas::Create( |
1210 SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size
().height())), | 1214 SkRect::MakeWH(SkIntToScalar(src.size().width()), SkIntToScalar(src.size
().height())), |
1211 xmlWriter)); | 1215 xmlWriter)); |
1212 return src.draw(canvas); | 1216 return src.draw(canvas); |
| 1217 #else |
| 1218 return Error("SVG sink is disabled."); |
| 1219 #endif // SK_XML |
1213 } | 1220 } |
1214 | 1221 |
1215 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 1222 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
1216 | 1223 |
1217 RasterSink::RasterSink(SkColorType colorType, sk_sp<SkColorSpace> colorSpace) | 1224 RasterSink::RasterSink(SkColorType colorType, sk_sp<SkColorSpace> colorSpace) |
1218 : fColorType(colorType) | 1225 : fColorType(colorType) |
1219 , fColorSpace(std::move(colorSpace)) {} | 1226 , fColorSpace(std::move(colorSpace)) {} |
1220 | 1227 |
1221 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) con
st { | 1228 Error RasterSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) con
st { |
1222 const SkISize size = src.size(); | 1229 const SkISize size = src.size(); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 skr.visit(i, drawsAsSingletonPictures); | 1561 skr.visit(i, drawsAsSingletonPictures); |
1555 } | 1562 } |
1556 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); | 1563 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); |
1557 | 1564 |
1558 canvas->drawPicture(macroPic); | 1565 canvas->drawPicture(macroPic); |
1559 return check_against_reference(bitmap, src, fSink); | 1566 return check_against_reference(bitmap, src, fSink); |
1560 }); | 1567 }); |
1561 } | 1568 } |
1562 | 1569 |
1563 } // namespace DM | 1570 } // namespace DM |
OLD | NEW |