--compile warning
authorHermet Park <hermetpark@gmail.com>
Fri, 12 Jul 2019 04:59:01 +0000 (13:59 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 18 Jul 2019 11:04:28 +0000 (20:04 +0900)
more get rid of data type converting warnings on windows.

inc/rlottiecommon.h
src/lottie/lottieanimation.cpp
src/lottie/lottieitem.cpp
src/lottie/lottiemodel.cpp
src/lottie/lottiemodel.h
src/vector/vimageloader.cpp
src/vector/vimageloader.h

index 805f1a3..bd905d5 100644 (file)
@@ -175,8 +175,8 @@ typedef struct LOTNode {
 
     struct {
         unsigned char *data;
-        int width;
-        int height;
+        size_t width;
+        size_t height;
         struct {
            float m11; float m12; float m13;
            float m21; float m22; float m23;
index 18f07c1..4007ef7 100644 (file)
@@ -86,7 +86,7 @@ bool AnimationImpl::update(size_t frameNo, const VSize &size)
     if (frameNo < mModel->startFrame()) frameNo = mModel->startFrame();
 
     mCompItem->resize(size);
-    return mCompItem->update(frameNo);
+    return mCompItem->update(int(frameNo));
 }
 
 Surface AnimationImpl::render(size_t frameNo, const Surface &surface)
@@ -99,7 +99,7 @@ Surface AnimationImpl::render(size_t frameNo, const Surface &surface)
 
     mRenderInProgress.store(true);
     update(frameNo,
-           VSize(surface.drawRegionWidth(), surface.drawRegionHeight()));
+           VSize(int(surface.drawRegionWidth()), int(surface.drawRegionHeight())));
     mCompItem->render(surface);
     mRenderInProgress.store(false);
 
@@ -297,7 +297,7 @@ size_t Animation::frameAtPos(double pos)
 const LOTLayerNode *Animation::renderTree(size_t frameNo, size_t width,
                                           size_t height) const
 {
-    return d->renderTree(frameNo, VSize(width, height));
+    return d->renderTree(frameNo, VSize(int(width), int(height)));
 }
 
 std::future<Surface> Animation::render(size_t frameNo, Surface surface)
index 367f25f..a522566 100644 (file)
@@ -156,15 +156,15 @@ const LOTLayerNode *LOTCompItem::renderTree() const
 
 bool LOTCompItem::render(const rlottie::Surface &surface)
 {
-    VBitmap bitmap(reinterpret_cast<uchar *>(surface.buffer()), surface.width(),
-                   surface.height(), surface.bytesPerLine(),
+    VBitmap bitmap(reinterpret_cast<uchar *>(surface.buffer()),
+                   uint(surface.width()), uint(surface.height()), uint(surface.bytesPerLine()),
                    VBitmap::Format::ARGB32_Premultiplied);
 
     /* schedule all preprocess task for this frame at once.
      */
     mDrawableList.clear();
     mRootLayer->renderList(mDrawableList);
-    VRect clip(0, 0, surface.drawRegionWidth(), surface.drawRegionHeight());
+    VRect clip(0, 0, int(surface.drawRegionWidth()), int(surface.drawRegionHeight()));
     for (auto &e : mDrawableList) {
         e->preprocess(clip);
     }
@@ -172,8 +172,8 @@ bool LOTCompItem::render(const rlottie::Surface &surface)
     VPainter painter(&bitmap);
     // set sub surface area for drawing.
     painter.setDrawRegion(
-        VRect(surface.drawRegionPosX(), surface.drawRegionPosY(),
-              surface.drawRegionWidth(), surface.drawRegionHeight()));
+        VRect(int(surface.drawRegionPosX()), int(surface.drawRegionPosY()),
+              int(surface.drawRegionWidth()), int(surface.drawRegionHeight())));
     mRootLayer->render(&painter, {}, {});
 
     return true;
index 4156c9f..759f396 100644 (file)
@@ -198,13 +198,13 @@ int LOTGStrokeData::getDashInfo(int frameNo, float *array) const
 void LOTGradient::populate(VGradientStops &stops, int frameNo)
 {
     LottieGradient gradData = mGradient.value(frameNo);
-    int            size = gradData.mGradient.size();
+    int            size = int(gradData.mGradient.size());
     float *        ptr = gradData.mGradient.data();
     int            colorPoints = mColorPoints;
     if (colorPoints == -1) {  // for legacy bodymovin (ref: lottie-android)
         colorPoints = size / 4;
     }
-    int    opacityArraySize = size - colorPoints * 4;
+    int opacityArraySize = size - colorPoints * 4;
     float *opacityPtr = ptr + (colorPoints * 4);
     stops.clear();
     int j = 0;
index fa7d2b1..2cc7e83 100644 (file)
@@ -575,7 +575,7 @@ public:
         return size_t(pos * frameDuration());
     }
     long frameAtTime(double timeInSec) const {
-        return frameAtPos(timeInSec / duration());
+        return long(frameAtPos(timeInSec / duration()));
     }
     size_t totalFrame() const {return mEndFrame - mStartFrame;}
     long frameDuration() const {return mEndFrame - mStartFrame -1;}
index 77ce58a..a75ca86 100644 (file)
@@ -158,13 +158,13 @@ struct VImageLoader::Impl {
         return createBitmap(data, width, height, n);
     }
 
-    VBitmap load(const char *imageData, int len)
+    VBitmap load(const char *imageData, size_t len)
     {
         if (!imageFromData) return VBitmap();
 
         int            width, height, n;
         unsigned char *data =
-            imageFromData(imageData, len, &width, &height, &n, 4);
+            imageFromData(imageData, static_cast<int>(len), &width, &height, &n, 4);
 
         if (!data) {
             return VBitmap();
@@ -222,7 +222,7 @@ VBitmap VImageLoader::load(const char *fileName)
     return mImpl->load(fileName);
 }
 
-VBitmap VImageLoader::load(const char *data, int len)
+VBitmap VImageLoader::load(const char *data, size_t len)
 {
     return mImpl->load(data, len);
 }
index 2ca4cec..4d96a7d 100644 (file)
@@ -15,7 +15,7 @@ public:
     }
 
     VBitmap load(const char *fileName);
-    VBitmap load(const char *data, int len);
+    VBitmap load(const char *data, size_t len);
     ~VImageLoader();
 private:
     VImageLoader();