| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2011 Google Inc. |    2  * Copyright 2011 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 #ifndef SkPictureData_DEFINED |    8 #ifndef SkPictureData_DEFINED | 
|    9 #define SkPictureData_DEFINED |    9 #define SkPictureData_DEFINED | 
|   10  |   10  | 
|   11 #include "SkBitmap.h" |   11 #include "SkBitmap.h" | 
|   12 #include "SkPathHeap.h" |   12 #include "SkPathHeap.h" | 
|   13 #include "SkPicture.h" |   13 #include "SkPicture.h" | 
|   14 #include "SkPictureContentInfo.h" |   14 #include "SkPictureContentInfo.h" | 
|   15 #include "SkPictureFlat.h" |   15 #include "SkPictureFlat.h" | 
|   16 #include "SkPictureStateTree.h" |  | 
|   17  |   16  | 
|   18 class SkData; |   17 class SkData; | 
|   19 class SkPictureRecord; |   18 class SkPictureRecord; | 
|   20 class SkReader32; |   19 class SkReader32; | 
|   21 class SkStream; |   20 class SkStream; | 
|   22 class SkWStream; |   21 class SkWStream; | 
|   23 class SkBBoxHierarchy; |   22 class SkBBoxHierarchy; | 
|   24 class SkMatrix; |   23 class SkMatrix; | 
|   25 class SkPaint; |   24 class SkPaint; | 
|   26 class SkPath; |   25 class SkPath; | 
|   27 class SkPictureStateTree; |  | 
|   28 class SkReadBuffer; |   26 class SkReadBuffer; | 
|   29 class SkTextBlob; |   27 class SkTextBlob; | 
|   30  |   28  | 
|   31 struct SkPictInfo { |   29 struct SkPictInfo { | 
|   32     enum Flags { |   30     enum Flags { | 
|   33         kCrossProcess_Flag      = 1 << 0, |   31         kCrossProcess_Flag      = 1 << 0, | 
|   34         kScalarIsFloat_Flag     = 1 << 1, |   32         kScalarIsFloat_Flag     = 1 << 1, | 
|   35         kPtrIs64Bit_Flag        = 1 << 2, |   33         kPtrIs64Bit_Flag        = 1 << 2, | 
|   36     }; |   34     }; | 
|   37  |   35  | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
|   60 class SkPictureData { |   58 class SkPictureData { | 
|   61 public: |   59 public: | 
|   62     SkPictureData(const SkPictureRecord& record, const SkPictInfo&, bool deepCop
     yOps); |   60     SkPictureData(const SkPictureRecord& record, const SkPictInfo&, bool deepCop
     yOps); | 
|   63     static SkPictureData* CreateFromStream(SkStream*, |   61     static SkPictureData* CreateFromStream(SkStream*, | 
|   64                                            const SkPictInfo&, |   62                                            const SkPictInfo&, | 
|   65                                            SkPicture::InstallPixelRefProc); |   63                                            SkPicture::InstallPixelRefProc); | 
|   66     static SkPictureData* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&); |   64     static SkPictureData* CreateFromBuffer(SkReadBuffer&, const SkPictInfo&); | 
|   67  |   65  | 
|   68     virtual ~SkPictureData(); |   66     virtual ~SkPictureData(); | 
|   69  |   67  | 
|   70     const SkPicture::OperationList* getActiveOps(const SkRect& queryRect) const; |  | 
|   71  |  | 
|   72     void serialize(SkWStream*, SkPicture::EncodeBitmap) const; |   68     void serialize(SkWStream*, SkPicture::EncodeBitmap) const; | 
|   73     void flatten(SkWriteBuffer&) const; |   69     void flatten(SkWriteBuffer&) const; | 
|   74  |   70  | 
|   75     bool containsBitmaps() const; |   71     bool containsBitmaps() const; | 
|   76  |   72  | 
|   77     bool hasText() const { return fContentInfo.hasText(); } |   73     bool hasText() const { return fContentInfo.hasText(); } | 
|   78  |   74  | 
|   79     int opCount() const { return fContentInfo.numOperations(); } |   75     int opCount() const { return fContentInfo.numOperations(); } | 
|   80  |   76  | 
|   81     const SkData* opData() const { return fOpData; } |   77     const SkData* opData() const { return fOpData; } | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  116         } |  112         } | 
|  117         return &(*fPaints)[index - 1]; |  113         return &(*fPaints)[index - 1]; | 
|  118     } |  114     } | 
|  119  |  115  | 
|  120     const SkTextBlob* getTextBlob(SkReader32* reader) const { |  116     const SkTextBlob* getTextBlob(SkReader32* reader) const { | 
|  121         int index = reader->readInt(); |  117         int index = reader->readInt(); | 
|  122         SkASSERT(index > 0 && index <= fTextBlobCount); |  118         SkASSERT(index > 0 && index <= fTextBlobCount); | 
|  123         return fTextBlobRefs[index - 1]; |  119         return fTextBlobRefs[index - 1]; | 
|  124     } |  120     } | 
|  125  |  121  | 
|  126     void initIterator(SkPictureStateTree::Iterator* iter, |  | 
|  127                       const SkTDArray<void*>& draws, |  | 
|  128                       SkCanvas* canvas) const { |  | 
|  129         if (fStateTree) { |  | 
|  130             fStateTree->initIterator(iter, draws, canvas); |  | 
|  131         } |  | 
|  132     } |  | 
|  133  |  | 
|  134 #if SK_SUPPORT_GPU |  122 #if SK_SUPPORT_GPU | 
|  135     /** |  123     /** | 
|  136      * sampleCount is the number of samples-per-pixel or zero if non-MSAA. |  124      * sampleCount is the number of samples-per-pixel or zero if non-MSAA. | 
|  137      * It is defaulted to be zero. |  125      * It is defaulted to be zero. | 
|  138      */ |  126      */ | 
|  139     bool suitableForGpuRasterization(GrContext* context, const char **reason, |  127     bool suitableForGpuRasterization(GrContext* context, const char **reason, | 
|  140                                      int sampleCount = 0) const; |  128                                      int sampleCount = 0) const; | 
|  141  |  129  | 
|  142     /** |  130     /** | 
|  143      * Calls getRecommendedSampleCount with GrPixelConfig and dpi to calculate s
     ampleCount |  131      * Calls getRecommendedSampleCount with GrPixelConfig and dpi to calculate s
     ampleCount | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|  168  |  156  | 
|  169     SkData* fOpData;    // opcodes and parameters |  157     SkData* fOpData;    // opcodes and parameters | 
|  170  |  158  | 
|  171     SkAutoTUnref<const SkPathHeap> fPathHeap;  // reference counted |  159     SkAutoTUnref<const SkPathHeap> fPathHeap;  // reference counted | 
|  172  |  160  | 
|  173     const SkPicture** fPictureRefs; |  161     const SkPicture** fPictureRefs; | 
|  174     int fPictureCount; |  162     int fPictureCount; | 
|  175     const SkTextBlob** fTextBlobRefs; |  163     const SkTextBlob** fTextBlobRefs; | 
|  176     int fTextBlobCount; |  164     int fTextBlobCount; | 
|  177  |  165  | 
|  178     SkBBoxHierarchy* fBoundingHierarchy; |  | 
|  179     SkPictureStateTree* fStateTree; |  | 
|  180  |  | 
|  181     SkPictureContentInfo fContentInfo; |  166     SkPictureContentInfo fContentInfo; | 
|  182  |  167  | 
|  183     SkTypefacePlayback fTFPlayback; |  168     SkTypefacePlayback fTFPlayback; | 
|  184     SkFactoryPlayback* fFactoryPlayback; |  169     SkFactoryPlayback* fFactoryPlayback; | 
|  185  |  170  | 
|  186     const SkPictInfo fInfo; |  171     const SkPictInfo fInfo; | 
|  187  |  172  | 
|  188     static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); |  173     static void WriteFactories(SkWStream* stream, const SkFactorySet& rec); | 
|  189     static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); |  174     static void WriteTypefaces(SkWStream* stream, const SkRefCntSet& rec); | 
|  190  |  175  | 
|  191     void initForPlayback() const; |  176     void initForPlayback() const; | 
|  192 }; |  177 }; | 
|  193  |  178  | 
|  194 #endif |  179 #endif | 
| OLD | NEW |