| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "SkPictureFlat.h" | 9 #include "SkPictureFlat.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 if (record.visit<bool>(i, text)) { | 232 if (record.visit<bool>(i, text)) { |
| 233 fHasText = true; | 233 fHasText = true; |
| 234 break; | 234 break; |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason, | 239 bool SkPicture::Analysis::suitableForGpuRasterization(const char** reason, |
| 240 int sampleCount) const { | 240 int sampleCount) const { |
| 241 // TODO: the heuristic used here needs to be refined | 241 // TODO: the heuristic used here needs to be refined |
| 242 static const int kNumSlowPathsTol = 6; | 242 static const int kNumPaintWithPathEffectsUsesTol = 1; |
| 243 static const int kNumAAConcavePathsTol = 5; |
| 243 | 244 |
| 244 int numSlowPathDashedPaths = fNumPaintWithPathEffectUses; | 245 int numNonDashedPathEffects = fNumPaintWithPathEffectUses - |
| 245 if (0 == sampleCount) { | 246 fNumFastPathDashEffects; |
| 246 // The fast dashing path only works when MSAA is disabled | 247 bool suitableForDash = (0 == fNumPaintWithPathEffectUses) || |
| 247 numSlowPathDashedPaths -= fNumFastPathDashEffects; | 248 (numNonDashedPathEffects < kNumPaintWithPathEffectsUs
esTol |
| 248 } | 249 && 0 == sampleCount); |
| 249 | 250 |
| 250 int numSlowPaths = fNumAAConcavePaths - | 251 bool ret = suitableForDash && |
| 251 fNumAAHairlineConcavePaths - | 252 (fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligib
leConcavePaths) |
| 252 fNumAADFEligibleConcavePaths; | 253 < kNumAAConcavePathsTol; |
| 253 | |
| 254 bool ret = numSlowPathDashedPaths + numSlowPaths < kNumSlowPathsTol; | |
| 255 | 254 |
| 256 if (!ret && reason) { | 255 if (!ret && reason) { |
| 257 *reason = "Too many slow paths (either concave or dashed)."; | 256 if (!suitableForDash) { |
| 257 if (0 != sampleCount) { |
| 258 *reason = "Can't use multisample on dash effect."; |
| 259 } else { |
| 260 *reason = "Too many non dashed path effects."; |
| 261 } |
| 262 } else if ((fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEl
igibleConcavePaths) |
| 263 >= kNumAAConcavePathsTol) |
| 264 *reason = "Too many anti-aliased concave paths."; |
| 265 else |
| 266 *reason = "Unknown reason for GPU unsuitability."; |
| 258 } | 267 } |
| 259 return ret; | 268 return ret; |
| 260 } | 269 } |
| 261 | 270 |
| 262 /////////////////////////////////////////////////////////////////////////////// | 271 /////////////////////////////////////////////////////////////////////////////// |
| 263 | 272 |
| 264 int SkPicture::drawableCount() const { | 273 int SkPicture::drawableCount() const { |
| 265 return fDrawablePicts.get() ? fDrawablePicts->count() : 0; | 274 return fDrawablePicts.get() ? fDrawablePicts->count() : 0; |
| 266 } | 275 } |
| 267 | 276 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 497 |
| 489 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 498 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
| 490 SkBBoxHierarchy* bbh) | 499 SkBBoxHierarchy* bbh) |
| 491 : fUniqueID(next_picture_generation_id()) | 500 : fUniqueID(next_picture_generation_id()) |
| 492 , fCullRect(cullRect) | 501 , fCullRect(cullRect) |
| 493 , fRecord(SkRef(record)) | 502 , fRecord(SkRef(record)) |
| 494 , fBBH(SkSafeRef(bbh)) | 503 , fBBH(SkSafeRef(bbh)) |
| 495 , fDrawablePicts(drawablePicts) // take ownership | 504 , fDrawablePicts(drawablePicts) // take ownership |
| 496 , fAnalysis(*fRecord) | 505 , fAnalysis(*fRecord) |
| 497 {} | 506 {} |
| OLD | NEW |