| 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 kNumPaintWithPathEffectsUsesTol = 1; | 242 static const int kNumSlowPathsTol = 6; |
| 243 static const int kNumAAConcavePathsTol = 5; | |
| 244 | 243 |
| 245 int numNonDashedPathEffects = fNumPaintWithPathEffectUses - | 244 int numSlowPathDashedPaths = fNumPaintWithPathEffectUses; |
| 246 fNumFastPathDashEffects; | 245 if (0 == sampleCount) { |
| 247 bool suitableForDash = (0 == fNumPaintWithPathEffectUses) || | 246 // The fast dashing path only works when MSAA is disabled |
| 248 (numNonDashedPathEffects < kNumPaintWithPathEffectsUs
esTol | 247 numSlowPathDashedPaths -= fNumFastPathDashEffects; |
| 249 && 0 == sampleCount); | 248 } |
| 250 | 249 |
| 251 bool ret = suitableForDash && | 250 int numSlowPaths = fNumAAConcavePaths - |
| 252 (fNumAAConcavePaths - fNumAAHairlineConcavePaths - fNumAADFEligib
leConcavePaths) | 251 fNumAAHairlineConcavePaths - |
| 253 < kNumAAConcavePathsTol; | 252 fNumAADFEligibleConcavePaths; |
| 253 |
| 254 bool ret = numSlowPathDashedPaths + numSlowPaths < kNumSlowPathsTol; |
| 254 | 255 |
| 255 if (!ret && reason) { | 256 if (!ret && reason) { |
| 256 if (!suitableForDash) { | 257 *reason = "Too many slow paths (either concave or dashed)."; |
| 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."; | |
| 267 } | 258 } |
| 268 return ret; | 259 return ret; |
| 269 } | 260 } |
| 270 | 261 |
| 271 /////////////////////////////////////////////////////////////////////////////// | 262 /////////////////////////////////////////////////////////////////////////////// |
| 272 | 263 |
| 273 int SkPicture::drawableCount() const { | 264 int SkPicture::drawableCount() const { |
| 274 return fDrawablePicts.get() ? fDrawablePicts->count() : 0; | 265 return fDrawablePicts.get() ? fDrawablePicts->count() : 0; |
| 275 } | 266 } |
| 276 | 267 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 | 488 |
| 498 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, | 489 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr
awablePicts, |
| 499 SkBBoxHierarchy* bbh) | 490 SkBBoxHierarchy* bbh) |
| 500 : fUniqueID(next_picture_generation_id()) | 491 : fUniqueID(next_picture_generation_id()) |
| 501 , fCullRect(cullRect) | 492 , fCullRect(cullRect) |
| 502 , fRecord(SkRef(record)) | 493 , fRecord(SkRef(record)) |
| 503 , fBBH(SkSafeRef(bbh)) | 494 , fBBH(SkSafeRef(bbh)) |
| 504 , fDrawablePicts(drawablePicts) // take ownership | 495 , fDrawablePicts(drawablePicts) // take ownership |
| 505 , fAnalysis(*fRecord) | 496 , fAnalysis(*fRecord) |
| 506 {} | 497 {} |
| OLD | NEW |