Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: src/core/SkPicture.cpp

Issue 301423002: Add a way for the gpu veto to report back the reason why it said no (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkPicture.h ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
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 9
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // delete playback if it is a local version (i.e. cons'd up just now) 647 // delete playback if it is a local version (i.e. cons'd up just now)
648 if (playback != fPlayback) { 648 if (playback != fPlayback) {
649 SkDELETE(playback); 649 SkDELETE(playback);
650 } 650 }
651 } else { 651 } else {
652 buffer.writeBool(false); 652 buffer.writeBool(false);
653 } 653 }
654 } 654 }
655 655
656 #if SK_SUPPORT_GPU 656 #if SK_SUPPORT_GPU
657 bool SkPicture::suitableForGpuRasterization(GrContext* context) const { 657 bool SkPicture::suitableForGpuRasterization(GrContext* context, const char **rea son) const {
658 // TODO: the heuristic used here needs to be refined 658 // TODO: the heuristic used here needs to be refined
659 static const int kNumPaintWithPathEffectUsesTol = 1; 659 static const int kNumPaintWithPathEffectUsesTol = 1;
660 static const int kNumAAConcavePaths = 5; 660 static const int kNumAAConcavePaths = 5;
661 661
662 SkASSERT(this->numAAHairlineConcavePaths() <= this->numAAConcavePaths()); 662 SkASSERT(this->numAAHairlineConcavePaths() <= this->numAAConcavePaths());
663 663
664 return this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol & & 664 bool ret = this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesT ol &&
665 (this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < kNumA AConcavePaths; 665 (this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < k NumAAConcavePaths;
robertphillips 2014/06/02 13:22:16 NULL != reason ?
666 if (!ret && reason) {
667 if (this->numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol)
ernstm 2014/05/30 22:07:04 Shouldn't this be >= ?
668 *reason = "Too many path effects.";
669 else if ((this->numAAConcavePaths()-this->numAAHairlineConcavePaths()) < kNumAAConcavePaths)
670 *reason = "Too many anti-aliased concave paths.";
671 }
672 return ret;
666 } 673 }
667 #endif 674 #endif
668 675
669 bool SkPicture::willPlayBackBitmaps() const { 676 bool SkPicture::willPlayBackBitmaps() const {
670 if (!fPlayback) { 677 if (!fPlayback) {
671 return false; 678 return false;
672 } 679 }
673 return fPlayback->containsBitmaps(); 680 return fPlayback->containsBitmaps();
674 } 681 }
675 682
(...skipping 21 matching lines...) Expand all
697 if (NULL != fRecord) { 704 if (NULL != fRecord) {
698 SkASSERT(NULL == fPlayback); 705 SkASSERT(NULL == fPlayback);
699 return SK_InvalidGenID; 706 return SK_InvalidGenID;
700 } 707 }
701 708
702 if (SK_InvalidGenID == fUniqueID) { 709 if (SK_InvalidGenID == fUniqueID) {
703 fUniqueID = next_picture_generation_id(); 710 fUniqueID = next_picture_generation_id();
704 } 711 }
705 return fUniqueID; 712 return fUniqueID;
706 } 713 }
OLDNEW
« no previous file with comments | « include/core/SkPicture.h ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698