diff options
-rw-r--r-- | dm/DM.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrDrawOpAtlas.cpp | 2 | ||||
-rw-r--r-- | tests/ProxyRefTest.cpp | 4 | ||||
-rw-r--r-- | tools/timer/Timer.cpp | 12 | ||||
-rw-r--r-- | tools/timer/Timer.h | 1 |
5 files changed, 20 insertions, 3 deletions
@@ -116,7 +116,9 @@ static FILE* gVLog; template <typename... Args> static void vlog(const char* fmt, Args&&... args) { if (gVLog) { - fprintf(gVLog, "%s\t", HumanizeMs(SkTime::GetMSecs() - kStartMs).c_str()); + char s[64]; + HumanizeMs(s, 64, SkTime::GetMSecs() - kStartMs); + fprintf(gVLog, "%s\t", s); fprintf(gVLog, fmt, args...); fflush(gVLog); } diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp index 17562c9402..22def06212 100644 --- a/src/gpu/GrDrawOpAtlas.cpp +++ b/src/gpu/GrDrawOpAtlas.cpp @@ -238,7 +238,6 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, } } -#ifdef SK_GROW_ATLAS // If the simple cases fail, try to create a new page and add to it if (this->createNewPage()) { unsigned int pageIdx = fNumPages-1; @@ -253,7 +252,6 @@ bool GrDrawOpAtlas::addToAtlas(AtlasID* id, GrDrawOp::Target* target, int width, SkASSERT(false); return false; } -#endif // Try to find a plot that we can perform an inline upload to. // We prioritize this upload in reverse order of pages to counterbalance the order above. diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp index e605716c39..202dd6aeed 100644 --- a/tests/ProxyRefTest.cpp +++ b/tests/ProxyRefTest.cpp @@ -54,6 +54,10 @@ static void check_refs(skiatest::Reporter* reporter, int32_t expectedBackingRefs, int32_t expectedNumReads, int32_t expectedNumWrites) { + REPORTER_ASSERT(reporter, proxy); + if (!proxy) { + return; + } REPORTER_ASSERT(reporter, proxy->getProxyRefCnt_TestOnly() == expectedProxyRefs); REPORTER_ASSERT(reporter, proxy->getBackingRefCnt_TestOnly() == expectedBackingRefs); REPORTER_ASSERT(reporter, proxy->getPendingReadCnt_TestOnly() == expectedNumReads); diff --git a/tools/timer/Timer.cpp b/tools/timer/Timer.cpp index 28841cdc84..01ffb96674 100644 --- a/tools/timer/Timer.cpp +++ b/tools/timer/Timer.cpp @@ -17,3 +17,15 @@ SkString HumanizeMs(double ms) { #endif return SkStringPrintf("%.3gms", ms); } + +int HumanizeMs(char* s, int len, double ms) { + if (ms > 60e+3) return snprintf(s, len, "%.3gm", ms / 60e+3); + if (ms > 1e+3) return snprintf(s, len, "%.3gs", ms / 1e+3); + if (ms < 1e-3) return snprintf(s, len, "%.3gns", ms*1e+6); +#ifdef SK_BUILD_FOR_WIN + if (ms < 1) return snprintf(s, len, "%.3gus", ms*1e+3); +#else + if (ms < 1) return snprintf(s, len, "%.3gµs", ms*1e+3); +#endif + return snprintf(s, len, "%.3gms", ms); +} diff --git a/tools/timer/Timer.h b/tools/timer/Timer.h index 446eb254fd..9b0f7b2b98 100644 --- a/tools/timer/Timer.h +++ b/tools/timer/Timer.h @@ -22,5 +22,6 @@ public: }; SkString HumanizeMs(double); +int HumanizeMs(char*, int len, double); #endif |