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

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

Issue 26606004: change SkAnnotation to not inherit from SkFlattenable (does not need dynamic factories) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('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 /* 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 9
10 #include "SkBitmapHeap.h" 10 #include "SkBitmapHeap.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkGPipe.h" 13 #include "SkGPipe.h"
14 #include "SkGPipePriv.h" 14 #include "SkGPipePriv.h"
15 #include "SkReader32.h" 15 #include "SkReader32.h"
16 #include "SkStream.h" 16 #include "SkStream.h"
17 17
18 #include "SkAnnotation.h"
18 #include "SkColorFilter.h" 19 #include "SkColorFilter.h"
19 #include "SkDrawLooper.h" 20 #include "SkDrawLooper.h"
20 #include "SkMaskFilter.h" 21 #include "SkMaskFilter.h"
21 #include "SkOrderedReadBuffer.h" 22 #include "SkOrderedReadBuffer.h"
22 #include "SkPathEffect.h" 23 #include "SkPathEffect.h"
23 #include "SkRasterizer.h" 24 #include "SkRasterizer.h"
24 #include "SkRRect.h" 25 #include "SkRRect.h"
25 #include "SkShader.h" 26 #include "SkShader.h"
26 #include "SkTypeface.h" 27 #include "SkTypeface.h"
27 #include "SkXfermode.h" 28 #include "SkXfermode.h"
(...skipping 18 matching lines...) Expand all
46 break; 47 break;
47 case kShader_PaintFlat: 48 case kShader_PaintFlat:
48 paint->setShader((SkShader*)obj); 49 paint->setShader((SkShader*)obj);
49 break; 50 break;
50 case kImageFilter_PaintFlat: 51 case kImageFilter_PaintFlat:
51 paint->setImageFilter((SkImageFilter*)obj); 52 paint->setImageFilter((SkImageFilter*)obj);
52 break; 53 break;
53 case kXfermode_PaintFlat: 54 case kXfermode_PaintFlat:
54 paint->setXfermode((SkXfermode*)obj); 55 paint->setXfermode((SkXfermode*)obj);
55 break; 56 break;
56 case kAnnotation_PaintFlat:
57 paint->setAnnotation((SkAnnotation*)obj);
58 break;
59 default: 57 default:
60 SkDEBUGFAIL("never gets here"); 58 SkDEBUGFAIL("never gets here");
61 } 59 }
62 } 60 }
63 61
64 template <typename T> class SkRefCntTDArray : public SkTDArray<T> { 62 template <typename T> class SkRefCntTDArray : public SkTDArray<T> {
65 public: 63 public:
66 ~SkRefCntTDArray() { this->unrefAll(); } 64 ~SkRefCntTDArray() { this->unrefAll(); }
67 }; 65 };
68 66
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 } while (reader->offset() < stop); 663 } while (reader->offset() < stop);
666 } 664 }
667 665
668 static void typeface_rp(SkCanvas*, SkReader32* reader, uint32_t, 666 static void typeface_rp(SkCanvas*, SkReader32* reader, uint32_t,
669 SkGPipeState* state) { 667 SkGPipeState* state) {
670 SkASSERT(!SkToBool(state->getFlags() & SkGPipeWriter::kCrossProcess_Flag)); 668 SkASSERT(!SkToBool(state->getFlags() & SkGPipeWriter::kCrossProcess_Flag));
671 SkPaint* p = state->editPaint(); 669 SkPaint* p = state->editPaint();
672 p->setTypeface(static_cast<SkTypeface*>(reader->readPtr())); 670 p->setTypeface(static_cast<SkTypeface*>(reader->readPtr()));
673 } 671 }
674 672
673 static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32,
674 SkGPipeState* state) {
675 SkPaint* p = state->editPaint();
676
677 if (SkToBool(PaintOp_unpackData(op32))) {
678 const size_t size = reader->readU32();
679 SkAutoMalloc storage(size);
680
681 reader->read(storage.get(), size);
682 SkOrderedReadBuffer buffer(storage.get(), size);
683 p->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref();
684 } else {
685 p->setAnnotation(NULL);
686 }
687 }
688
675 /////////////////////////////////////////////////////////////////////////////// 689 ///////////////////////////////////////////////////////////////////////////////
676 690
677 static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* stat e) { 691 static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* stat e) {
678 state->addTypeface(); 692 state->addTypeface();
679 } 693 }
680 694
681 static void def_PaintFlat_rp(SkCanvas*, SkReader32*, uint32_t op32, 695 static void def_PaintFlat_rp(SkCanvas*, SkReader32*, uint32_t op32,
682 SkGPipeState* state) { 696 SkGPipeState* state) {
683 PaintFlats pf = (PaintFlats)DrawOp_unpackFlags(op32); 697 PaintFlats pf = (PaintFlats)DrawOp_unpackFlags(op32);
684 unsigned index = DrawOp_unpackData(op32); 698 unsigned index = DrawOp_unpackData(op32);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 rotate_rp, 762 rotate_rp,
749 save_rp, 763 save_rp,
750 saveLayer_rp, 764 saveLayer_rp,
751 scale_rp, 765 scale_rp,
752 setMatrix_rp, 766 setMatrix_rp,
753 skew_rp, 767 skew_rp,
754 translate_rp, 768 translate_rp,
755 769
756 paintOp_rp, 770 paintOp_rp,
757 typeface_rp, 771 typeface_rp,
772 annotation_rp,
773
758 def_Typeface_rp, 774 def_Typeface_rp,
759 def_PaintFlat_rp, 775 def_PaintFlat_rp,
760 def_Bitmap_rp, 776 def_Bitmap_rp,
761 def_Factory_rp, 777 def_Factory_rp,
762 778
763 reportFlags_rp, 779 reportFlags_rp,
764 shareBitmapHeap_rp, 780 shareBitmapHeap_rp,
765 done_rp 781 done_rp
766 }; 782 };
767 783
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 status = kReadAtom_Status; 869 status = kReadAtom_Status;
854 break; 870 break;
855 } 871 }
856 } 872 }
857 873
858 if (bytesRead) { 874 if (bytesRead) {
859 *bytesRead = reader.offset(); 875 *bytesRead = reader.offset();
860 } 876 }
861 return status; 877 return status;
862 } 878 }
OLDNEW
« no previous file with comments | « src/pipe/SkGPipePriv.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698