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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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') | dm/DMSrcSinkAndroid.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 "SkCommonFlags.h" 10 #include "SkCommonFlags.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // We turn our arguments into a Src, then draw that Src into our Sink to fil l bitmap or stream. 443 // We turn our arguments into a Src, then draw that Src into our Sink to fil l bitmap or stream.
444 struct ProxySrc : public Src { 444 struct ProxySrc : public Src {
445 const Src& fSrc; 445 const Src& fSrc;
446 SkMatrix fMatrix; 446 SkMatrix fMatrix;
447 SkISize fSize; 447 SkISize fSize;
448 448
449 ProxySrc(const Src& src, SkMatrix matrix) : fSrc(src), fMatrix(matrix) { 449 ProxySrc(const Src& src, SkMatrix matrix) : fSrc(src), fMatrix(matrix) {
450 fSize = auto_compute_translate(&fMatrix, src.size().width(), src.siz e().height()); 450 fSize = auto_compute_translate(&fMatrix, src.size().width(), src.siz e().height());
451 } 451 }
452 452
453 Error draw(SkCanvas* canvas) const SK_OVERRIDE { 453 Error draw(SkCanvas* canvas) const override {
454 canvas->concat(fMatrix); 454 canvas->concat(fMatrix);
455 return fSrc.draw(canvas); 455 return fSrc.draw(canvas);
456 } 456 }
457 SkISize size() const SK_OVERRIDE { return fSize; } 457 SkISize size() const override { return fSize; }
458 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 458 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
459 } proxy(src, fMatrix); 459 } proxy(src, fMatrix);
460 return fSink->draw(proxy, bitmap, stream, log); 460 return fSink->draw(proxy, bitmap, stream, log);
461 } 461 }
462 462
463 // Undoes any flip or 90 degree rotate without changing the scale of the bitmap. 463 // Undoes any flip or 90 degree rotate without changing the scale of the bitmap.
464 // This should be pixel-preserving. 464 // This should be pixel-preserving.
465 ViaUpright::ViaUpright(SkMatrix matrix, Sink* sink) : fMatrix(matrix), fSink(sin k) {} 465 ViaUpright::ViaUpright(SkMatrix matrix, Sink* sink) : fMatrix(matrix), fSink(sin k) {}
466 466
467 Error ViaUpright::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkSt ring* log) const { 467 Error ViaUpright::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkSt ring* log) const {
468 Error err = fSink->draw(src, bitmap, stream, log); 468 Error err = fSink->draw(src, bitmap, stream, log);
(...skipping 29 matching lines...) Expand all
498 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 498 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
499 499
500 ViaPipe::ViaPipe(Sink* sink) : fSink(sink) {} 500 ViaPipe::ViaPipe(Sink* sink) : fSink(sink) {}
501 501
502 Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin g* log) const { 502 Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkStrin g* log) const {
503 // We turn ourselves into another Src that draws our argument into bitmap/st ream via pipe. 503 // We turn ourselves into another Src that draws our argument into bitmap/st ream via pipe.
504 struct ProxySrc : public Src { 504 struct ProxySrc : public Src {
505 const Src& fSrc; 505 const Src& fSrc;
506 ProxySrc(const Src& src) : fSrc(src) {} 506 ProxySrc(const Src& src) : fSrc(src) {}
507 507
508 Error draw(SkCanvas* canvas) const SK_OVERRIDE { 508 Error draw(SkCanvas* canvas) const override {
509 SkISize size = this->size(); 509 SkISize size = this->size();
510 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); 510 PipeController controller(canvas, &SkImageDecoder::DecodeMemory);
511 SkGPipeWriter pipe; 511 SkGPipeWriter pipe;
512 const uint32_t kFlags = 0; // We mirror SkDeferredCanvas, which does n't use any flags. 512 const uint32_t kFlags = 0; // We mirror SkDeferredCanvas, which does n't use any flags.
513 return fSrc.draw(pipe.startRecording(&controller, kFlags, size.width (), size.height())); 513 return fSrc.draw(pipe.startRecording(&controller, kFlags, size.width (), size.height()));
514 } 514 }
515 SkISize size() const SK_OVERRIDE { return fSrc.size(); } 515 SkISize size() const override { return fSrc.size(); }
516 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 516 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
517 } proxy(src); 517 } proxy(src);
518 return fSink->draw(proxy, bitmap, stream, log); 518 return fSink->draw(proxy, bitmap, stream, log);
519 } 519 }
520 520
521 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 521 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
522 522
523 ViaSerialization::ViaSerialization(Sink* sink) : fSink(sink) {} 523 ViaSerialization::ViaSerialization(Sink* sink) : fSink(sink) {}
524 524
525 Error ViaSerialization::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream , SkString* log) 525 Error ViaSerialization::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream , SkString* log)
526 const { 526 const {
(...skipping 12 matching lines...) Expand all
539 pic->serialize(&wStream); 539 pic->serialize(&wStream);
540 SkAutoTDelete<SkStream> rStream(wStream.detachAsStream()); 540 SkAutoTDelete<SkStream> rStream(wStream.detachAsStream());
541 SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream, &l azy_decode_bitmap)); 541 SkAutoTUnref<SkPicture> deserialized(SkPicture::CreateFromStream(rStream, &l azy_decode_bitmap));
542 542
543 // Turn that deserialized picture into a Src, draw it into our Sink to fill bitmap or stream. 543 // Turn that deserialized picture into a Src, draw it into our Sink to fill bitmap or stream.
544 struct ProxySrc : public Src { 544 struct ProxySrc : public Src {
545 const SkPicture* fPic; 545 const SkPicture* fPic;
546 const SkISize fSize; 546 const SkISize fSize;
547 ProxySrc(const SkPicture* pic, SkISize size) : fPic(pic), fSize(size) {} 547 ProxySrc(const SkPicture* pic, SkISize size) : fPic(pic), fSize(size) {}
548 548
549 Error draw(SkCanvas* canvas) const SK_OVERRIDE { 549 Error draw(SkCanvas* canvas) const override {
550 canvas->drawPicture(fPic); 550 canvas->drawPicture(fPic);
551 return ""; 551 return "";
552 } 552 }
553 SkISize size() const SK_OVERRIDE { return fSize; } 553 SkISize size() const override { return fSize; }
554 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 554 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
555 } proxy(deserialized, src.size()); 555 } proxy(deserialized, src.size());
556 return fSink->draw(proxy, bitmap, stream, log); 556 return fSink->draw(proxy, bitmap, stream, log);
557 } 557 }
558 558
559 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 559 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
560 560
561 ViaTiles::ViaTiles(int w, int h, SkBBHFactory* factory, Sink* sink) 561 ViaTiles::ViaTiles(int w, int h, SkBBHFactory* factory, Sink* sink)
562 : fW(w) 562 : fW(w)
563 , fH(h) 563 , fH(h)
564 , fFactory(factory) 564 , fFactory(factory)
(...skipping 11 matching lines...) Expand all
576 SkAutoTUnref<SkPicture> pic(recorder.endRecording()); 576 SkAutoTUnref<SkPicture> pic(recorder.endRecording());
577 577
578 // Turn that picture into a Src that draws into our Sink via tiles + MPD. 578 // Turn that picture into a Src that draws into our Sink via tiles + MPD.
579 struct ProxySrc : public Src { 579 struct ProxySrc : public Src {
580 const int fW, fH; 580 const int fW, fH;
581 const SkPicture* fPic; 581 const SkPicture* fPic;
582 const SkISize fSize; 582 const SkISize fSize;
583 ProxySrc(int w, int h, const SkPicture* pic, SkISize size) 583 ProxySrc(int w, int h, const SkPicture* pic, SkISize size)
584 : fW(w), fH(h), fPic(pic), fSize(size) {} 584 : fW(w), fH(h), fPic(pic), fSize(size) {}
585 585
586 Error draw(SkCanvas* canvas) const SK_OVERRIDE { 586 Error draw(SkCanvas* canvas) const override {
587 const int xTiles = (fSize.width() + fW - 1) / fW, 587 const int xTiles = (fSize.width() + fW - 1) / fW,
588 yTiles = (fSize.height() + fH - 1) / fH; 588 yTiles = (fSize.height() + fH - 1) / fH;
589 SkMultiPictureDraw mpd(xTiles*yTiles); 589 SkMultiPictureDraw mpd(xTiles*yTiles);
590 SkTDArray<SkSurface*> surfaces; 590 SkTDArray<SkSurface*> surfaces;
591 surfaces.setReserve(xTiles*yTiles); 591 surfaces.setReserve(xTiles*yTiles);
592 592
593 SkImageInfo info = canvas->imageInfo().makeWH(fW, fH); 593 SkImageInfo info = canvas->imageInfo().makeWH(fW, fH);
594 for (int j = 0; j < yTiles; j++) { 594 for (int j = 0; j < yTiles; j++) {
595 for (int i = 0; i < xTiles; i++) { 595 for (int i = 0; i < xTiles; i++) {
596 // This lets our ultimate Sink determine the best kind of su rface. 596 // This lets our ultimate Sink determine the best kind of su rface.
(...skipping 12 matching lines...) Expand all
609 mpd.draw(); 609 mpd.draw();
610 for (int j = 0; j < yTiles; j++) { 610 for (int j = 0; j < yTiles; j++) {
611 for (int i = 0; i < xTiles; i++) { 611 for (int i = 0; i < xTiles; i++) {
612 SkAutoTUnref<SkImage> image(surfaces[i+xTiles*j]->newImageSn apshot()); 612 SkAutoTUnref<SkImage> image(surfaces[i+xTiles*j]->newImageSn apshot());
613 canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar( j*fH)); 613 canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar( j*fH));
614 } 614 }
615 } 615 }
616 surfaces.unrefAll(); 616 surfaces.unrefAll();
617 return ""; 617 return "";
618 } 618 }
619 SkISize size() const SK_OVERRIDE { return fSize; } 619 SkISize size() const override { return fSize; }
620 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 620 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
621 } proxy(fW, fH, pic, src.size()); 621 } proxy(fW, fH, pic, src.size());
622 return fSink->draw(proxy, bitmap, stream, log); 622 return fSink->draw(proxy, bitmap, stream, log);
623 } 623 }
624 624
625 } // namespace DM 625 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | dm/DMSrcSinkAndroid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698