Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1409113005: SkRemote: more refactoring (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: forward declares Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkRemote.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 auto size = src.size(); 1155 auto size = src.size();
1156 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) { 1156 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) {
1157 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); 1157 PipeController controller(canvas, &SkImageDecoder::DecodeMemory);
1158 SkGPipeWriter pipe; 1158 SkGPipeWriter pipe;
1159 const uint32_t kFlags = 0; 1159 const uint32_t kFlags = 0;
1160 return src.draw(pipe.startRecording(&controller, kFlags, size.width(), s ize.height())); 1160 return src.draw(pipe.startRecording(&controller, kFlags, size.width(), s ize.height()));
1161 }); 1161 });
1162 } 1162 }
1163 1163
1164 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr ing* log) const { 1164 Error ViaRemote::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStr ing* log) const {
1165 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas* canvas) { 1165 return draw_to_canvas(fSink, bitmap, stream, log, src.size(), [&](SkCanvas* target) {
1166 SkRemote::Server server(canvas); 1166 SkAutoTDelete<SkRemote::Encoder> decoder(SkRemote::NewDecoder(target));
1167 SkAutoTDelete<SkRemote::Encoder> cache(fCache 1167 SkAutoTDelete<SkRemote::Encoder> cache(fCache ? SkRemote::NewCachingEn coder(decoder)
1168 ? SkRemote::Encoder::CreateCachingEncoder(&server) 1168 : nullptr);
1169 : nullptr); 1169 SkAutoTDelete<SkCanvas> canvas(SkRemote::NewCanvas(cache ? cache : decod er));
1170 SkRemote::Client client(cache.get() ? cache.get() : &server); 1170 return src.draw(canvas);
1171 return src.draw(&client);
1172 }); 1171 });
1173 } 1172 }
1174 1173
1175 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1174 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1176 1175
1177 Error ViaSerialization::draw( 1176 Error ViaSerialization::draw(
1178 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons t { 1177 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons t {
1179 // Record our Src into a picture. 1178 // Record our Src into a picture.
1180 auto size = src.size(); 1179 auto size = src.size();
1181 SkPictureRecorder recorder; 1180 SkPictureRecorder recorder;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 skr.visit<void>(i, drawsAsSingletonPictures); 1355 skr.visit<void>(i, drawsAsSingletonPictures);
1357 } 1356 }
1358 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); 1357 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture());
1359 1358
1360 canvas->drawPicture(macroPic); 1359 canvas->drawPicture(macroPic);
1361 return ""; 1360 return "";
1362 }); 1361 });
1363 } 1362 }
1364 1363
1365 } // namespace DM 1364 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRemote.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698