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 "SamplePipeControllers.h" | |
10 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
11 #include "SkCodec.h" | 10 #include "SkCodec.h" |
12 #include "SkCommonFlags.h" | 11 #include "SkCommonFlags.h" |
13 #include "SkData.h" | 12 #include "SkData.h" |
14 #include "SkDocument.h" | 13 #include "SkDocument.h" |
15 #include "SkError.h" | 14 #include "SkError.h" |
16 #include "SkImageGenerator.h" | 15 #include "SkImageGenerator.h" |
17 #include "SkMallocPixelRef.h" | 16 #include "SkMallocPixelRef.h" |
18 #include "SkMultiPictureDraw.h" | 17 #include "SkMultiPictureDraw.h" |
19 #include "SkNullCanvas.h" | 18 #include "SkNullCanvas.h" |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 1052 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
1054 canvas.drawBitmap(*bitmap, 0, 0, &paint); | 1053 canvas.drawBitmap(*bitmap, 0, 0, &paint); |
1055 | 1054 |
1056 *bitmap = uprighted; | 1055 *bitmap = uprighted; |
1057 bitmap->lockPixels(); | 1056 bitmap->lockPixels(); |
1058 return ""; | 1057 return ""; |
1059 } | 1058 } |
1060 | 1059 |
1061 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 1060 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
1062 | 1061 |
1063 Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin
g* log) const { | |
1064 auto size = src.size(); | |
1065 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas
) { | |
1066 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); | |
1067 SkGPipeWriter pipe; | |
1068 const uint32_t kFlags = 0; | |
1069 return src.draw(pipe.startRecording(&controller, kFlags, size.width(), s
ize.height())); | |
1070 }); | |
1071 } | |
1072 | |
1073 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr
ing* log) const { | 1062 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr
ing* log) const { |
1074 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas*
target) { | 1063 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas*
target) { |
1075 SkAutoTDelete<SkRemote::Encoder> decoder(SkRemote::NewDecoder(target)); | 1064 SkAutoTDelete<SkRemote::Encoder> decoder(SkRemote::NewDecoder(target)); |
1076 SkAutoTDelete<SkRemote::Encoder> cache(fCache ? SkRemote::NewCachingEn
coder(decoder) | 1065 SkAutoTDelete<SkRemote::Encoder> cache(fCache ? SkRemote::NewCachingEn
coder(decoder) |
1077 : nullptr); | 1066 : nullptr); |
1078 SkAutoTDelete<SkCanvas> canvas(SkRemote::NewCanvas(cache ? cache : decod
er)); | 1067 SkAutoTDelete<SkCanvas> canvas(SkRemote::NewCanvas(cache ? cache : decod
er)); |
1079 return src.draw(canvas); | 1068 return src.draw(canvas); |
1080 }); | 1069 }); |
1081 } | 1070 } |
1082 | 1071 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 skr.visit<void>(i, drawsAsSingletonPictures); | 1271 skr.visit<void>(i, drawsAsSingletonPictures); |
1283 } | 1272 } |
1284 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1273 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1285 | 1274 |
1286 canvas->drawPicture(macroPic); | 1275 canvas->drawPicture(macroPic); |
1287 return ""; | 1276 return ""; |
1288 }); | 1277 }); |
1289 } | 1278 } |
1290 | 1279 |
1291 } // namespace DM | 1280 } // namespace DM |
OLD | NEW |