| 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 "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| 11 #include "SkCodecImageGenerator.h" | 11 #include "SkCodecImageGenerator.h" |
| 12 #include "SkCommonFlags.h" | 12 #include "SkCommonFlags.h" |
| 13 #include "SkData.h" | 13 #include "SkData.h" |
| 14 #include "SkDocument.h" | 14 #include "SkDocument.h" |
| 15 #include "SkError.h" | 15 #include "SkError.h" |
| 16 #include "SkImageGenerator.h" | 16 #include "SkImageGenerator.h" |
| 17 #include "SkMallocPixelRef.h" | 17 #include "SkMallocPixelRef.h" |
| 18 #include "SkMultiPictureDraw.h" | 18 #include "SkMultiPictureDraw.h" |
| 19 #include "SkNullCanvas.h" | 19 #include "SkNullCanvas.h" |
| 20 #include "SkOSFile.h" | 20 #include "SkOSFile.h" |
| 21 #include "SkOpts.h" | 21 #include "SkOpts.h" |
| 22 #include "SkPictureData.h" | 22 #include "SkPictureData.h" |
| 23 #include "SkPictureRecorder.h" | 23 #include "SkPictureRecorder.h" |
| 24 #include "SkRandom.h" | 24 #include "SkRandom.h" |
| 25 #include "SkRecordDraw.h" | 25 #include "SkRecordDraw.h" |
| 26 #include "SkRecorder.h" | 26 #include "SkRecorder.h" |
| 27 #include "SkRemote.h" | |
| 28 #include "SkSVGCanvas.h" | 27 #include "SkSVGCanvas.h" |
| 29 #include "SkStream.h" | 28 #include "SkStream.h" |
| 30 #include "SkTLogic.h" | 29 #include "SkTLogic.h" |
| 31 #include "SkXMLWriter.h" | 30 #include "SkXMLWriter.h" |
| 32 #include "SkSwizzler.h" | 31 #include "SkSwizzler.h" |
| 33 #include <functional> | 32 #include <functional> |
| 34 | 33 |
| 35 #ifdef SK_MOJO | 34 #ifdef SK_MOJO |
| 36 #include "SkMojo.mojom.h" | 35 #include "SkMojo.mojom.h" |
| 37 #endif | 36 #endif |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 1156 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 1158 canvas.drawBitmap(*bitmap, 0, 0, &paint); | 1157 canvas.drawBitmap(*bitmap, 0, 0, &paint); |
| 1159 | 1158 |
| 1160 *bitmap = uprighted; | 1159 *bitmap = uprighted; |
| 1161 bitmap->lockPixels(); | 1160 bitmap->lockPixels(); |
| 1162 return ""; | 1161 return ""; |
| 1163 } | 1162 } |
| 1164 | 1163 |
| 1165 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 1164 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 1166 | 1165 |
| 1167 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr
ing* log) const { | |
| 1168 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas*
target) { | |
| 1169 SkAutoTDelete<SkRemote::Encoder> decoder(SkRemote::NewDecoder(target)); | |
| 1170 SkAutoTDelete<SkRemote::Encoder> cache(fCache ? SkRemote::NewCachingEn
coder(decoder) | |
| 1171 : nullptr); | |
| 1172 SkAutoTDelete<SkCanvas> canvas(SkRemote::NewCanvas(cache ? cache : decod
er)); | |
| 1173 return src.draw(canvas); | |
| 1174 }); | |
| 1175 } | |
| 1176 | |
| 1177 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | |
| 1178 | |
| 1179 Error ViaSerialization::draw( | 1166 Error ViaSerialization::draw( |
| 1180 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons
t { | 1167 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons
t { |
| 1181 // Record our Src into a picture. | 1168 // Record our Src into a picture. |
| 1182 auto size = src.size(); | 1169 auto size = src.size(); |
| 1183 SkPictureRecorder recorder; | 1170 SkPictureRecorder recorder; |
| 1184 Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.width()), | 1171 Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.width()), |
| 1185 SkIntToScalar(size.height()))); | 1172 SkIntToScalar(size.height()))); |
| 1186 if (!err.isEmpty()) { | 1173 if (!err.isEmpty()) { |
| 1187 return err; | 1174 return err; |
| 1188 } | 1175 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 skr.visit<void>(i, drawsAsSingletonPictures); | 1412 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1426 } | 1413 } |
| 1427 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1414 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1428 | 1415 |
| 1429 canvas->drawPicture(macroPic); | 1416 canvas->drawPicture(macroPic); |
| 1430 return check_against_reference(bitmap, src, fSink); | 1417 return check_against_reference(bitmap, src, fSink); |
| 1431 }); | 1418 }); |
| 1432 } | 1419 } |
| 1433 | 1420 |
| 1434 } // namespace DM | 1421 } // namespace DM |
| OLD | NEW |