OLD | NEW |
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 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 // these match Canvas apis | 36 // these match Canvas apis |
37 kClipPath_DrawOp, | 37 kClipPath_DrawOp, |
38 kClipRegion_DrawOp, | 38 kClipRegion_DrawOp, |
39 kClipRect_DrawOp, | 39 kClipRect_DrawOp, |
40 kClipRRect_DrawOp, | 40 kClipRRect_DrawOp, |
41 kConcat_DrawOp, | 41 kConcat_DrawOp, |
42 kDrawBitmap_DrawOp, | 42 kDrawBitmap_DrawOp, |
43 kDrawBitmapNine_DrawOp, | 43 kDrawBitmapNine_DrawOp, |
44 kDrawBitmapRectToRect_DrawOp, | 44 kDrawBitmapRectToRect_DrawOp, |
45 kDrawDRRect_DrawOp, | 45 kDrawDRRect_DrawOp, |
46 kDrawImage_DrawOp, | |
47 kDrawImageRect_DrawOp, | |
48 kDrawOval_DrawOp, | 46 kDrawOval_DrawOp, |
49 kDrawPaint_DrawOp, | 47 kDrawPaint_DrawOp, |
50 kDrawPatch_DrawOp, | 48 kDrawPatch_DrawOp, |
51 kDrawPath_DrawOp, | 49 kDrawPath_DrawOp, |
52 kDrawPicture_DrawOp, | 50 kDrawPicture_DrawOp, |
53 kDrawPoints_DrawOp, | 51 kDrawPoints_DrawOp, |
54 kDrawPosText_DrawOp, | 52 kDrawPosText_DrawOp, |
55 kDrawPosTextH_DrawOp, | 53 kDrawPosTextH_DrawOp, |
56 kDrawRect_DrawOp, | 54 kDrawRect_DrawOp, |
57 kDrawRRect_DrawOp, | 55 kDrawRRect_DrawOp, |
(...skipping 16 matching lines...) Expand all Loading... |
74 kSetAnnotation_DrawOp, | 72 kSetAnnotation_DrawOp, |
75 | 73 |
76 kDef_Typeface_DrawOp, | 74 kDef_Typeface_DrawOp, |
77 kDef_Flattenable_DrawOp, | 75 kDef_Flattenable_DrawOp, |
78 kDef_Bitmap_DrawOp, | 76 kDef_Bitmap_DrawOp, |
79 kDef_Factory_DrawOp, | 77 kDef_Factory_DrawOp, |
80 | 78 |
81 // these are signals to playback, not drawing verbs | 79 // these are signals to playback, not drawing verbs |
82 kReportFlags_DrawOp, | 80 kReportFlags_DrawOp, |
83 kShareBitmapHeap_DrawOp, | 81 kShareBitmapHeap_DrawOp, |
84 kShareImageHeap_DrawOp, | |
85 kDone_DrawOp, | 82 kDone_DrawOp, |
86 }; | 83 }; |
87 | 84 |
88 /** | 85 /** |
89 * DrawOp packs into a 32bit int as follows | 86 * DrawOp packs into a 32bit int as follows |
90 * | 87 * |
91 * DrawOp:8 - Flags:4 - Data:20 | 88 * DrawOp:8 - Flags:4 - Data:20 |
92 * | 89 * |
93 * Flags and Data are called out separately, so we can reuse Data between | 90 * Flags and Data are called out separately, so we can reuse Data between |
94 * different Ops that might have different Flags. e.g. Data might be a Paint | 91 * different Ops that might have different Flags. e.g. Data might be a Paint |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 }; | 134 }; |
138 enum { | 135 enum { |
139 kDrawTextOnPath_HasMatrix_DrawOpFlag = 1 << 0 | 136 kDrawTextOnPath_HasMatrix_DrawOpFlag = 1 << 0 |
140 }; | 137 }; |
141 enum { | 138 enum { |
142 kDrawVertices_HasTexs_DrawOpFlag = 1 << 0, | 139 kDrawVertices_HasTexs_DrawOpFlag = 1 << 0, |
143 kDrawVertices_HasColors_DrawOpFlag = 1 << 1, | 140 kDrawVertices_HasColors_DrawOpFlag = 1 << 1, |
144 kDrawVertices_HasIndices_DrawOpFlag = 1 << 2, | 141 kDrawVertices_HasIndices_DrawOpFlag = 1 << 2, |
145 kDrawVertices_HasXfermode_DrawOpFlag = 1 << 3, | 142 kDrawVertices_HasXfermode_DrawOpFlag = 1 << 3, |
146 }; | 143 }; |
147 // These are shared between drawbitmap and drawimage | |
148 enum { | 144 enum { |
149 kDrawBitmap_HasPaint_DrawOpFlag = 1 << 0, | 145 kDrawBitmap_HasPaint_DrawOpFlag = 1 << 0, |
150 // Specific to drawBitmapRect, but needs to be different from HasPaint, | 146 // Specific to drawBitmapRect, but needs to be different from HasPaint, |
151 // which is used for all drawBitmap calls, so include it here. | 147 // which is used for all drawBitmap calls, so include it here. |
152 kDrawBitmap_HasSrcRect_DrawOpFlag = 1 << 1, | 148 kDrawBitmap_HasSrcRect_DrawOpFlag = 1 << 1, |
153 // SkCanvas::DrawBitmapRectFlags::kBleed_DrawBitmapRectFlag is | 149 // SkCanvas::DrawBitmapRectFlags::kBleed_DrawBitmapRectFlag is |
154 // converted into and out of this flag to save space | 150 // converted into and out of this flag to save space |
155 kDrawBitmap_Bleed_DrawOpFlag = 1 << 2, | 151 kDrawBitmap_Bleed_DrawOpFlag = 1 << 2, |
156 }; | 152 }; |
157 enum { | 153 enum { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 BitmapInfo* fLessRecentlyUsed; | 206 BitmapInfo* fLessRecentlyUsed; |
211 private: | 207 private: |
212 int fToBeDrawnCount; | 208 int fToBeDrawnCount; |
213 }; | 209 }; |
214 | 210 |
215 static inline bool shouldFlattenBitmaps(uint32_t flags) { | 211 static inline bool shouldFlattenBitmaps(uint32_t flags) { |
216 return SkToBool(flags & SkGPipeWriter::kCrossProcess_Flag | 212 return SkToBool(flags & SkGPipeWriter::kCrossProcess_Flag |
217 && !(flags & SkGPipeWriter::kSharedAddressSpace_Flag)); | 213 && !(flags & SkGPipeWriter::kSharedAddressSpace_Flag)); |
218 } | 214 } |
219 | 215 |
220 class SkImageHeap : public SkRefCnt { | |
221 public: | |
222 SkImageHeap(); | |
223 virtual ~SkImageHeap(); | |
224 | |
225 // slot must be "valid" -- 0 is never valid | |
226 const SkImage* get(int32_t slot) const; | |
227 // returns 0 if not found, else returns slot | |
228 int32_t find(const SkImage*) const; | |
229 // returns non-zero value for where the image was stored | |
230 int32_t insert(const SkImage*); | |
231 | |
232 private: | |
233 SkTDArray<const SkImage*> fArray; | |
234 }; | |
235 | |
236 /////////////////////////////////////////////////////////////////////////////// | 216 /////////////////////////////////////////////////////////////////////////////// |
237 | 217 |
238 enum PaintOps { | 218 enum PaintOps { |
239 kReset_PaintOp, // no arg | 219 kReset_PaintOp, // no arg |
240 | 220 |
241 kFlags_PaintOp, // arg inline | 221 kFlags_PaintOp, // arg inline |
242 kColor_PaintOp, // arg 32 | 222 kColor_PaintOp, // arg 32 |
243 kFilterLevel_PaintOp, // arg inline | 223 kFilterLevel_PaintOp, // arg inline |
244 kStyle_PaintOp, // arg inline | 224 kStyle_PaintOp, // arg inline |
245 kJoin_PaintOp, // arg inline | 225 kJoin_PaintOp, // arg inline |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK)); | 275 SkASSERT(0 == (op & ~PAINTOPS_OP_MASK)); |
296 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK)); | 276 SkASSERT(0 == (flags & ~PAINTOPS_FLAG_MASK)); |
297 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK)); | 277 SkASSERT(0 == (data & ~PAINTOPS_DATA_MASK)); |
298 | 278 |
299 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | | 279 return (op << (PAINTOPS_FLAG_BITS + PAINTOPS_DATA_BITS)) | |
300 (flags << PAINTOPS_DATA_BITS) | | 280 (flags << PAINTOPS_DATA_BITS) | |
301 data; | 281 data; |
302 } | 282 } |
303 | 283 |
304 #endif | 284 #endif |
OLD | NEW |