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 #include "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 default: | 77 default: |
78 SkDEBUGFAIL("never gets here"); | 78 SkDEBUGFAIL("never gets here"); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 template <typename T> class SkRefCntTDArray : public SkTDArray<T> { | 82 template <typename T> class SkRefCntTDArray : public SkTDArray<T> { |
83 public: | 83 public: |
84 ~SkRefCntTDArray() { this->unrefAll(); } | 84 ~SkRefCntTDArray() { this->unrefAll(); } |
85 }; | 85 }; |
86 | 86 |
| 87 static inline uint32_t set_clear_mask(uint32_t bits, bool cond, uint32_t mask) { |
| 88 return cond ? bits | mask : bits & ~mask; |
| 89 } |
| 90 |
87 class SkGPipeState : public SkBitmapHeapReader { | 91 class SkGPipeState : public SkBitmapHeapReader { |
88 public: | 92 public: |
89 SkGPipeState(); | 93 SkGPipeState(); |
90 ~SkGPipeState(); | 94 ~SkGPipeState(); |
91 | 95 |
92 void setSilent(bool silent) { | 96 void setSilent(bool silent) { |
93 fSilent = silent; | 97 fSilent = silent; |
94 } | 98 } |
95 | 99 |
96 bool shouldDraw() { | 100 bool shouldDraw() { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const SkImage* getImage(int32_t slot) const { | 210 const SkImage* getImage(int32_t slot) const { |
207 return fImageHeap->get(slot); | 211 return fImageHeap->get(slot); |
208 } | 212 } |
209 | 213 |
210 private: | 214 private: |
211 void updateReader() { | 215 void updateReader() { |
212 if (nullptr == fReader) { | 216 if (nullptr == fReader) { |
213 return; | 217 return; |
214 } | 218 } |
215 bool crossProcess = SkToBool(fFlags & SkGPipeWriter::kCrossProcess_Flag)
; | 219 bool crossProcess = SkToBool(fFlags & SkGPipeWriter::kCrossProcess_Flag)
; |
216 fReader->setFlags(SkSetClearMask(fReader->getFlags(), crossProcess, | 220 fReader->setFlags(set_clear_mask(fReader->getFlags(), crossProcess, |
217 SkReadBuffer::kCrossProcess_Flag)); | 221 SkReadBuffer::kCrossProcess_Flag)); |
218 if (crossProcess) { | 222 if (crossProcess) { |
219 fReader->setFactoryArray(&fFactoryArray); | 223 fReader->setFactoryArray(&fFactoryArray); |
220 } else { | 224 } else { |
221 fReader->setFactoryArray(nullptr); | 225 fReader->setFactoryArray(nullptr); |
222 } | 226 } |
223 | 227 |
224 if (shouldFlattenBitmaps(fFlags)) { | 228 if (shouldFlattenBitmaps(fFlags)) { |
225 fReader->setBitmapStorage(this); | 229 fReader->setBitmapStorage(this); |
226 } else { | 230 } else { |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 status = kReadAtom_Status; | 1000 status = kReadAtom_Status; |
997 break; | 1001 break; |
998 } | 1002 } |
999 } | 1003 } |
1000 | 1004 |
1001 if (bytesRead) { | 1005 if (bytesRead) { |
1002 *bytesRead = reader.offset(); | 1006 *bytesRead = reader.offset(); |
1003 } | 1007 } |
1004 return status; | 1008 return status; |
1005 } | 1009 } |
OLD | NEW |