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

Unified Diff: tests/PathOpsSkpClipTest.cpp

Issue 1811613004: Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Rebase. Created 4 years, 9 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/views/SkTouchGesture.cpp ('k') | tests/SkpSkGrTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsSkpClipTest.cpp
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index d11f8e063418f594ca956fa9c527a17bdfca879e..b5fd58d3d5406b746509a73ca287895b9850f6ef 100644
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -215,7 +215,7 @@ struct TestResult {
TestStep fTestStep;
int fDirNo;
int fPixelError;
- int fTime;
+ SkMSec fTime;
int fScale;
};
@@ -372,7 +372,7 @@ static bool addError(TestState* data, const TestResult& testResult) {
}
}
int slowCount = data->fSlowest.count();
- int time = testResult.fTime;
+ SkMSec time = testResult.fTime;
if (time > 0) {
for (int index = 0; index < slowCount; ++index) {
if (time > data->fSlowest[index].fTime) {
@@ -402,7 +402,7 @@ static SkMSec timePict(SkPicture* pic, SkCanvas* canvas) {
SkScalar yInterval = SkTMax(pHeight - maxDimension, 0.0f) / (slices - 1);
SkRect rect = {0, 0, SkTMin(maxDimension, pWidth), SkTMin(maxDimension, pHeight) };
canvas->clipRect(rect);
- SkMSec start = SkTime::GetMSecs();
+ double start = SkTime::GetMSecs();
for (int x = 0; x < slices; ++x) {
for (int y = 0; y < slices; ++y) {
pic->playback(canvas);
@@ -410,9 +410,9 @@ static SkMSec timePict(SkPicture* pic, SkCanvas* canvas) {
}
canvas->translate(xInterval, -yInterval * slices);
}
- SkMSec end = SkTime::GetMSecs();
+ double end = SkTime::GetMSecs();
canvas->restore();
- return end - start;
+ return static_cast<SkMSec>(end - start);
}
static void drawPict(SkPicture* pic, SkCanvas* canvas, int scale) {
@@ -502,9 +502,9 @@ void TestResult::testOne() {
drawPict(pic.get(), &opCanvas, fScale);
if (fTestStep == kCompareBits) {
fPixelError = similarBits(oldBitmap, opBitmap);
- int oldTime = timePict(pic.get(), &oldCanvas);
- int opTime = timePict(pic.get(), &opCanvas);
- fTime = SkTMax(0, oldTime - opTime);
+ SkMSec oldTime = timePict(pic.get(), &oldCanvas);
+ SkMSec opTime = timePict(pic.get(), &opCanvas);
+ fTime = SkTMax(static_cast<SkMSec>(0), oldTime - opTime);
} else if (fTestStep == kEncodeFiles) {
SkString pngStr = make_png_name(fFilename);
const char* pngName = pngStr.c_str();
« no previous file with comments | « src/views/SkTouchGesture.cpp ('k') | tests/SkpSkGrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698