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 #ifndef SkPicturePlayback_DEFINED | 9 #ifndef SkPicturePlayback_DEFINED |
10 #define SkPicturePlayback_DEFINED | 10 #define SkPicturePlayback_DEFINED |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // SkPictureContentInfo is not serialized! It is intended solely for use | 63 // SkPictureContentInfo is not serialized! It is intended solely for use |
64 // with suitableForGpuRasterization. | 64 // with suitableForGpuRasterization. |
65 class SkPictureContentInfo { | 65 class SkPictureContentInfo { |
66 public: | 66 public: |
67 SkPictureContentInfo() { this->reset(); } | 67 SkPictureContentInfo() { this->reset(); } |
68 | 68 |
69 SkPictureContentInfo(const SkPictureContentInfo& src) { this->set(src); } | 69 SkPictureContentInfo(const SkPictureContentInfo& src) { this->set(src); } |
70 | 70 |
71 void set(const SkPictureContentInfo& src) { | 71 void set(const SkPictureContentInfo& src) { |
72 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; | 72 fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; |
| 73 fNumFastPathDashEffects = src.fNumFastPathDashEffects; |
73 fNumAAConcavePaths = src.fNumAAConcavePaths; | 74 fNumAAConcavePaths = src.fNumAAConcavePaths; |
74 fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; | 75 fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; |
75 } | 76 } |
76 | 77 |
77 void reset() { | 78 void reset() { |
78 fNumPaintWithPathEffectUses = 0; | 79 fNumPaintWithPathEffectUses = 0; |
| 80 fNumFastPathDashEffects = 0; |
79 fNumAAConcavePaths = 0; | 81 fNumAAConcavePaths = 0; |
80 fNumAAHairlineConcavePaths = 0; | 82 fNumAAHairlineConcavePaths = 0; |
81 } | 83 } |
82 | 84 |
83 void swap(SkPictureContentInfo* other) { | 85 void swap(SkPictureContentInfo* other) { |
84 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses)
; | 86 SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses)
; |
| 87 SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects); |
85 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); | 88 SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); |
86 SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); | 89 SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); |
87 } | 90 } |
88 | 91 |
89 void incPaintWithPathEffectUses() { ++fNumPaintWithPathEffectUses; } | 92 void incPaintWithPathEffectUses() { ++fNumPaintWithPathEffectUses; } |
90 int numPaintWithPathEffectUses() const { return fNumPaintWithPathEffectUses;
} | 93 int numPaintWithPathEffectUses() const { return fNumPaintWithPathEffectUses;
} |
91 | 94 |
| 95 void incFastPathDashEffects() { ++fNumFastPathDashEffects; } |
| 96 int numFastPathDashEffects() const { return fNumFastPathDashEffects; } |
| 97 |
92 void incAAConcavePaths() { ++fNumAAConcavePaths; } | 98 void incAAConcavePaths() { ++fNumAAConcavePaths; } |
93 int numAAConcavePaths() const { return fNumAAConcavePaths; } | 99 int numAAConcavePaths() const { return fNumAAConcavePaths; } |
94 | 100 |
95 void incAAHairlineConcavePaths() { | 101 void incAAHairlineConcavePaths() { |
96 ++fNumAAHairlineConcavePaths; | 102 ++fNumAAHairlineConcavePaths; |
97 SkASSERT(fNumAAHairlineConcavePaths <= fNumAAConcavePaths); | 103 SkASSERT(fNumAAHairlineConcavePaths <= fNumAAConcavePaths); |
98 } | 104 } |
99 int numAAHairlineConcavePaths() const { return fNumAAHairlineConcavePaths; } | 105 int numAAHairlineConcavePaths() const { return fNumAAHairlineConcavePaths; } |
100 | 106 |
101 private: | 107 private: |
102 // This field is incremented every time a paint with a path effect is | 108 // This field is incremented every time a paint with a path effect is |
103 // used (i.e., it is not a de-duplicated count) | 109 // used (i.e., it is not a de-duplicated count) |
104 int fNumPaintWithPathEffectUses; | 110 int fNumPaintWithPathEffectUses; |
| 111 // This field is incremented every time a paint with a path effect that is |
| 112 // dashed, we are drawing a line, and we can use the gpu fast path |
| 113 int fNumFastPathDashEffects; |
105 // This field is incremented every time an anti-aliased drawPath call is | 114 // This field is incremented every time an anti-aliased drawPath call is |
106 // issued with a concave path | 115 // issued with a concave path |
107 int fNumAAConcavePaths; | 116 int fNumAAConcavePaths; |
108 // This field is incremented every time a drawPath call is | 117 // This field is incremented every time a drawPath call is |
109 // issued for a hairline stroked concave path. | 118 // issued for a hairline stroked concave path. |
110 int fNumAAHairlineConcavePaths; | 119 int fNumAAHairlineConcavePaths; |
111 }; | 120 }; |
112 | 121 |
113 /** | 122 /** |
114 * Container for data that is needed to deep copy a SkPicture. The container | 123 * Container for data that is needed to deep copy a SkPicture. The container |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 int dumpRectPtr(char* bufferPtr, char* buffer, char* name); | 271 int dumpRectPtr(char* bufferPtr, char* buffer, char* name); |
263 int dumpScalar(char* bufferPtr, char* buffer, char* name); | 272 int dumpScalar(char* bufferPtr, char* buffer, char* name); |
264 void dumpText(char** bufferPtrPtr, char* buffer); | 273 void dumpText(char** bufferPtrPtr, char* buffer); |
265 void dumpStream(); | 274 void dumpStream(); |
266 | 275 |
267 public: | 276 public: |
268 void dump() const; | 277 void dump() const; |
269 #endif | 278 #endif |
270 | 279 |
271 #if SK_SUPPORT_GPU | 280 #if SK_SUPPORT_GPU |
272 bool suitableForGpuRasterization(GrContext* context, const char **reason) co
nst; | 281 /** |
| 282 * sampleCount is the number of samples-per-pixel or zero if non-MSAA. |
| 283 * It is defaulted to be zero. |
| 284 */ |
| 285 bool suitableForGpuRasterization(GrContext* context, const char **reason, |
| 286 int sampleCount = 0) const; |
| 287 |
| 288 /** |
| 289 * Calls getRecommendedSampleCount with GrPixelConfig and dpi to calculate s
ampleCount |
| 290 * and then calls the above version of suitableForGpuRasterization |
| 291 */ |
| 292 bool suitableForGpuRasterization(GrContext* context, const char **reason, |
| 293 GrPixelConfig config, SkScalar dpi) const; |
273 #endif | 294 #endif |
274 | 295 |
275 private: // these help us with reading/writing | 296 private: // these help us with reading/writing |
276 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); | 297 bool parseStreamTag(SkStream*, uint32_t tag, uint32_t size, SkPicture::Insta
llPixelRefProc); |
277 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); | 298 bool parseBufferTag(SkReadBuffer&, uint32_t tag, uint32_t size); |
278 void flattenToBuffer(SkWriteBuffer&) const; | 299 void flattenToBuffer(SkWriteBuffer&) const; |
279 | 300 |
280 private: | 301 private: |
281 friend class SkPicture; | 302 friend class SkPicture; |
282 friend class SkGpuDevice; // for access to setDrawLimits & setReplacements | 303 friend class SkGpuDevice; // for access to setDrawLimits & setReplacements |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 420 |
400 void initForPlayback() const; | 421 void initForPlayback() const; |
401 | 422 |
402 #ifdef SK_BUILD_FOR_ANDROID | 423 #ifdef SK_BUILD_FOR_ANDROID |
403 SkMutex fDrawMutex; | 424 SkMutex fDrawMutex; |
404 bool fAbortCurrentPlayback; | 425 bool fAbortCurrentPlayback; |
405 #endif | 426 #endif |
406 }; | 427 }; |
407 | 428 |
408 #endif | 429 #endif |
OLD | NEW |