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" | 9 #include "SamplePipeControllers.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas
) { | 1012 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas
) { |
1013 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); | 1013 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); |
1014 SkGPipeWriter pipe; | 1014 SkGPipeWriter pipe; |
1015 const uint32_t kFlags = 0; | 1015 const uint32_t kFlags = 0; |
1016 return src.draw(pipe.startRecording(&controller, kFlags, size.width(), s
ize.height())); | 1016 return src.draw(pipe.startRecording(&controller, kFlags, size.width(), s
ize.height())); |
1017 }); | 1017 }); |
1018 } | 1018 } |
1019 | 1019 |
1020 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr
ing* log) const { | 1020 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr
ing* log) const { |
1021 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas*
canvas) { | 1021 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas*
canvas) { |
1022 SkAutoTDelete<SkRemote::Cache> cache(fCache ? SkRemote::Cache::CreateAlw
aysCache() | |
1023 : SkRemote::Cache::CreateNev
erCache()); | |
1024 SkRemote::Server server(canvas); | 1022 SkRemote::Server server(canvas); |
1025 SkRemote::Client client(cache, &server); | 1023 SkAutoTDelete<SkRemote::Encoder> cache(fCache |
| 1024 ? SkRemote::Encoder::CreateCachingEncoder(&server) |
| 1025 : nullptr); |
| 1026 SkRemote::Client client(cache.get() ? cache.get() : &server); |
1026 return src.draw(&client); | 1027 return src.draw(&client); |
1027 }); | 1028 }); |
1028 } | 1029 } |
1029 | 1030 |
1030 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 1031 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
1031 | 1032 |
1032 Error ViaSerialization::draw( | 1033 Error ViaSerialization::draw( |
1033 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons
t { | 1034 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons
t { |
1034 // Record our Src into a picture. | 1035 // Record our Src into a picture. |
1035 auto size = src.size(); | 1036 auto size = src.size(); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 skr.visit<void>(i, drawsAsSingletonPictures); | 1212 skr.visit<void>(i, drawsAsSingletonPictures); |
1212 } | 1213 } |
1213 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1214 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
1214 | 1215 |
1215 canvas->drawPicture(macroPic); | 1216 canvas->drawPicture(macroPic); |
1216 return ""; | 1217 return ""; |
1217 }); | 1218 }); |
1218 } | 1219 } |
1219 | 1220 |
1220 } // namespace DM | 1221 } // namespace DM |
OLD | NEW |