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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 2246893002: add parallel public API for recording SkLiteDL. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | include/core/SkPictureRecorder.h » ('j') | include/core/SkPictureRecorder.h » ('J')
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 "Resources.h" 9 #include "Resources.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
11 #include "SkCodec.h" 11 #include "SkCodec.h"
12 #include "SkCodecImageGenerator.h" 12 #include "SkCodecImageGenerator.h"
13 #include "SkColorSpace.h" 13 #include "SkColorSpace.h"
14 #include "SkColorSpace_Base.h" 14 #include "SkColorSpace_Base.h"
15 #include "SkColorSpaceXform.h" 15 #include "SkColorSpaceXform.h"
16 #include "SkCommonFlags.h" 16 #include "SkCommonFlags.h"
17 #include "SkData.h" 17 #include "SkData.h"
18 #include "SkDeferredCanvas.h" 18 #include "SkDeferredCanvas.h"
19 #include "SkDocument.h" 19 #include "SkDocument.h"
20 #include "SkError.h" 20 #include "SkError.h"
21 #include "SkImageGenerator.h" 21 #include "SkImageGenerator.h"
22 #include "SkImageGeneratorCG.h" 22 #include "SkImageGeneratorCG.h"
23 #include "SkImageGeneratorWIC.h" 23 #include "SkImageGeneratorWIC.h"
24 #include "SkLiteDL.h"
25 #include "SkLiteRecorder.h"
26 #include "SkMallocPixelRef.h" 24 #include "SkMallocPixelRef.h"
27 #include "SkMultiPictureDraw.h" 25 #include "SkMultiPictureDraw.h"
28 #include "SkNullCanvas.h" 26 #include "SkNullCanvas.h"
29 #include "SkOSFile.h" 27 #include "SkOSFile.h"
30 #include "SkOpts.h" 28 #include "SkOpts.h"
31 #include "SkPictureData.h" 29 #include "SkPictureData.h"
32 #include "SkPictureRecorder.h" 30 #include "SkPictureRecorder.h"
33 #include "SkRandom.h" 31 #include "SkRandom.h"
34 #include "SkRecordDraw.h" 32 #include "SkRecordDraw.h"
35 #include "SkRecorder.h" 33 #include "SkRecorder.h"
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 1606
1609 canvas->drawPicture(macroPic); 1607 canvas->drawPicture(macroPic);
1610 return check_against_reference(bitmap, src, fSink); 1608 return check_against_reference(bitmap, src, fSink);
1611 }); 1609 });
1612 } 1610 }
1613 1611
1614 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1612 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1615 1613
1616 Error ViaLite::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin g* log) const { 1614 Error ViaLite::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin g* log) const {
1617 auto size = src.size(); 1615 auto size = src.size();
1618 SkRect bounds = {0,0, (SkScalar)size.width(), (SkScalar)size.height()};
1619 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) -> Error { 1616 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) -> Error {
1620 sk_sp<SkLiteDL> dl = SkLiteDL::New(bounds); 1617 SkPictureRecorder_Lite recorder;
1621 1618 Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.width()) ,
1622 SkLiteRecorder rec; 1619 SkIntToScalar(size.height() )));
1623 rec.reset(dl.get());
1624
1625 Error err = src.draw(&rec);
1626 if (!err.isEmpty()) { 1620 if (!err.isEmpty()) {
1627 return err; 1621 return err;
1628 } 1622 }
1629 dl->draw(canvas); 1623 sk_sp<SkDrawable> dl = recorder.finishRecordingAsDrawable();
1624 canvas->drawDrawable(dl.get());
1630 return check_against_reference(bitmap, src, fSink); 1625 return check_against_reference(bitmap, src, fSink);
1631 }); 1626 });
1632 } 1627 }
1633 1628
1634 } // namespace DM 1629 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | include/core/SkPictureRecorder.h » ('j') | include/core/SkPictureRecorder.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698