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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 2120333002: deferred canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: override drawTextRSXform Created 4 years, 5 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 | « dm/DMSrcSink.h ('k') | gyp/utils.gypi » ('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 "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 "SkDocument.h" 19 #include "SkDocument.h"
19 #include "SkError.h" 20 #include "SkError.h"
20 #include "SkImageGenerator.h" 21 #include "SkImageGenerator.h"
21 #include "SkImageGeneratorCG.h" 22 #include "SkImageGeneratorCG.h"
22 #include "SkImageGeneratorWIC.h" 23 #include "SkImageGeneratorWIC.h"
23 #include "SkMallocPixelRef.h" 24 #include "SkMallocPixelRef.h"
24 #include "SkMultiPictureDraw.h" 25 #include "SkMultiPictureDraw.h"
25 #include "SkNullCanvas.h" 26 #include "SkNullCanvas.h"
26 #include "SkOSFile.h" 27 #include "SkOSFile.h"
27 #include "SkOpts.h" 28 #include "SkOpts.h"
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 return err; 1433 return err;
1433 } 1434 }
1434 pic = recorder.finishRecordingAsPicture(); 1435 pic = recorder.finishRecordingAsPicture();
1435 canvas->drawPicture(pic); 1436 canvas->drawPicture(pic);
1436 return check_against_reference(bitmap, src, fSink); 1437 return check_against_reference(bitmap, src, fSink);
1437 }); 1438 });
1438 } 1439 }
1439 1440
1440 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 1441 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1441 1442
1443 Error ViaDefer::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStri ng* log) const {
1444 auto size = src.size();
1445 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) -> Error {
1446 SkDeferredCanvas deferred(canvas);
1447 return src.draw(&deferred);
1448 });
1449 }
1450
1451 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
1452
1442 // Draw the Src into two pictures, then draw the second picture into the wrapped Sink. 1453 // Draw the Src into two pictures, then draw the second picture into the wrapped Sink.
1443 // This tests that any shortcuts we may take while recording that second picture are legal. 1454 // This tests that any shortcuts we may take while recording that second picture are legal.
1444 Error ViaSecondPicture::draw( 1455 Error ViaSecondPicture::draw(
1445 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons t { 1456 const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) cons t {
1446 auto size = src.size(); 1457 auto size = src.size();
1447 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) -> Error { 1458 return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas ) -> Error {
1448 SkPictureRecorder recorder; 1459 SkPictureRecorder recorder;
1449 sk_sp<SkPicture> pic; 1460 sk_sp<SkPicture> pic;
1450 for (int i = 0; i < 2; i++) { 1461 for (int i = 0; i < 2; i++) {
1451 Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.widt h()), 1462 Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.widt h()),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 skr.visit(i, drawsAsSingletonPictures); 1554 skr.visit(i, drawsAsSingletonPictures);
1544 } 1555 }
1545 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture()); 1556 sk_sp<SkPicture> macroPic(macroRec.finishRecordingAsPicture());
1546 1557
1547 canvas->drawPicture(macroPic); 1558 canvas->drawPicture(macroPic);
1548 return check_against_reference(bitmap, src, fSink); 1559 return check_against_reference(bitmap, src, fSink);
1549 }); 1560 });
1550 } 1561 }
1551 1562
1552 } // namespace DM 1563 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | gyp/utils.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698