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

Side by Side Diff: src/pipe/SkGPipeWrite.cpp

Issue 130913018: Templetized SkWriter32 readTAt() & overwriteTAt() (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Win build fix Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 450 }
451 451
452 if (shouldFlattenBitmaps(flags)) { 452 if (shouldFlattenBitmaps(flags)) {
453 fBitmapShuttle.reset(SkNEW_ARGS(BitmapShuttle, (this))); 453 fBitmapShuttle.reset(SkNEW_ARGS(BitmapShuttle, (this)));
454 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (fBitmapShuttle.get(), BITMAPS_TO _KEEP)); 454 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, (fBitmapShuttle.get(), BITMAPS_TO _KEEP));
455 } else { 455 } else {
456 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap, 456 fBitmapHeap = SkNEW_ARGS(SkBitmapHeap,
457 (BITMAPS_TO_KEEP, controller->numberOfReaders() )); 457 (BITMAPS_TO_KEEP, controller->numberOfReaders() ));
458 if (this->needOpBytes(sizeof(void*))) { 458 if (this->needOpBytes(sizeof(void*))) {
459 this->writeOp(kShareBitmapHeap_DrawOp); 459 this->writeOp(kShareBitmapHeap_DrawOp);
460 fWriter.writePtr(static_cast<void*>(fBitmapHeap)); 460 fWriter.writeT<void*>(fBitmapHeap);
mtklein 2014/02/06 21:38:16 This guy strikes me as weird now. If we're going
f(malita) 2014/02/10 16:10:35 Good point (mechanical refactor). Since we're not
461 } 461 }
462 } 462 }
463 fFlattenableHeap.setBitmapStorage(fBitmapHeap); 463 fFlattenableHeap.setBitmapStorage(fBitmapHeap);
464 this->doNotify(); 464 this->doNotify();
465 } 465 }
466 466
467 SkGPipeCanvas::~SkGPipeCanvas() { 467 SkGPipeCanvas::~SkGPipeCanvas() {
468 this->finish(true); 468 this->finish(true);
469 SkSafeUnref(fFactorySet); 469 SkSafeUnref(fFactorySet);
470 SkSafeUnref(fBitmapHeap); 470 SkSafeUnref(fBitmapHeap);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 size += sizeof(SkRect); 534 size += sizeof(SkRect);
535 } 535 }
536 if (paint) { 536 if (paint) {
537 opFlags |= kSaveLayer_HasPaint_DrawOpFlag; 537 opFlags |= kSaveLayer_HasPaint_DrawOpFlag;
538 this->writePaint(*paint); 538 this->writePaint(*paint);
539 } 539 }
540 540
541 if (this->needOpBytes(size)) { 541 if (this->needOpBytes(size)) {
542 this->writeOp(kSaveLayer_DrawOp, opFlags, saveFlags); 542 this->writeOp(kSaveLayer_DrawOp, opFlags, saveFlags);
543 if (bounds) { 543 if (bounds) {
544 fWriter.writeRect(*bounds); 544 fWriter.writeT<SkRect>(*bounds);
545 } 545 }
546 } 546 }
547 547
548 if (kNoSaveLayer == fFirstSaveLayerStackLevel){ 548 if (kNoSaveLayer == fFirstSaveLayerStackLevel){
549 fFirstSaveLayerStackLevel = this->getSaveCount(); 549 fFirstSaveLayerStackLevel = this->getSaveCount();
550 } 550 }
551 // we just pass on the save, so we don't create a layer 551 // we just pass on the save, so we don't create a layer
552 return this->INHERITED::save(saveFlags); 552 return this->INHERITED::save(saveFlags);
553 } 553 }
554 554
(...skipping 12 matching lines...) Expand all
567 567
568 bool SkGPipeCanvas::isDrawingToLayer() const { 568 bool SkGPipeCanvas::isDrawingToLayer() const {
569 return kNoSaveLayer != fFirstSaveLayerStackLevel; 569 return kNoSaveLayer != fFirstSaveLayerStackLevel;
570 } 570 }
571 571
572 bool SkGPipeCanvas::translate(SkScalar dx, SkScalar dy) { 572 bool SkGPipeCanvas::translate(SkScalar dx, SkScalar dy) {
573 if (dx || dy) { 573 if (dx || dy) {
574 NOTIFY_SETUP(this); 574 NOTIFY_SETUP(this);
575 if (this->needOpBytes(2 * sizeof(SkScalar))) { 575 if (this->needOpBytes(2 * sizeof(SkScalar))) {
576 this->writeOp(kTranslate_DrawOp); 576 this->writeOp(kTranslate_DrawOp);
577 fWriter.writeScalar(dx); 577 fWriter.writeT<SkScalar>(dx);
578 fWriter.writeScalar(dy); 578 fWriter.writeT<SkScalar>(dy);
579 } 579 }
580 } 580 }
581 return this->INHERITED::translate(dx, dy); 581 return this->INHERITED::translate(dx, dy);
582 } 582 }
583 583
584 bool SkGPipeCanvas::scale(SkScalar sx, SkScalar sy) { 584 bool SkGPipeCanvas::scale(SkScalar sx, SkScalar sy) {
585 if (sx || sy) { 585 if (sx || sy) {
586 NOTIFY_SETUP(this); 586 NOTIFY_SETUP(this);
587 if (this->needOpBytes(2 * sizeof(SkScalar))) { 587 if (this->needOpBytes(2 * sizeof(SkScalar))) {
588 this->writeOp(kScale_DrawOp); 588 this->writeOp(kScale_DrawOp);
589 fWriter.writeScalar(sx); 589 fWriter.writeT<SkScalar>(sx);
590 fWriter.writeScalar(sy); 590 fWriter.writeT<SkScalar>(sy);
591 } 591 }
592 } 592 }
593 return this->INHERITED::scale(sx, sy); 593 return this->INHERITED::scale(sx, sy);
594 } 594 }
595 595
596 bool SkGPipeCanvas::rotate(SkScalar degrees) { 596 bool SkGPipeCanvas::rotate(SkScalar degrees) {
597 if (degrees) { 597 if (degrees) {
598 NOTIFY_SETUP(this); 598 NOTIFY_SETUP(this);
599 if (this->needOpBytes(sizeof(SkScalar))) { 599 if (this->needOpBytes(sizeof(SkScalar))) {
600 this->writeOp(kRotate_DrawOp); 600 this->writeOp(kRotate_DrawOp);
601 fWriter.writeScalar(degrees); 601 fWriter.writeT<SkScalar>(degrees);
602 } 602 }
603 } 603 }
604 return this->INHERITED::rotate(degrees); 604 return this->INHERITED::rotate(degrees);
605 } 605 }
606 606
607 bool SkGPipeCanvas::skew(SkScalar sx, SkScalar sy) { 607 bool SkGPipeCanvas::skew(SkScalar sx, SkScalar sy) {
608 if (sx || sy) { 608 if (sx || sy) {
609 NOTIFY_SETUP(this); 609 NOTIFY_SETUP(this);
610 if (this->needOpBytes(2 * sizeof(SkScalar))) { 610 if (this->needOpBytes(2 * sizeof(SkScalar))) {
611 this->writeOp(kSkew_DrawOp); 611 this->writeOp(kSkew_DrawOp);
612 fWriter.writeScalar(sx); 612 fWriter.writeT<SkScalar>(sx);
613 fWriter.writeScalar(sy); 613 fWriter.writeT<SkScalar>(sy);
614 } 614 }
615 } 615 }
616 return this->INHERITED::skew(sx, sy); 616 return this->INHERITED::skew(sx, sy);
617 } 617 }
618 618
619 bool SkGPipeCanvas::concat(const SkMatrix& matrix) { 619 bool SkGPipeCanvas::concat(const SkMatrix& matrix) {
620 if (!matrix.isIdentity()) { 620 if (!matrix.isIdentity()) {
621 NOTIFY_SETUP(this); 621 NOTIFY_SETUP(this);
622 if (this->needOpBytes(matrix.writeToMemory(NULL))) { 622 if (this->needOpBytes(matrix.writeToMemory(NULL))) {
623 this->writeOp(kConcat_DrawOp); 623 this->writeOp(kConcat_DrawOp);
(...skipping 11 matching lines...) Expand all
635 } 635 }
636 this->INHERITED::setMatrix(matrix); 636 this->INHERITED::setMatrix(matrix);
637 } 637 }
638 638
639 bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp, 639 bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp,
640 bool doAntiAlias) { 640 bool doAntiAlias) {
641 NOTIFY_SETUP(this); 641 NOTIFY_SETUP(this);
642 if (this->needOpBytes(sizeof(SkRect))) { 642 if (this->needOpBytes(sizeof(SkRect))) {
643 unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; 643 unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
644 this->writeOp(kClipRect_DrawOp, flags, rgnOp); 644 this->writeOp(kClipRect_DrawOp, flags, rgnOp);
645 fWriter.writeRect(rect); 645 fWriter.writeT<SkRect>(rect);
646 } 646 }
647 return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias); 647 return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias);
648 } 648 }
649 649
650 bool SkGPipeCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op rgnOp, 650 bool SkGPipeCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op rgnOp,
651 bool doAntiAlias) { 651 bool doAntiAlias) {
652 NOTIFY_SETUP(this); 652 NOTIFY_SETUP(this);
653 if (this->needOpBytes(kSizeOfFlatRRect)) { 653 if (this->needOpBytes(kSizeOfFlatRRect)) {
654 unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; 654 unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
655 this->writeOp(kClipRRect_DrawOp, flags, rgnOp); 655 this->writeOp(kClipRRect_DrawOp, flags, rgnOp);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 fWriter.write(pts, count * sizeof(SkPoint)); 714 fWriter.write(pts, count * sizeof(SkPoint));
715 } 715 }
716 } 716 }
717 } 717 }
718 718
719 void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) { 719 void SkGPipeCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
720 NOTIFY_SETUP(this); 720 NOTIFY_SETUP(this);
721 this->writePaint(paint); 721 this->writePaint(paint);
722 if (this->needOpBytes(sizeof(SkRect))) { 722 if (this->needOpBytes(sizeof(SkRect))) {
723 this->writeOp(kDrawOval_DrawOp); 723 this->writeOp(kDrawOval_DrawOp);
724 fWriter.writeRect(rect); 724 fWriter.writeT<SkRect>(rect);
725 } 725 }
726 } 726 }
727 727
728 void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) { 728 void SkGPipeCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
729 NOTIFY_SETUP(this); 729 NOTIFY_SETUP(this);
730 this->writePaint(paint); 730 this->writePaint(paint);
731 if (this->needOpBytes(sizeof(SkRect))) { 731 if (this->needOpBytes(sizeof(SkRect))) {
732 this->writeOp(kDrawRect_DrawOp); 732 this->writeOp(kDrawRect_DrawOp);
733 fWriter.writeRect(rect); 733 fWriter.writeT<SkRect>(rect);
734 } 734 }
735 } 735 }
736 736
737 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 737 void SkGPipeCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
738 NOTIFY_SETUP(this); 738 NOTIFY_SETUP(this);
739 this->writePaint(paint); 739 this->writePaint(paint);
740 if (this->needOpBytes(kSizeOfFlatRRect)) { 740 if (this->needOpBytes(kSizeOfFlatRRect)) {
741 this->writeOp(kDrawRRect_DrawOp); 741 this->writeOp(kDrawRRect_DrawOp);
742 fWriter.writeRRect(rrect); 742 fWriter.writeRRect(rrect);
743 } 743 }
(...skipping 27 matching lines...) Expand all
771 } 771 }
772 return false; 772 return false;
773 } 773 }
774 774
775 void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top, 775 void SkGPipeCanvas::drawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top,
776 const SkPaint* paint) { 776 const SkPaint* paint) {
777 NOTIFY_SETUP(this); 777 NOTIFY_SETUP(this);
778 size_t opBytesNeeded = sizeof(SkScalar) * 2; 778 size_t opBytesNeeded = sizeof(SkScalar) * 2;
779 779
780 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint)) { 780 if (this->commonDrawBitmap(bm, kDrawBitmap_DrawOp, 0, opBytesNeeded, paint)) {
781 fWriter.writeScalar(left); 781 fWriter.writeT<SkScalar>(left);
782 fWriter.writeScalar(top); 782 fWriter.writeT<SkScalar>(top);
783 } 783 }
784 } 784 }
785 785
786 void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src, 786 void SkGPipeCanvas::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src,
787 const SkRect& dst, const SkPaint* paint , 787 const SkRect& dst, const SkPaint* paint ,
788 DrawBitmapRectFlags dbmrFlags) { 788 DrawBitmapRectFlags dbmrFlags) {
789 NOTIFY_SETUP(this); 789 NOTIFY_SETUP(this);
790 size_t opBytesNeeded = sizeof(SkRect); 790 size_t opBytesNeeded = sizeof(SkRect);
791 bool hasSrc = src != NULL; 791 bool hasSrc = src != NULL;
792 unsigned flags; 792 unsigned flags;
793 if (hasSrc) { 793 if (hasSrc) {
794 flags = kDrawBitmap_HasSrcRect_DrawOpFlag; 794 flags = kDrawBitmap_HasSrcRect_DrawOpFlag;
795 opBytesNeeded += sizeof(int32_t) * 4; 795 opBytesNeeded += sizeof(int32_t) * 4;
796 } else { 796 } else {
797 flags = 0; 797 flags = 0;
798 } 798 }
799 if (dbmrFlags & kBleed_DrawBitmapRectFlag) { 799 if (dbmrFlags & kBleed_DrawBitmapRectFlag) {
800 flags |= kDrawBitmap_Bleed_DrawOpFlag; 800 flags |= kDrawBitmap_Bleed_DrawOpFlag;
801 } 801 }
802 802
803 if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesN eeded, paint)) { 803 if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesN eeded, paint)) {
804 if (hasSrc) { 804 if (hasSrc) {
805 fWriter.writeRect(*src); 805 fWriter.writeT<SkRect>(*src);
806 } 806 }
807 fWriter.writeRect(dst); 807 fWriter.writeT<SkRect>(dst);
808 } 808 }
809 } 809 }
810 810
811 void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix, 811 void SkGPipeCanvas::drawBitmapMatrix(const SkBitmap& bm, const SkMatrix& matrix,
812 const SkPaint* paint) { 812 const SkPaint* paint) {
813 NOTIFY_SETUP(this); 813 NOTIFY_SETUP(this);
814 size_t opBytesNeeded = matrix.writeToMemory(NULL); 814 size_t opBytesNeeded = matrix.writeToMemory(NULL);
815 815
816 if (this->commonDrawBitmap(bm, kDrawBitmapMatrix_DrawOp, 0, opBytesNeeded, p aint)) { 816 if (this->commonDrawBitmap(bm, kDrawBitmapMatrix_DrawOp, 0, opBytesNeeded, p aint)) {
817 fWriter.writeMatrix(matrix); 817 fWriter.writeMatrix(matrix);
818 } 818 }
819 } 819 }
820 820
821 void SkGPipeCanvas::drawBitmapNine(const SkBitmap& bm, const SkIRect& center, 821 void SkGPipeCanvas::drawBitmapNine(const SkBitmap& bm, const SkIRect& center,
822 const SkRect& dst, const SkPaint* paint) { 822 const SkRect& dst, const SkPaint* paint) {
823 NOTIFY_SETUP(this); 823 NOTIFY_SETUP(this);
824 size_t opBytesNeeded = sizeof(int32_t) * 4 + sizeof(SkRect); 824 size_t opBytesNeeded = sizeof(int32_t) * 4 + sizeof(SkRect);
825 825
826 if (this->commonDrawBitmap(bm, kDrawBitmapNine_DrawOp, 0, opBytesNeeded, pai nt)) { 826 if (this->commonDrawBitmap(bm, kDrawBitmapNine_DrawOp, 0, opBytesNeeded, pai nt)) {
827 fWriter.write32(center.fLeft); 827 fWriter.write32(center.fLeft);
828 fWriter.write32(center.fTop); 828 fWriter.write32(center.fTop);
829 fWriter.write32(center.fRight); 829 fWriter.write32(center.fRight);
830 fWriter.write32(center.fBottom); 830 fWriter.write32(center.fBottom);
831 fWriter.writeRect(dst); 831 fWriter.writeT<SkRect>(dst);
832 } 832 }
833 } 833 }
834 834
835 void SkGPipeCanvas::drawSprite(const SkBitmap& bm, int left, int top, 835 void SkGPipeCanvas::drawSprite(const SkBitmap& bm, int left, int top,
836 const SkPaint* paint) { 836 const SkPaint* paint) {
837 NOTIFY_SETUP(this); 837 NOTIFY_SETUP(this);
838 size_t opBytesNeeded = sizeof(int32_t) * 2; 838 size_t opBytesNeeded = sizeof(int32_t) * 2;
839 839
840 if (this->commonDrawBitmap(bm, kDrawSprite_DrawOp, 0, opBytesNeeded, paint)) { 840 if (this->commonDrawBitmap(bm, kDrawSprite_DrawOp, 0, opBytesNeeded, paint)) {
841 fWriter.write32(left); 841 fWriter.write32(left);
842 fWriter.write32(top); 842 fWriter.write32(top);
843 } 843 }
844 } 844 }
845 845
846 void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x, 846 void SkGPipeCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
847 SkScalar y, const SkPaint& paint) { 847 SkScalar y, const SkPaint& paint) {
848 if (byteLength) { 848 if (byteLength) {
849 NOTIFY_SETUP(this); 849 NOTIFY_SETUP(this);
850 this->writePaint(paint); 850 this->writePaint(paint);
851 if (this->needOpBytes(4 + SkAlign4(byteLength) + 2 * sizeof(SkScalar))) { 851 if (this->needOpBytes(4 + SkAlign4(byteLength) + 2 * sizeof(SkScalar))) {
852 this->writeOp(kDrawText_DrawOp); 852 this->writeOp(kDrawText_DrawOp);
853 fWriter.write32(byteLength); 853 fWriter.write32(byteLength);
854 fWriter.writePad(text, byteLength); 854 fWriter.writePad(text, byteLength);
855 fWriter.writeScalar(x); 855 fWriter.writeT<SkScalar>(x);
856 fWriter.writeScalar(y); 856 fWriter.writeT<SkScalar>(y);
857 } 857 }
858 } 858 }
859 } 859 }
860 860
861 void SkGPipeCanvas::drawPosText(const void* text, size_t byteLength, 861 void SkGPipeCanvas::drawPosText(const void* text, size_t byteLength,
862 const SkPoint pos[], const SkPaint& paint) { 862 const SkPoint pos[], const SkPaint& paint) {
863 if (byteLength) { 863 if (byteLength) {
864 NOTIFY_SETUP(this); 864 NOTIFY_SETUP(this);
865 this->writePaint(paint); 865 this->writePaint(paint);
866 int count = paint.textToGlyphs(text, byteLength, NULL); 866 int count = paint.textToGlyphs(text, byteLength, NULL);
(...skipping 13 matching lines...) Expand all
880 if (byteLength) { 880 if (byteLength) {
881 NOTIFY_SETUP(this); 881 NOTIFY_SETUP(this);
882 this->writePaint(paint); 882 this->writePaint(paint);
883 int count = paint.textToGlyphs(text, byteLength, NULL); 883 int count = paint.textToGlyphs(text, byteLength, NULL);
884 if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkSc alar) + 4)) { 884 if (this->needOpBytes(4 + SkAlign4(byteLength) + 4 + count * sizeof(SkSc alar) + 4)) {
885 this->writeOp(kDrawPosTextH_DrawOp); 885 this->writeOp(kDrawPosTextH_DrawOp);
886 fWriter.write32(byteLength); 886 fWriter.write32(byteLength);
887 fWriter.writePad(text, byteLength); 887 fWriter.writePad(text, byteLength);
888 fWriter.write32(count); 888 fWriter.write32(count);
889 fWriter.write(xpos, count * sizeof(SkScalar)); 889 fWriter.write(xpos, count * sizeof(SkScalar));
890 fWriter.writeScalar(constY); 890 fWriter.writeT<SkScalar>(constY);
891 } 891 }
892 } 892 }
893 } 893 }
894 894
895 void SkGPipeCanvas::drawTextOnPath(const void* text, size_t byteLength, 895 void SkGPipeCanvas::drawTextOnPath(const void* text, size_t byteLength,
896 const SkPath& path, const SkMatrix* matrix, 896 const SkPath& path, const SkMatrix* matrix,
897 const SkPaint& paint) { 897 const SkPaint& paint) {
898 if (byteLength) { 898 if (byteLength) {
899 NOTIFY_SETUP(this); 899 NOTIFY_SETUP(this);
900 unsigned flags = 0; 900 unsigned flags = 0;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 if (isCrossProcess(fFlags)) { 1099 if (isCrossProcess(fFlags)) {
1100 uint32_t id = this->getTypefaceID(paint.getTypeface()); 1100 uint32_t id = this->getTypefaceID(paint.getTypeface());
1101 *ptr++ = PaintOp_packOpData(kTypeface_PaintOp, id); 1101 *ptr++ = PaintOp_packOpData(kTypeface_PaintOp, id);
1102 } else if (this->needOpBytes(sizeof(void*))) { 1102 } else if (this->needOpBytes(sizeof(void*))) {
1103 // Add to the set for ref counting. 1103 // Add to the set for ref counting.
1104 fTypefaceSet.add(paint.getTypeface()); 1104 fTypefaceSet.add(paint.getTypeface());
1105 // It is safe to write the typeface to the stream before the rest 1105 // It is safe to write the typeface to the stream before the rest
1106 // of the paint unless we ever send a kReset_PaintOp, which we 1106 // of the paint unless we ever send a kReset_PaintOp, which we
1107 // currently never do. 1107 // currently never do.
1108 this->writeOp(kSetTypeface_DrawOp); 1108 this->writeOp(kSetTypeface_DrawOp);
1109 fWriter.writePtr(paint.getTypeface()); 1109 fWriter.writeT<void*>(paint.getTypeface());
1110 } 1110 }
1111 base.setTypeface(paint.getTypeface()); 1111 base.setTypeface(paint.getTypeface());
1112 } 1112 }
1113 1113
1114 // This is a new paint, so all old flats can be safely purged, if necessary. 1114 // This is a new paint, so all old flats can be safely purged, if necessary.
1115 fFlattenableHeap.markAllFlatsSafeToDelete(); 1115 fFlattenableHeap.markAllFlatsSafeToDelete();
1116 for (int i = 0; i < kCount_PaintFlats; i++) { 1116 for (int i = 0; i < kCount_PaintFlats; i++) {
1117 int index = this->flattenToIndex(get_paintflat(paint, i), (PaintFlats)i) ; 1117 int index = this->flattenToIndex(get_paintflat(paint, i), (PaintFlats)i) ;
1118 bool replaced = index < 0; 1118 bool replaced = index < 0;
1119 if (replaced) { 1119 if (replaced) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 return fCanvas->shuttleBitmap(bitmap, slot); 1235 return fCanvas->shuttleBitmap(bitmap, slot);
1236 } 1236 }
1237 1237
1238 void BitmapShuttle::removeCanvas() { 1238 void BitmapShuttle::removeCanvas() {
1239 if (NULL == fCanvas) { 1239 if (NULL == fCanvas) {
1240 return; 1240 return;
1241 } 1241 }
1242 fCanvas->unref(); 1242 fCanvas->unref();
1243 fCanvas = NULL; 1243 fCanvas = NULL;
1244 } 1244 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698