2015-01-27 14:17:22 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2015 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkPath.h"
|
|
|
|
#include "include/core/SkRRect.h"
|
|
|
|
#include "include/core/SkTime.h"
|
|
|
|
#include "include/utils/SkInterpolator.h"
|
|
|
|
#include "samplecode/Sample.h"
|
2015-01-27 14:17:22 +00:00
|
|
|
|
|
|
|
// This slide tests out the match up between BW clipping and rendering. It can
|
|
|
|
// draw a large rect through some clip geometry and draw the same geometry
|
|
|
|
// normally. Which one is drawn first can be toggled. The pair of objects is translated
|
|
|
|
// fractionally (via an animator) to expose snapping bugs. The key bindings are:
|
|
|
|
// 1-9: the different geometries
|
|
|
|
// t: toggle which is drawn first the clip or the normal geometry
|
2015-02-09 15:47:17 +00:00
|
|
|
// f: flip-flops which corner the bottom AA clip rect occupies in the complex clip cases
|
2015-01-27 14:17:22 +00:00
|
|
|
|
|
|
|
// The possible geometric combinations to test
|
|
|
|
enum Geometry {
|
|
|
|
kRect_Geometry,
|
|
|
|
kRRect_Geometry,
|
|
|
|
kCircle_Geometry,
|
|
|
|
kConvexPath_Geometry,
|
|
|
|
kConcavePath_Geometry,
|
|
|
|
kRectAndRect_Geometry,
|
|
|
|
kRectAndRRect_Geometry,
|
|
|
|
kRectAndConvex_Geometry,
|
|
|
|
kRectAndConcave_Geometry
|
|
|
|
};
|
|
|
|
|
|
|
|
// The basic rect used is [kMin,kMin]..[kMax,kMax]
|
|
|
|
static const float kMin = 100.5f;
|
|
|
|
static const float kMid = 200.0f;
|
|
|
|
static const float kMax = 299.5f;
|
|
|
|
|
2015-02-09 15:47:17 +00:00
|
|
|
// The translation applied to the base AA rect in the combination cases
|
|
|
|
// (i.e., kRectAndRect through kRectAndConcave)
|
|
|
|
static const float kXlate = 100.0f;
|
|
|
|
|
2015-01-27 14:17:22 +00:00
|
|
|
SkRect create_rect(const SkPoint& offset) {
|
|
|
|
SkRect r = SkRect::MakeLTRB(kMin, kMin, kMax, kMax);
|
|
|
|
r.offset(offset);
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkRRect create_rrect(const SkPoint& offset) {
|
|
|
|
SkRRect rrect;
|
|
|
|
rrect.setRectXY(create_rect(offset), 10, 10);
|
|
|
|
return rrect;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkRRect create_circle(const SkPoint& offset) {
|
|
|
|
SkRRect circle;
|
|
|
|
circle.setOval(create_rect(offset));
|
|
|
|
return circle;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkPath create_convex_path(const SkPoint& offset) {
|
|
|
|
SkPath convexPath;
|
|
|
|
convexPath.moveTo(kMin, kMin);
|
|
|
|
convexPath.lineTo(kMax, kMax);
|
|
|
|
convexPath.lineTo(kMin, kMax);
|
|
|
|
convexPath.close();
|
|
|
|
convexPath.offset(offset.fX, offset.fY);
|
|
|
|
return convexPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkPath create_concave_path(const SkPoint& offset) {
|
|
|
|
SkPath concavePath;
|
|
|
|
concavePath.moveTo(kMin, kMin);
|
|
|
|
concavePath.lineTo(kMid, 105.0f);
|
|
|
|
concavePath.lineTo(kMax, kMin);
|
|
|
|
concavePath.lineTo(295.0f, kMid);
|
|
|
|
concavePath.lineTo(kMax, kMax);
|
|
|
|
concavePath.lineTo(kMid, 295.0f);
|
|
|
|
concavePath.lineTo(kMin, kMax);
|
|
|
|
concavePath.lineTo(105.0f, kMid);
|
|
|
|
concavePath.close();
|
|
|
|
|
|
|
|
concavePath.offset(offset.fX, offset.fY);
|
|
|
|
return concavePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void draw_normal_geom(SkCanvas* canvas, const SkPoint& offset, int geom, bool useAA) {
|
|
|
|
SkPaint p;
|
|
|
|
p.setAntiAlias(useAA);
|
|
|
|
p.setColor(SK_ColorBLACK);
|
|
|
|
|
|
|
|
switch (geom) {
|
|
|
|
case kRect_Geometry: // fall thru
|
|
|
|
case kRectAndRect_Geometry:
|
|
|
|
canvas->drawRect(create_rect(offset), p);
|
|
|
|
break;
|
|
|
|
case kRRect_Geometry: // fall thru
|
|
|
|
case kRectAndRRect_Geometry:
|
|
|
|
canvas->drawRRect(create_rrect(offset), p);
|
|
|
|
break;
|
|
|
|
case kCircle_Geometry:
|
|
|
|
canvas->drawRRect(create_circle(offset), p);
|
|
|
|
break;
|
|
|
|
case kConvexPath_Geometry: // fall thru
|
|
|
|
case kRectAndConvex_Geometry:
|
|
|
|
canvas->drawPath(create_convex_path(offset), p);
|
|
|
|
break;
|
|
|
|
case kConcavePath_Geometry: // fall thru
|
|
|
|
case kRectAndConcave_Geometry:
|
|
|
|
canvas->drawPath(create_concave_path(offset), p);
|
|
|
|
break;
|
2016-03-29 16:03:52 +00:00
|
|
|
}
|
2015-01-27 14:17:22 +00:00
|
|
|
}
|
|
|
|
|
2018-08-08 15:36:17 +00:00
|
|
|
class ClipDrawMatchView : public Sample {
|
2015-01-27 14:17:22 +00:00
|
|
|
public:
|
2015-02-09 15:47:17 +00:00
|
|
|
ClipDrawMatchView() : fTrans(2, 5), fGeom(kRect_Geometry), fClipFirst(true), fSign(1) {
|
2015-01-27 14:17:22 +00:00
|
|
|
SkScalar values[2];
|
|
|
|
|
|
|
|
fTrans.setRepeatCount(999);
|
|
|
|
values[0] = values[1] = 0;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.setKeyFrame(0, GetMSecs() + 1000, values);
|
2015-01-27 14:17:22 +00:00
|
|
|
values[1] = 1;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.setKeyFrame(1, GetMSecs() + 2000, values);
|
2015-01-27 14:17:22 +00:00
|
|
|
values[0] = values[1] = 1;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.setKeyFrame(2, GetMSecs() + 3000, values);
|
2015-01-27 14:17:22 +00:00
|
|
|
values[1] = 0;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.setKeyFrame(3, GetMSecs() + 4000, values);
|
2015-01-27 14:17:22 +00:00
|
|
|
values[0] = 0;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.setKeyFrame(4, GetMSecs() + 5000, values);
|
2015-01-27 14:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2019-07-03 14:55:44 +00:00
|
|
|
SkString name() override { return SkString("ClipDrawMatch"); }
|
|
|
|
|
2019-07-03 19:53:04 +00:00
|
|
|
bool onChar(SkUnichar uni) override {
|
2015-01-27 14:17:22 +00:00
|
|
|
switch (uni) {
|
2017-11-22 21:36:07 +00:00
|
|
|
case '1': fGeom = kRect_Geometry; return true;
|
|
|
|
case '2': fGeom = kRRect_Geometry; return true;
|
|
|
|
case '3': fGeom = kCircle_Geometry; return true;
|
|
|
|
case '4': fGeom = kConvexPath_Geometry; return true;
|
|
|
|
case '5': fGeom = kConcavePath_Geometry; return true;
|
|
|
|
case '6': fGeom = kRectAndRect_Geometry; return true;
|
|
|
|
case '7': fGeom = kRectAndRRect_Geometry; return true;
|
|
|
|
case '8': fGeom = kRectAndConvex_Geometry; return true;
|
|
|
|
case '9': fGeom = kRectAndConcave_Geometry; return true;
|
|
|
|
case 'f': fSign = -fSign; return true;
|
|
|
|
case 't': fClipFirst = !fClipFirst; return true;
|
2015-01-27 14:17:22 +00:00
|
|
|
default: break;
|
|
|
|
}
|
2019-07-03 19:53:04 +00:00
|
|
|
return false;
|
2015-01-27 14:17:22 +00:00
|
|
|
}
|
|
|
|
|
2015-02-09 15:47:17 +00:00
|
|
|
void drawClippedGeom(SkCanvas* canvas, const SkPoint& offset, bool useAA) {
|
|
|
|
|
|
|
|
int count = canvas->save();
|
|
|
|
|
|
|
|
switch (fGeom) {
|
|
|
|
case kRect_Geometry:
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRect(create_rect(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
break;
|
|
|
|
case kRRect_Geometry:
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRRect(create_rrect(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
break;
|
|
|
|
case kCircle_Geometry:
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRRect(create_circle(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
break;
|
|
|
|
case kConvexPath_Geometry:
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipPath(create_convex_path(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
break;
|
|
|
|
case kConcavePath_Geometry:
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipPath(create_concave_path(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
break;
|
|
|
|
case kRectAndRect_Geometry: {
|
|
|
|
SkRect r = create_rect(offset);
|
|
|
|
r.offset(fSign * kXlate, fSign * kXlate);
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRect(r, true); // AA here forces shader clips
|
|
|
|
canvas->clipRect(create_rect(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
} break;
|
|
|
|
case kRectAndRRect_Geometry: {
|
|
|
|
SkRect r = create_rect(offset);
|
|
|
|
r.offset(fSign * kXlate, fSign * kXlate);
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRect(r, true); // AA here forces shader clips
|
|
|
|
canvas->clipRRect(create_rrect(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
} break;
|
|
|
|
case kRectAndConvex_Geometry: {
|
|
|
|
SkRect r = create_rect(offset);
|
|
|
|
r.offset(fSign * kXlate, fSign * kXlate);
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRect(r, true); // AA here forces shader clips
|
|
|
|
canvas->clipPath(create_convex_path(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
} break;
|
|
|
|
case kRectAndConcave_Geometry: {
|
|
|
|
SkRect r = create_rect(offset);
|
|
|
|
r.offset(fSign * kXlate, fSign * kXlate);
|
2016-09-21 18:15:07 +00:00
|
|
|
canvas->clipRect(r, true); // AA here forces shader clips
|
|
|
|
canvas->clipPath(create_concave_path(offset), useAA);
|
2015-02-09 15:47:17 +00:00
|
|
|
} break;
|
2016-03-29 16:03:52 +00:00
|
|
|
}
|
2015-02-09 15:47:17 +00:00
|
|
|
|
2017-02-22 18:21:42 +00:00
|
|
|
SkISize size = canvas->getBaseLayerSize();
|
2015-02-09 15:47:17 +00:00
|
|
|
SkRect bigR = SkRect::MakeWH(SkIntToScalar(size.width()), SkIntToScalar(size.height()));
|
|
|
|
|
|
|
|
SkPaint p;
|
|
|
|
p.setColor(SK_ColorRED);
|
|
|
|
|
|
|
|
canvas->drawRect(bigR, p);
|
|
|
|
canvas->restoreToCount(count);
|
|
|
|
}
|
|
|
|
|
2015-01-27 14:17:22 +00:00
|
|
|
// Draw a big red rect through some clip geometry and also draw that same
|
|
|
|
// geometry in black. The order in which they are drawn can be swapped.
|
|
|
|
// This tests whether the clip and normally drawn geometry match up.
|
|
|
|
void drawGeometry(SkCanvas* canvas, const SkPoint& offset, bool useAA) {
|
|
|
|
if (fClipFirst) {
|
2015-02-09 15:47:17 +00:00
|
|
|
this->drawClippedGeom(canvas, offset, useAA);
|
2015-01-27 14:17:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
draw_normal_geom(canvas, offset, fGeom, useAA);
|
|
|
|
|
|
|
|
if (!fClipFirst) {
|
2015-02-09 15:47:17 +00:00
|
|
|
this->drawClippedGeom(canvas, offset, useAA);
|
2015-01-27 14:17:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
void onDrawContent(SkCanvas* canvas) override {
|
2015-01-27 14:17:22 +00:00
|
|
|
SkScalar trans[2];
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
fTrans.timeToValues(GetMSecs(), trans);
|
2015-01-27 14:17:22 +00:00
|
|
|
|
|
|
|
SkPoint offset;
|
|
|
|
offset.set(trans[0], trans[1]);
|
|
|
|
|
|
|
|
int saveCount = canvas->save();
|
|
|
|
this->drawGeometry(canvas, offset, false);
|
|
|
|
canvas->restoreToCount(saveCount);
|
|
|
|
}
|
|
|
|
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
SkMSec GetMSecs() const {
|
|
|
|
return static_cast<SkMSec>(SkTime::GetMSecs() - fStart);
|
|
|
|
}
|
|
|
|
|
2015-01-27 14:17:22 +00:00
|
|
|
private:
|
|
|
|
SkInterpolator fTrans;
|
|
|
|
Geometry fGeom;
|
|
|
|
bool fClipFirst;
|
2015-02-09 15:47:17 +00:00
|
|
|
int fSign;
|
Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow.
The following are currently unused in Android, Google3, Chromium, and Mozilla:
- SkEvent
- SkTime::GetMSecs
- SK_TIME_FACTOR (also unused in Skia)
- SkAutoTime
I left uses of SkMSec more-or-less intact for SkEvent, SkAnimator, and SkInterpolator. SkInterpolator is used in Chromium, so I did not want to change the API. The views/ and animator/ code is crufty, so it didn't seem worthwhile to refactor it. Instead, I added SkEvent::GetMSecsSinceStartup, which is likely to be adequate for use in SampleApp.
I also left SkMSec where it is used to measure a duration rather than a timestamp. With the exception of SkMovie, which is used in Android, all of the uses appear to measure the execution time of a piece of code, which I would hope does not exceed 2^31 milliseconds.
Added skiatest::Timer to support a common idiom in tests where we want to measure the wallclock time in integer milliseconds. (Not used in tests/PathOpsSkpClipTest.cpp because it redefines things in Test.h.)
Removed tabs in tests/StrokerTest.cpp.
BUG=skia:4632
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811613004
Review URL: https://codereview.chromium.org/1811613004
2016-03-25 19:59:53 +00:00
|
|
|
const double fStart = SkTime::GetMSecs();
|
2015-01-27 14:17:22 +00:00
|
|
|
|
2018-08-08 15:36:17 +00:00
|
|
|
typedef Sample INHERITED;
|
2015-01-27 14:17:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-08-08 15:36:17 +00:00
|
|
|
DEF_SAMPLE( return new ClipDrawMatchView(); )
|