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