aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPicture.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-30 21:52:52 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-30 21:52:52 +0000
commita1ff26a64a0cfc337a321e6e923684bfdcadc2ec (patch)
tree916ec655e85d0f9ccf55606359515c87957e1a51 /src/core/SkPicture.cpp
parent92a8916540b14549213332c5f9f0cd44ec12de75 (diff)
Add a way for the gpu veto to report back the reason why it said no
BUG=2334 R=bsalomon@google.com Author: humper@google.com Review URL: https://codereview.chromium.org/301423002 git-svn-id: http://skia.googlecode.com/svn/trunk@15012 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPicture.cpp')
-rw-r--r--src/core/SkPicture.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 0f016acca4..57a614913e 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -654,15 +654,22 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const {
}
#if SK_SUPPORT_GPU
-bool SkPicture::suitableForGpuRasterization(GrContext* context) const {
+bool SkPicture::suitableForGpuRasterization(GrContext* context, const char **reason) const {
// TODO: the heuristic used here needs to be refined
static const int kNumPaintWithPathEffectUsesTol = 1;
static const int kNumAAConcavePaths = 5;
SkASSERT(this->numAAHairlineConcavePaths() <= this->numAAConcavePaths());
- return this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol &&
- (this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < kNumAAConcavePaths;
+ bool ret = this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol &&
+ (this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < kNumAAConcavePaths;
+ if (!ret && reason) {
+ if (this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol)
+ *reason = "Too many path effects.";
+ else if ((this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < kNumAAConcavePaths)
+ *reason = "Too many anti-aliased concave paths.";
+ }
+ return ret;
}
#endif