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