Remove references to SkMSec type
Skia wants to remove this from the public API:
https://skia-review.googlesource.com/c/skia/+/897150
Change-Id: Idef3d1d79014a10cfd1f1e2ad740666bebe6d3cf
Flag: EXEMPT refactor
diff --git a/libs/hwui/jni/GIFMovie.cpp b/libs/hwui/jni/GIFMovie.cpp
index ae6ac4c..6c82aa1 100644
--- a/libs/hwui/jni/GIFMovie.cpp
+++ b/libs/hwui/jni/GIFMovie.cpp
@@ -30,7 +30,7 @@
protected:
virtual bool onGetInfo(Info*);
- virtual bool onSetTime(SkMSec);
+ virtual bool onSetTime(Movie::MSec);
virtual bool onGetBitmap(SkBitmap*);
private:
@@ -72,7 +72,7 @@
DGifCloseFile(fGIF, nullptr);
}
-static SkMSec savedimage_duration(const SavedImage* image)
+static Movie::MSec savedimage_duration(const SavedImage* image)
{
for (int j = 0; j < image->ExtensionBlockCount; j++)
{
@@ -91,7 +91,7 @@
if (nullptr == fGIF)
return false;
- SkMSec dur = 0;
+ Movie::MSec dur = 0;
for (int i = 0; i < fGIF->ImageCount; i++)
dur += savedimage_duration(&fGIF->SavedImages[i]);
@@ -102,12 +102,12 @@
return true;
}
-bool GIFMovie::onSetTime(SkMSec time)
+bool GIFMovie::onSetTime(Movie::MSec time)
{
if (nullptr == fGIF)
return false;
- SkMSec dur = 0;
+ Movie::MSec dur = 0;
for (int i = 0; i < fGIF->ImageCount; i++)
{
dur += savedimage_duration(&fGIF->SavedImages[i]);
diff --git a/libs/hwui/jni/Movie.h b/libs/hwui/jni/Movie.h
index 02113dd..d633d93 100644
--- a/libs/hwui/jni/Movie.h
+++ b/libs/hwui/jni/Movie.h
@@ -19,6 +19,8 @@
class Movie : public SkRefCnt {
public:
+ using MSec = uint32_t; // millisecond duration
+
/** Try to create a movie from the stream. If the stream format is not
supported, return NULL.
*/
@@ -36,7 +38,7 @@
*/
static Movie* DecodeMemory(const void* data, size_t length);
- SkMSec duration();
+ MSec duration();
int width();
int height();
int isOpaque();
@@ -46,21 +48,21 @@
bitmap/frame from the previous state (i.e. true means you need to
redraw).
*/
- bool setTime(SkMSec);
+ bool setTime(MSec);
// return the right bitmap for the current time code
const SkBitmap& bitmap();
protected:
struct Info {
- SkMSec fDuration;
+ MSec fDuration;
int fWidth;
int fHeight;
bool fIsOpaque;
};
virtual bool onGetInfo(Info*) = 0;
- virtual bool onSetTime(SkMSec) = 0;
+ virtual bool onSetTime(MSec) = 0;
virtual bool onGetBitmap(SkBitmap*) = 0;
// visible for subclasses
@@ -68,7 +70,7 @@
private:
Info fInfo;
- SkMSec fCurrTime;
+ MSec fCurrTime;
SkBitmap fBitmap;
bool fNeedBitmap;
diff --git a/libs/hwui/jni/MovieImpl.cpp b/libs/hwui/jni/MovieImpl.cpp
index abb75fa..a31a15f 100644
--- a/libs/hwui/jni/MovieImpl.cpp
+++ b/libs/hwui/jni/MovieImpl.cpp
@@ -11,7 +11,7 @@
// We should never see this in normal operation since our time values are
// 0-based. So we use it as a sentinel.
-#define UNINITIALIZED_MSEC ((SkMSec)-1)
+#define UNINITIALIZED_MSEC ((Movie::MSec)-1)
Movie::Movie()
{
@@ -26,7 +26,7 @@
memset(&fInfo, 0, sizeof(fInfo)); // failure
}
-SkMSec Movie::duration()
+Movie::MSec Movie::duration()
{
this->ensureInfo();
return fInfo.fDuration;
@@ -50,9 +50,9 @@
return fInfo.fIsOpaque;
}
-bool Movie::setTime(SkMSec time)
+bool Movie::setTime(Movie::MSec time)
{
- SkMSec dur = this->duration();
+ Movie::MSec dur = this->duration();
if (time > dur)
time = dur;