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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 334053005: Remove dashing from gpu veto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change to use wall timer 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 75801fb960fa50885240d94eca72ad0b90e1df78..16887107fb59788644c4f9cbd4eea82bef2cffcf 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -14,6 +14,10 @@
#include "SkTSort.h"
#include "SkWriteBuffer.h"
+#if SK_SUPPORT_GPU
+#include "GrContext.h"
+#endif
+
template <typename T> int SafeCount(const T* obj) {
return obj ? obj->count() : 0;
}
@@ -1335,27 +1339,51 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback)
#if SK_SUPPORT_GPU
-bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const char **reason) const {
+bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const char **reason,
+ int sampleCount) const {
// TODO: the heuristic used here needs to be refined
static const int kNumPaintWithPathEffectUsesTol = 1;
static const int kNumAAConcavePaths = 5;
SkASSERT(fContentInfo.numAAHairlineConcavePaths() <= fContentInfo.numAAConcavePaths());
- bool ret = fContentInfo.numPaintWithPathEffectUses() < kNumPaintWithPathEffectUsesTol &&
+ int numNonDashedPathEffects = fContentInfo.numPaintWithPathEffectUses() -
+ fContentInfo.numFastPathDashEffects();
+
+ bool suitableForDash = (0 == fContentInfo.numPaintWithPathEffectUses()) ||
+ (numNonDashedPathEffects < kNumPaintWithPathEffectUsesTol
+ && 0 == sampleCount);
+
+ bool ret = suitableForDash &&
(fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlineConcavePaths())
< kNumAAConcavePaths;
if (!ret && NULL != reason) {
- if (fContentInfo.numPaintWithPathEffectUses() >= kNumPaintWithPathEffectUsesTol)
- *reason = "Too many path effects.";
- else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlineConcavePaths())
- >= kNumAAConcavePaths)
+ if (!suitableForDash) {
+ if (0 != sampleCount) {
+ *reason = "Can't use multisample on dash effect.";
+ } else {
+ *reason = "Too many non dashed path effects.";
+ }
+ } else if ((fContentInfo.numAAConcavePaths() - fContentInfo.numAAHairlineConcavePaths())
+ >= kNumAAConcavePaths)
*reason = "Too many anti-aliased concave paths.";
else
*reason = "Unknown reason for GPU unsuitability.";
}
return ret;
}
+
+bool SkPicturePlayback::suitableForGpuRasterization(GrContext* context, const char **reason,
+ GrPixelConfig config, SkScalar dpi) const {
+
+ if (context != NULL) {
+ return this->suitableForGpuRasterization(context, reason,
+ context->getRecommendedSampleCount(config, dpi));
+ } else {
+ return this->suitableForGpuRasterization(NULL, reason);
+ }
+}
+
#endif
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | src/core/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698