replace uint ushort and uchar typedefs with uint32 uint16 and uint8 15/273515/1
authorSubhransu Mohanty <sub.mohanty@samsung.com>
Thu, 9 Dec 2021 03:05:26 +0000 (12:05 +0900)
committerjykeon <jykeon@samsung.com>
Thu, 7 Apr 2022 01:55:55 +0000 (10:55 +0900)
-- added format script to run clang format on latest commit.

Change-Id: I23f7fad4b75ef6c40e984766480876bf1bcb88a2
Signed-off-by: jykeon <jykeon@samsung.com>
22 files changed:
format [new file with mode: 0755]
src/lottie/lottiefiltermodel.h
src/lottie/lottieitem.cpp
src/lottie/lottieitem.h
src/lottie/lottieitem_capi.cpp
src/lottie/lottiekeypath.cpp
src/lottie/lottiekeypath.h
src/lottie/lottiemodel.h
src/vector/vbitmap.cpp
src/vector/vbitmap.h
src/vector/vbrush.cpp
src/vector/vbrush.h
src/vector/vdrawable.cpp
src/vector/vdrawhelper.cpp
src/vector/vdrawhelper.h
src/vector/vdrawhelper_common.cpp
src/vector/vglobal.h
src/vector/vpainter.cpp
src/vector/vpath.h
src/vector/vraster.cpp
src/vector/vrle.cpp
src/vector/vrle.h

diff --git a/format b/format
new file mode 100755 (executable)
index 0000000..c5630b4
--- /dev/null
+++ b/format
@@ -0,0 +1 @@
+git diff -U0 --no-color HEAD^ | clang-format-diff -i -p1
\ No newline at end of file
index b2b98b19005987934fdfed07289e114bf0726f67..4f78c11a3aafd9cf45ba0759174646ff3ed339c8 100644 (file)
@@ -238,7 +238,7 @@ class FilterData {
 public:
     void addValue(LOTVariant& value)
     {
-        uint index = static_cast<uint>(value.property());
+        uint32_t index = static_cast<uint32_t>(value.property());
         if (mBitset.test(index)) {
             std::replace_if(mFilters.begin(), mFilters.end(),
                             [&value](const LOTVariant& e) {
@@ -253,7 +253,7 @@ public:
 
     void removeValue(LOTVariant& value)
     {
-        uint index = static_cast<uint>(value.property());
+        uint32_t index = static_cast<uint32_t>(value.property());
         if (mBitset.test(index)) {
             mBitset.reset(index);
             mFilters.erase(std::remove_if(mFilters.begin(), mFilters.end(),
@@ -266,7 +266,7 @@ public:
     }
     bool hasFilter(rlottie::Property prop) const
     {
-        return mBitset.test(static_cast<uint>(prop));
+        return mBitset.test(static_cast<uint32_t>(prop));
     }
     model::Color color(rlottie::Property prop, int frame) const
     {
index 690e2c78fbc211cbc91623f3975b005cb4c70e5d..cb1bc2cdd629b02f9eb25ce1f01b082323b6331a 100644 (file)
@@ -149,9 +149,9 @@ bool renderer::Composition::update(int frameNo, const VSize &size,
 
 bool renderer::Composition::render(const rlottie::Surface &surface)
 {
-    mSurface.reset(reinterpret_cast<uchar *>(surface.buffer()),
-                   uint(surface.width()), uint(surface.height()),
-                   uint(surface.bytesPerLine()),
+    mSurface.reset(reinterpret_cast<uint8_t *>(surface.buffer()),
+                   uint32_t(surface.width()), uint32_t(surface.height()),
+                   uint32_t(surface.bytesPerLine()),
                    VBitmap::Format::ARGB32_Premultiplied);
 
     /* schedule all preprocess task for this frame at once.
@@ -200,7 +200,7 @@ VRle renderer::Mask::rle()
 {
     if (!vCompare(mCombinedAlpha, 1.0f)) {
         VRle obj = mRasterizer.rle();
-        obj *= uchar(mCombinedAlpha * 255);
+        obj *= uint8_t(mCombinedAlpha * 255);
         return obj;
     } else {
         return mRasterizer.rle();
@@ -343,7 +343,7 @@ renderer::Layer::Layer(model::Layer *layerData) : mLayerData(layerData)
         mLayerMask = std::make_unique<renderer::LayerMask>(mLayerData);
 }
 
-bool renderer::Layer::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::Layer::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                      LOTVariant &value)
 {
     if (!keyPath.matches(name(), depth)) {
@@ -359,12 +359,12 @@ bool renderer::Layer::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
     return true;
 }
 
-bool renderer::ShapeLayer::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::ShapeLayer::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                           LOTVariant &value)
 {
     if (renderer::Layer::resolveKeyPath(keyPath, depth, value)) {
         if (keyPath.propagate(name(), depth)) {
-            uint newDepth = keyPath.nextDepth(name(), depth);
+            uint32_t newDepth = keyPath.nextDepth(name(), depth);
             mRoot->resolveKeyPath(keyPath, newDepth, value);
         }
         return true;
@@ -372,12 +372,12 @@ bool renderer::ShapeLayer::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
     return false;
 }
 
-bool renderer::CompLayer::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::CompLayer::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                          LOTVariant &value)
 {
     if (renderer::Layer::resolveKeyPath(keyPath, depth, value)) {
         if (keyPath.propagate(name(), depth)) {
-            uint newDepth = keyPath.nextDepth(name(), depth);
+            uint32_t newDepth = keyPath.nextDepth(name(), depth);
             for (const auto &layer : mLayers) {
                 layer->resolveKeyPath(keyPath, newDepth, value);
             }
@@ -507,7 +507,7 @@ void renderer::CompLayer::render(VPainter *painter, const VRle &inheritMask,
             renderHelper(&srcPainter, inheritMask, matteRle, cache);
             srcPainter.end();
             painter->drawBitmap(VPoint(), srcBitmap,
-                                uchar(combinedAlpha() * 255.0f));
+                                uint8_t(combinedAlpha() * 255.0f));
             cache.release_surface(srcBitmap);
         } else {
             renderHelper(painter, inheritMask, matteRle, cache);
@@ -863,7 +863,7 @@ renderer::DrawableList renderer::ShapeLayer::renderList()
     return {mDrawableList.data(), mDrawableList.size()};
 }
 
-bool renderer::Group::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::Group::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                      LOTVariant &value)
 {
     if (!keyPath.skip(name())) {
@@ -880,7 +880,7 @@ bool renderer::Group::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
     }
 
     if (keyPath.propagate(name(), depth)) {
-        uint newDepth = keyPath.nextDepth(name(), depth);
+        uint32_t newDepth = keyPath.nextDepth(name(), depth);
         for (auto &child : mContents) {
             child->resolveKeyPath(keyPath, newDepth, value);
         }
@@ -888,7 +888,7 @@ bool renderer::Group::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
     return true;
 }
 
-bool renderer::Fill::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::Fill::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                     LOTVariant &value)
 {
     if (!keyPath.matches(mModel.name(), depth)) {
@@ -903,7 +903,7 @@ bool renderer::Fill::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
     return false;
 }
 
-bool renderer::Stroke::resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+bool renderer::Stroke::resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                       LOTVariant &value)
 {
     if (!keyPath.matches(mModel.name(), depth)) {
index 6f60254994b698f3630f68dd3b973385c274463b..001ce667ccd79526732c745e109b18e2d6da380d 100644 (file)
@@ -80,7 +80,7 @@ namespace renderer {
 
 using DrawableList = VSpan<VDrawable *>;
 
-enum class DirtyFlagBit : uchar {
+enum class DirtyFlagBit : uint8_t {
     None = 0x00,
     Matrix = 0x01,
     Alpha = 0x02,
@@ -239,8 +239,8 @@ public:
     std::vector<LOTMask> &       cmasks() { return mCApiData->mMasks; }
     std::vector<LOTNode *> &     cnodes() { return mCApiData->mCNodeList; }
     const char *                 name() const { return mLayerData->name(); }
-    virtual bool                 resolveKeyPath(LOTKeyPath &keyPath, uint depth,
-                                                LOTVariant &value);
+    virtual bool resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
+                                LOTVariant &value);
 
 protected:
     virtual void   preprocessStage(const VRect &clip) = 0;
@@ -275,7 +275,7 @@ public:
     void render(VPainter *painter, const VRle &mask, const VRle &matteRle,
                 SurfaceCache &cache) final;
     void buildLayerNode() final;
-    bool resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+    bool resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                         LOTVariant &value) override;
 
 protected:
@@ -317,7 +317,7 @@ public:
     explicit ShapeLayer(model::Layer *layerData, VArenaAlloc *allocator);
     DrawableList renderList() final;
     void         buildLayerNode() final;
-    bool         resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+    bool         resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                                 LOTVariant &value) override;
 
 protected:
@@ -355,13 +355,13 @@ private:
 
 class Object {
 public:
-    enum class Type : uchar { Unknown, Group, Shape, Paint, Trim };
+    enum class Type : uint8_t { Unknown, Group, Shape, Paint, Trim };
     virtual ~Object() = default;
     Object &     operator=(Object &&) noexcept = delete;
     virtual void update(int frameNo, const VMatrix &parentMatrix,
                         float parentAlpha, const DirtyFlag &flag) = 0;
     virtual void renderList(std::vector<VDrawable *> &) {}
-    virtual bool resolveKeyPath(LOTKeyPath &, uint, LOTVariant &)
+    virtual bool resolveKeyPath(LOTKeyPath &, uint32_t, LOTVariant &)
     {
         return false;
     }
@@ -387,7 +387,7 @@ public:
         static const char *TAG = "__";
         return mModel.hasModel() ? mModel.name() : TAG;
     }
-    bool resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+    bool resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                         LOTVariant &value) override;
 
 protected:
@@ -532,7 +532,7 @@ public:
 
 protected:
     bool updateContent(int frameNo, const VMatrix &matrix, float alpha) final;
-    bool resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+    bool resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                         LOTVariant &value) final;
 
 private:
@@ -557,7 +557,7 @@ public:
 
 protected:
     bool updateContent(int frameNo, const VMatrix &matrix, float alpha) final;
-    bool resolveKeyPath(LOTKeyPath &keyPath, uint depth,
+    bool resolveKeyPath(LOTKeyPath &keyPath, uint32_t depth,
                         LOTVariant &value) final;
 
 private:
index 6f6fb950663a29ba3385c750c77e0b8b6637f4e8..31ca54a68b64609ab52bb3a90421c1523ae4b502 100644 (file)
@@ -88,7 +88,7 @@ void renderer::Layer::buildLayerNode()
         mCApiData = std::make_unique<renderer::CApiData>();
         clayer().keypath = name();
     }
-    if (complexContent()) clayer().mAlpha = uchar(combinedAlpha() * 255.f);
+    if (complexContent()) clayer().mAlpha = uint8_t(combinedAlpha() * 255.f);
     clayer().mVisible = visible();
     // update matte
     if (hasMatte()) {
@@ -124,7 +124,7 @@ void renderer::Layer::buildLayerNode()
             cNode.mPath.ptCount = 2 * pts.size();
             cNode.mPath.elmPtr = elmPtr;
             cNode.mPath.elmCount = elm.size();
-            cNode.mAlpha = uchar(mask.mCombinedAlpha * 255.0f);
+            cNode.mAlpha = uint8_t(mask.mCombinedAlpha * 255.0f);
             switch (mask.maskMode()) {
             case model::Mask::Mode::Add:
                 cNode.mMode = MaskAdd;
@@ -196,7 +196,7 @@ void renderer::ImageLayer::buildLayerNode()
 
         // Alpha calculation already combined.
         lotDrawable->mCNode->mImageInfo.mAlpha =
-            uchar(lotDrawable->mBrush.mTexture->mAlpha);
+            uint8_t(lotDrawable->mBrush.mTexture->mAlpha);
 
         cnodes().push_back(lotDrawable->mCNode.get());
     }
@@ -216,7 +216,7 @@ static void updateGStops(LOTNode *n, const VGradient *grad)
     LOTGradientStop *ptr = n->mGradient.stopPtr;
     for (const auto &i : grad->mStops) {
         ptr->pos = i.first;
-        ptr->a = uchar(i.second.alpha() * grad->alpha());
+        ptr->a = uint8_t(i.second.alpha() * grad->alpha());
         ptr->r = i.second.red();
         ptr->g = i.second.green();
         ptr->b = i.second.blue();
index e8b6c6aefc334d93f3a7564a3c4508aa9a18e87f..21b01aac2f11aaf6c5d5bb864675b4749e497fa0 100644 (file)
@@ -12,7 +12,7 @@ LOTKeyPath::LOTKeyPath(const std::string &keyPath)
     }
 }
 
-bool LOTKeyPath::matches(const std::string &key, uint depth)
+bool LOTKeyPath::matches(const std::string &key, uint32_t depth)
 {
     if (skip(key)) {
         // This is an object we programatically create.
@@ -28,7 +28,7 @@ bool LOTKeyPath::matches(const std::string &key, uint depth)
     return false;
 }
 
-uint LOTKeyPath::nextDepth(const std::string key, uint depth)
+uint32_t LOTKeyPath::nextDepth(const std::string key, uint32_t depth)
 {
     if (skip(key)) {
         // If it's a container then we added programatically and it isn't a part
@@ -51,7 +51,7 @@ uint LOTKeyPath::nextDepth(const std::string key, uint depth)
     return depth;
 }
 
-bool LOTKeyPath::fullyResolvesTo(const std::string key, uint depth)
+bool LOTKeyPath::fullyResolvesTo(const std::string key, uint32_t depth)
 {
     if (depth > mKeys.size()) {
         return false;
index 0b59b161f1384b7f5228825f7590577677724979..2c53287ef62b8de3c674b9463cec6dc013363c27 100644 (file)
 class LOTKeyPath {
 public:
     LOTKeyPath(const std::string &keyPath);
-    bool matches(const std::string &key, uint depth);
-    uint nextDepth(const std::string key, uint depth);
-    bool fullyResolvesTo(const std::string key, uint depth);
+    bool     matches(const std::string &key, uint32_t depth);
+    uint32_t nextDepth(const std::string key, uint32_t depth);
+    bool     fullyResolvesTo(const std::string key, uint32_t depth);
 
-    bool propagate(const std::string key, uint depth)
+    bool propagate(const std::string key, uint32_t depth)
     {
         return skip(key) ? true : (depth < size()) || (mKeys[depth] == "**");
     }
     bool skip(const std::string &key) const { return key == "__"; }
 
 private:
-    bool   isGlobstar(uint depth) const { return mKeys[depth] == "**"; }
-    bool   isGlob(uint depth) const { return mKeys[depth] == "*"; }
+    bool   isGlobstar(uint32_t depth) const { return mKeys[depth] == "**"; }
+    bool   isGlob(uint32_t depth) const { return mKeys[depth] == "*"; }
     bool   endsWithGlobstar() const { return mKeys.back() == "**"; }
     size_t size() const { return mKeys.size() - 1; }
 
index cf87adb204df644a7ad1c92815a1a492f29960e0..3e0430853744d5be76d0f13e52afef5e30a18981 100644 (file)
@@ -57,9 +57,9 @@ inline T lerp(const T &start, const T &end, float t)
 
 namespace model {
 
-enum class MatteType : uchar { None = 0, Alpha = 1, AlphaInv, Luma, LumaInv };
+enum class MatteType : uint8_t { None = 0, Alpha = 1, AlphaInv, Luma, LumaInv };
 
-enum class BlendMode : uchar {
+enum class BlendMode : uint8_t {
     Normal = 0,
     Multiply = 1,
     Screen = 2,
@@ -72,8 +72,8 @@ public:
     Color(float red, float green, float blue) : r(red), g(green), b(blue) {}
     VColor toColor(float a = 1)
     {
-        return VColor(uchar(255 * r), uchar(255 * g), uchar(255 * b),
-                      uchar(255 * a));
+        return VColor(uint8_t(255 * r), uint8_t(255 * g), uint8_t(255 * b),
+                      uint8_t(255 * a));
     }
     friend inline Color operator+(const Color &c1, const Color &c2);
     friend inline Color operator-(const Color &c1, const Color &c2);
@@ -667,7 +667,7 @@ public:
 
 class Layer : public Group {
 public:
-    enum class Type : uchar {
+    enum class Type : uint8_t {
         Precomp = 0,
         Solid = 1,
         Image = 2,
index 22cb24346a37c74b77c09c82e855440eac011719..378db2278372207fde376270cfd670402fa56427 100644 (file)
@@ -31,31 +31,31 @@ V_BEGIN_NAMESPACE
 void VBitmap::Impl::reset(size_t width, size_t height, VBitmap::Format format)
 {
     mRoData = nullptr;
-    mWidth = uint(width);
-    mHeight = uint(height);
+    mWidth = uint32_t(width);
+    mHeight = uint32_t(height);
     mFormat = format;
 
     mDepth = depth(format);
     mStride = ((mWidth * mDepth + 31) >> 5)
                   << 2;  // bytes per scanline (must be multiple of 4)
-    mOwnData = std::make_unique<uchar[]>(mStride * mHeight);
+    mOwnData = std::make_unique<uint8_t[]>(mStride * mHeight);
 }
 
-void VBitmap::Impl::reset(uchar *data, size_t width, size_t height, size_t bytesPerLine,
-                          VBitmap::Format format)
+void VBitmap::Impl::reset(uint8_t *data, size_t width, size_t height,
+                          size_t bytesPerLine, VBitmap::Format format)
 {
     mRoData = data;
-    mWidth = uint(width);
-    mHeight = uint(height);
-    mStride = uint(bytesPerLine);
+    mWidth = uint32_t(width);
+    mHeight = uint32_t(height);
+    mStride = uint32_t(bytesPerLine);
     mFormat = format;
     mDepth = depth(format);
     mOwnData = nullptr;
 }
 
-uchar VBitmap::Impl::depth(VBitmap::Format format)
+uint8_t VBitmap::Impl::depth(VBitmap::Format format)
 {
-    uchar depth = 1;
+    uint8_t depth = 1;
     switch (format) {
     case VBitmap::Format::Alpha8:
         depth = 8;
@@ -70,7 +70,7 @@ uchar VBitmap::Impl::depth(VBitmap::Format format)
     return depth;
 }
 
-void VBitmap::Impl::fill(uint /*pixel*/)
+void VBitmap::Impl::fill(uint32_t /*pixel*/)
 {
     //@TODO
 }
@@ -79,9 +79,9 @@ void VBitmap::Impl::updateLuma()
 {
     if (mFormat != VBitmap::Format::ARGB32_Premultiplied) return;
     auto dataPtr = data();
-    for (uint col = 0; col < mHeight; col++) {
-        uint *pixel = (uint *)(dataPtr + mStride * col);
-        for (uint row = 0; row < mWidth; row++) {
+    for (uint32_t col = 0; col < mHeight; col++) {
+        uint32_t *pixel = (uint32_t *)(dataPtr + mStride * col);
+        for (uint32_t row = 0; row < mWidth; row++) {
             int alpha = vAlpha(*pixel);
             if (alpha == 0) {
                 pixel++;
@@ -112,8 +112,8 @@ VBitmap::VBitmap(size_t width, size_t height, VBitmap::Format format)
     mImpl = rc_ptr<Impl>(width, height, format);
 }
 
-VBitmap::VBitmap(uchar *data, size_t width, size_t height, size_t bytesPerLine,
-                 VBitmap::Format format)
+VBitmap::VBitmap(uint8_t *data, size_t width, size_t height,
+                 size_t bytesPerLine, VBitmap::Format format)
 {
     if (!data || width <= 0 || height <= 0 || bytesPerLine <= 0 ||
         format == Format::Invalid)
@@ -122,7 +122,7 @@ VBitmap::VBitmap(uchar *data, size_t width, size_t height, size_t bytesPerLine,
     mImpl = rc_ptr<Impl>(data, width, height, bytesPerLine, format);
 }
 
-void VBitmap::reset(uchar *data, size_t w, size_t h, size_t bytesPerLine,
+void VBitmap::reset(uint8_t *data, size_t w, size_t h, size_t bytesPerLine,
                     VBitmap::Format format)
 {
     if (mImpl) {
@@ -165,12 +165,12 @@ size_t VBitmap::depth() const
     return mImpl ? mImpl->mDepth : 0;
 }
 
-uchar *VBitmap::data()
+uint8_t *VBitmap::data()
 {
     return mImpl ? mImpl->data() : nullptr;
 }
 
-uchar *VBitmap::data() const
+uint8_t *VBitmap::data() const
 {
     return mImpl ? mImpl->data() : nullptr;
 }
@@ -195,7 +195,7 @@ VBitmap::Format VBitmap::format() const
     return mImpl ? mImpl->format() : VBitmap::Format::Invalid;
 }
 
-void VBitmap::fill(uint pixel)
+void VBitmap::fill(uint32_t pixel)
 {
     if (mImpl) mImpl->fill(pixel);
 }
index a068d7446ac7621244f2dc3c11ca04b01447b368..bc5059a7f3a5f2c079033635a71fad6496c2287d 100644 (file)
@@ -30,7 +30,7 @@ V_BEGIN_NAMESPACE
 
 class VBitmap {
 public:
-    enum class Format: uchar {
+    enum class Format : uint8_t {
         Invalid,
         Alpha8,
         ARGB32,
@@ -39,8 +39,10 @@ public:
 
     VBitmap() = default;
     VBitmap(size_t w, size_t h, VBitmap::Format format);
-    VBitmap(uchar *data, size_t w, size_t h, size_t bytesPerLine, VBitmap::Format format);
-    void reset(uchar *data, size_t w, size_t h, size_t stride, VBitmap::Format format);
+    VBitmap(uint8_t *data, size_t w, size_t h, size_t bytesPerLine,
+            VBitmap::Format format);
+    void reset(uint8_t *data, size_t w, size_t h, size_t stride,
+               VBitmap::Format format);
     void reset(size_t w, size_t h, VBitmap::Format format=Format::ARGB32_Premultiplied);
     size_t          stride() const;
     size_t          width() const;
@@ -48,27 +50,28 @@ public:
     size_t          depth() const;
     VBitmap::Format format() const;
     bool            valid() const;
-    uchar *         data();
-    uchar *         data() const;
+    uint8_t *       data();
+    uint8_t *       data() const;
     VRect           rect() const;
     VSize           size() const;
-    void    fill(uint pixel);
+    void            fill(uint32_t pixel);
     void    updateLuma();
 private:
     struct Impl {
-        std::unique_ptr<uchar[]> mOwnData{nullptr};
-        uchar *         mRoData{nullptr};
-        uint            mWidth{0};
-        uint            mHeight{0};
-        uint            mStride{0};
-        uchar           mDepth{0};
+        std::unique_ptr<uint8_t[]> mOwnData{nullptr};
+        uint8_t *                  mRoData{nullptr};
+        uint32_t                   mWidth{0};
+        uint32_t                   mHeight{0};
+        uint32_t                   mStride{0};
+        uint8_t                    mDepth{0};
         VBitmap::Format mFormat{VBitmap::Format::Invalid};
 
         explicit Impl(size_t width, size_t height, VBitmap::Format format)
         {
             reset(width, height, format);
         }
-        explicit Impl(uchar *data, size_t w, size_t h, size_t bytesPerLine, VBitmap::Format format)
+        explicit Impl(uint8_t *data, size_t w, size_t h, size_t bytesPerLine,
+                      VBitmap::Format format)
         {
             reset(data, w, h, bytesPerLine, format);
         }
@@ -77,12 +80,12 @@ private:
         size_t  stride() const { return mStride; }
         size_t  width() const { return mWidth; }
         size_t  height() const { return mHeight; }
-        uchar * data() { return mRoData ? mRoData : mOwnData.get(); }
+        uint8_t *       data() { return mRoData ? mRoData : mOwnData.get(); }
         VBitmap::Format format() const { return mFormat; }
-        void reset(uchar *, size_t, size_t, size_t, VBitmap::Format);
+        void reset(uint8_t *, size_t, size_t, size_t, VBitmap::Format);
         void reset(size_t, size_t, VBitmap::Format);
-        static uchar depth(VBitmap::Format format);
-        void fill(uint);
+        static uint8_t depth(VBitmap::Format format);
+        void fill(uint32_t);
         void updateLuma();
     };
 
index fc0902ba80bfcdc7b65ce4604af790d8199fbc49..f2ab3387c1317e9c37c52207d046d88bacd90acf 100644 (file)
@@ -43,7 +43,7 @@ VBrush::VBrush(const VColor &color) : mType(VBrush::Type::Solid), mColor(color)
 {
 }
 
-VBrush::VBrush(uchar r, uchar g, uchar b, uchar a)
+VBrush::VBrush(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
     : mType(VBrush::Type::Solid), mColor(r, g, b, a)
 
 {
index 74f8dcafe4b8a6442b45553083a31ba9cfcf29d1..a1abbd34e13c6a60931cf165198a036f0836c3d0 100644 (file)
@@ -75,7 +75,7 @@ public:
     VBrush():mType(Type::NoBrush),mColor(){};
     explicit VBrush(const VColor &color);
     explicit VBrush(const VGradient *gradient);
-    explicit VBrush(uchar r, uchar g, uchar b, uchar a);
+    explicit VBrush(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
     explicit VBrush(const VTexture *texture);
     inline VBrush::Type type() const { return mType; }
 public:
index c8ff02bc714664933fb821b8816e6aa7e09052c1..55b1bc84221990bebb5cab464a666f885ca45a2d 100644 (file)
@@ -106,7 +106,7 @@ void VDrawable::setDashInfo(std::vector<float> &dashInfo)
     bool hasChanged = false;
 
     if (obj->mDash.size() == dashInfo.size()) {
-        for (uint i = 0; i < dashInfo.size(); ++i) {
+        for (uint32_t i = 0; i < dashInfo.size(); ++i) {
             if (!vCompare(obj->mDash[i], dashInfo[i])) {
                 hasChanged = true;
                 break;
index b14146d31d541b60e4c6d9584bbbb0155861d183..6117a0a311afeff833b2b869e2bb2bef1af665a9 100644 (file)
@@ -56,7 +56,7 @@ public:
         VCacheKey             hash_val = 0;
         VCacheData            info;
         const VGradientStops &stops = gradient.mStops;
-        for (uint i = 0; i < stops.size() && i <= 2; i++)
+        for (uint32_t i = 0; i < stops.size() && i <= 2; i++)
             hash_val +=
                 VCacheKey(stops[i].second.premulARGB() * gradient.alpha());
 
@@ -100,11 +100,11 @@ public:
     }
 
 protected:
-    uint       maxCacheSize() const { return 60; }
+    uint32_t   maxCacheSize() const { return 60; }
     VCacheData addCacheElement(VCacheKey hash_val, const VGradient &gradient)
     {
         if (mCache.size() == maxCacheSize()) {
-            uint count = maxCacheSize() / 10;
+            uint32_t count = maxCacheSize() / 10;
             while (count--) {
                 mCache.erase(mCache.begin());
             }
@@ -519,7 +519,7 @@ static void blend_color(size_t size, const VRle::Span *array, void *userData)
 {
     VSpanData *data = (VSpanData *)(userData);
     Operator   op = getOperator(data);
-    const uint color = data->mSolid;
+    const uint32_t color = data->mSolid;
 
     for (size_t i = 0 ; i < size; ++i) {
         const auto &span = array[i];
@@ -528,12 +528,12 @@ static void blend_color(size_t size, const VRle::Span *array, void *userData)
 }
 
 // Signature of Process Object
-//  void Pocess(uint* scratchBuffer, size_t x, size_t y, uchar cov)
+//  void Pocess(uint* scratchBuffer, size_t x, size_t y, uint8_t cov)
 template <class Process>
 static inline void process_in_chunk(const VRle::Span *array, size_t size,
                                     Process process)
 {
-    std::array<uint, 2048> buf;
+    std::array<uint32_t, 2048> buf;
     for (size_t i = 0; i < size; i++) {
         const auto &span = array[i];
         size_t      len = span.len;
@@ -557,7 +557,7 @@ static void blend_gradient(size_t size, const VRle::Span *array,
 
     process_in_chunk(
         array, size,
-        [&](uint *scratch, size_t x, size_t y, size_t len, uchar cov) {
+        [&](uint32_t *scratch, size_t x, size_t y, size_t len, uint8_t cov) {
             op.srcFetch(scratch, &op, data, (int)y, (int)x, (int)len);
             op.func(data->buffer((int)x, (int)y), (int)len, scratch, cov);
         });
@@ -569,7 +569,7 @@ constexpr const T &clamp(const T &v, const T &lo, const T &hi)
     return v < lo ? lo : hi < v ? hi : v;
 }
 
-static constexpr inline uchar alpha_mul(uchar a, uchar b)
+static constexpr inline uint8_t alpha_mul(uint8_t a, uint8_t b)
 {
     return ((a * b) >> 8);
 }
@@ -590,7 +590,7 @@ static void blend_image_xform(size_t size, const VRle::Span *array,
 
     process_in_chunk(
         array, size,
-        [&](uint *scratch, size_t x, size_t y, size_t len, uchar cov) {
+        [&](uint32_t *scratch, size_t x, size_t y, size_t len, uint8_t cov) {
             const auto  coverage = (cov * src.alpha()) >> 8;
             const float xfactor = y * data->m21 + data->dx + data->m11;
             const float yfactor = y * data->m22 + data->dy + data->m12;
index e654e93bca1da34a9e1e7da4e0af7e194eae6c0c..7d31e3f3753d4802f0eef344515e8ca1f83424eb 100644 (file)
@@ -127,7 +127,7 @@ public:
 
     void resetBuffer(int val = 0);
 
-    inline uchar *scanLine(int y)
+    inline uint8_t *scanLine(int y)
     {
         assert(y >= 0);
         assert(size_t(y) < mHeight);
@@ -150,7 +150,7 @@ private:
     size_t          mHeight{0};
     size_t          mBytesPerLine{0};
     size_t          mBytesPerPixel{0};
-    mutable uchar * mBuffer{nullptr};
+    mutable uint8_t *mBuffer{nullptr};
 };
 
 struct VGradientData {
@@ -171,8 +171,8 @@ struct VGradientData {
 
 struct VTextureData : public VRasterBuffer {
     uint32_t pixel(int x, int y) const { return *pixelRef(x, y); };
-    uchar    alpha() const { return mAlpha; }
-    void     setAlpha(uchar alpha) { mAlpha = alpha; }
+    uint8_t  alpha() const { return mAlpha; }
+    void     setAlpha(uint8_t alpha) { mAlpha = alpha; }
     void     setClip(const VRect &clip);
     // clip rect
     int   left;
@@ -180,7 +180,7 @@ struct VTextureData : public VRasterBuffer {
     int   top;
     int   bottom;
     bool  hasAlpha;
-    uchar mAlpha;
+    uint8_t mAlpha;
 };
 
 struct VColorTable {
@@ -208,7 +208,7 @@ struct VSpanData {
         mDrawableSize = VSize(region.width(), region.height());
     }
 
-    uint *buffer(int x, int y) const
+    uint32_t *buffer(int x, int y) const
     {
         return mRasterBuffer->pixelRef(x + mOffset.x(), y + mOffset.y());
     }
@@ -256,9 +256,10 @@ inline constexpr int vAlpha(uint32_t c)
     return c >> 24;
 }
 
-static inline uint32_t interpolate_pixel(uint x, uint a, uint y, uint b)
+static inline uint32_t interpolate_pixel(uint32_t x, uint32_t a, uint32_t y,
+                                         uint32_t b)
 {
-    uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
+    uint32_t t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
     t >>= 8;
     t &= 0xff00ff;
     x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
index b2eb6db0117d257760beaaf5e259985226281516..8a91b0f33a3ef52b9f3494f274669a826672f8a0 100644 (file)
@@ -65,10 +65,10 @@ static void color_SourceOver(uint32_t *dest, int length, uint32_t color,
   dest = d * sa * ca + d * cia
        = d * (sa * ca + cia)
 */
-static void color_DestinationIn(uint *dest, int length, uint color,
-                                uint alpha)
+static void color_DestinationIn(uint32_t *dest, int length, uint32_t color,
+                                uint32_t alpha)
 {
-    uint a = vAlpha(color);
+    uint32_t a = vAlpha(color);
     if (alpha != 255) {
         a = BYTE_MUL(a, alpha) + 255 - alpha;
     }
@@ -82,10 +82,10 @@ static void color_DestinationIn(uint *dest, int length, uint color,
   dest = d * sia * ca + d * cia
        = d * (sia * ca + cia)
 */
-static void color_DestinationOut(uint *dest, int length, uint color,
-                                 uint alpha)
+static void color_DestinationOut(uint32_t *dest, int length, uint32_t color,
+                                 uint32_t alpha)
 {
-    uint a = vAlpha(~color);
+    uint32_t a = vAlpha(~color);
     if (alpha != 255) a = BYTE_MUL(a, alpha) + 255 - alpha;
     for (int i = 0; i < length; ++i) {
         dest[i] = BYTE_MUL(dest[i], a);
@@ -96,9 +96,9 @@ static void src_Source(uint32_t *dest, int length, const uint32_t *src,
                        uint32_t alpha)
 {
     if (alpha == 255) {
-        memcpy(dest, src, size_t(length) * sizeof(uint));
+        memcpy(dest, src, size_t(length) * sizeof(uint32_t));
     } else {
-        uint ialpha = 255 - alpha;
+        uint32_t ialpha = 255 - alpha;
         for (int i = 0; i < length; ++i) {
             dest[i] =
                 interpolate_pixel(src[i], alpha, dest[i], ialpha);
@@ -112,7 +112,7 @@ static void src_Source(uint32_t *dest, int length, const uint32_t *src,
 static void src_SourceOver(uint32_t *dest, int length, const uint32_t *src,
                            uint32_t alpha)
 {
-    uint s, sia;
+    uint32_t s, sia;
 
     if (alpha == 255) {
         for (int i = 0; i < length; ++i) {
@@ -136,33 +136,33 @@ static void src_SourceOver(uint32_t *dest, int length, const uint32_t *src,
     }
 }
 
-static void src_DestinationIn(uint *dest, int length, const uint *src,
-                              uint alpha)
+static void src_DestinationIn(uint32_t *dest, int length, const uint32_t *src,
+                              uint32_t alpha)
 {
     if (alpha == 255) {
         for (int i = 0; i < length; ++i) {
             dest[i] = BYTE_MUL(dest[i], vAlpha(src[i]));
         }
     } else {
-        uint cia = 255 - alpha;
+        uint32_t cia = 255 - alpha;
         for (int i = 0; i < length; ++i) {
-            uint a = BYTE_MUL(vAlpha(src[i]), alpha) + cia;
+            uint32_t a = BYTE_MUL(vAlpha(src[i]), alpha) + cia;
             dest[i] = BYTE_MUL(dest[i], a);
         }
     }
 }
 
-static void src_DestinationOut(uint *dest, int length, const uint *src,
-                               uint alpha)
+static void src_DestinationOut(uint32_t *dest, int length, const uint32_t *src,
+                               uint32_t alpha)
 {
     if (alpha == 255) {
         for (int i = 0; i < length; ++i) {
             dest[i] = BYTE_MUL(dest[i], vAlpha(~src[i]));
         }
     } else {
-        uint cia = 255 - alpha;
+        uint32_t cia = 255 - alpha;
         for (int i = 0; i < length; ++i) {
-            uint sia = BYTE_MUL(vAlpha(~src[i]), alpha) + cia;
+            uint32_t sia = BYTE_MUL(vAlpha(~src[i]), alpha) + cia;
             dest[i] = BYTE_MUL(dest[i], sia);
         }
     }
index 45e95e335281d97517afa4fc2ccb3eb651f9cded..8537b66a611b7540cf5e531492e65d9b7de28744 100644 (file)
@@ -29,9 +29,6 @@
 #include <type_traits>
 #include <utility>
 
-using uint   = uint32_t;
-using ushort = uint16_t;
-using uchar  = uint8_t;
 
 #if !defined(V_NAMESPACE)
 
@@ -122,10 +119,13 @@ public:
     explicit constexpr inline vFlagHelper(int ai) noexcept : i(ai) {}
     constexpr inline operator int() const noexcept { return i; }
 
-    explicit constexpr inline vFlagHelper(uint ai) noexcept : i(int(ai)) {}
+    explicit constexpr inline vFlagHelper(uint32_t ai) noexcept : i(int(ai)) {}
     explicit constexpr inline vFlagHelper(short ai) noexcept : i(int(ai)) {}
-    explicit constexpr inline vFlagHelper(ushort ai) noexcept : i(int(uint(ai))) {}
-    constexpr inline operator uint() const noexcept { return uint(i); }
+    explicit constexpr inline vFlagHelper(uint16_t ai) noexcept
+        : i(int(uint32_t(ai)))
+    {
+    }
+    constexpr inline operator uint32_t() const noexcept { return uint32_t(i); }
 };
 
 template <typename Enum>
@@ -153,7 +153,7 @@ public:
         i &= mask;
         return *this;
     }
-    inline vFlag &operator&=(uint mask) noexcept
+    inline vFlag &operator&=(uint32_t mask) noexcept
     {
         i &= mask;
         return *this;
@@ -206,7 +206,7 @@ public:
     {
         return vFlag(vFlagHelper(i & mask));
     }
-    constexpr inline vFlag operator&(uint mask) const noexcept
+    constexpr inline vFlag operator&(uint32_t mask) const noexcept
     {
         return vFlag(vFlagHelper(i & mask));
     }
@@ -236,44 +236,47 @@ public:
 class VColor {
 public:
     VColor() = default;
-    explicit VColor(uchar red, uchar green, uchar blue, uchar alpha = 255) noexcept
-        :a(alpha), r(red), g(green), b(blue){}
-    inline uchar  red() const noexcept { return r; }
-    inline uchar  green() const noexcept { return g; }
-    inline uchar  blue() const noexcept { return b; }
-    inline uchar  alpha() const noexcept { return a; }
-    inline void setRed(uchar red) noexcept { r = red; }
-    inline void setGreen(uchar green) noexcept { g = green; }
-    inline void setBlue(uchar blue) noexcept { b = blue; }
-    inline void setAlpha(uchar alpha) noexcept { a = alpha; }
+    explicit VColor(uint8_t red, uint8_t green, uint8_t blue,
+                    uint8_t alpha = 255) noexcept
+        : a(alpha), r(red), g(green), b(blue)
+    {
+    }
+    inline uint8_t red() const noexcept { return r; }
+    inline uint8_t green() const noexcept { return g; }
+    inline uint8_t blue() const noexcept { return b; }
+    inline uint8_t alpha() const noexcept { return a; }
+    inline void    setRed(uint8_t red) noexcept { r = red; }
+    inline void    setGreen(uint8_t green) noexcept { g = green; }
+    inline void    setBlue(uint8_t blue) noexcept { b = blue; }
+    inline void    setAlpha(uint8_t alpha) noexcept { a = alpha; }
     inline bool isOpaque() const { return a == 255; }
     inline bool isTransparent() const { return a == 0; }
     inline bool operator==(const VColor &o) const
     {
         return ((a == o.a) && (r == o.r) && (g == o.g) && (b == o.b));
     }
-    uint premulARGB() const
+    uint32_t premulARGB() const
     {
         int pr = (r * a) / 255;
         int pg = (g * a) / 255;
         int pb = (b * a) / 255;
-        return uint((a << 24) | (pr << 16) | (pg << 8) | (pb));
+        return uint32_t((a << 24) | (pr << 16) | (pg << 8) | (pb));
     }
 
-    uint premulARGB(float opacity) const
+    uint32_t premulARGB(float opacity) const
     {
         int alpha = int(a * opacity);
         int pr = (r * alpha) / 255;
         int pg = (g * alpha) / 255;
         int pb = (b * alpha) / 255;
-        return uint((alpha << 24) | (pr << 16) | (pg << 8) | (pb));
+        return uint32_t((alpha << 24) | (pr << 16) | (pg << 8) | (pb));
     }
 
 public:
-    uchar a{0};
-    uchar r{0};
-    uchar g{0};
-    uchar b{0};
+    uint8_t a{0};
+    uint8_t r{0};
+    uint8_t g{0};
+    uint8_t b{0};
 };
 
 enum class FillRule: unsigned char { EvenOdd, Winding };
index 38a58e047f44ecb9a9f863be6498e67495b34f61..ab5492c7fbd9701a4f9d719273b21e4aee6e198e 100644 (file)
@@ -66,7 +66,7 @@ static void fillRect(const VRect &r, VSpanData *data)
         int i = 0;
         while (i < n) {
             spans[i].x = short(x1);
-            spans[i].len = ushort(x2 - x1);
+            spans[i].len = uint16_t(x2 - x1);
             spans[i].y = short(y + i);
             spans[i].coverage = 255;
             ++i;
index 90c2c3e53fc78bc452b45704e11b9fdf6e5683ba..9273cb61b3ea97a237a1806f27f4d12051030269 100644 (file)
@@ -35,7 +35,7 @@ class VPath {
 public:
     enum class Direction { CCW, CW };
 
-    enum class Element : uchar { MoveTo, LineTo, CubicTo, Close };
+    enum class Element : uint8_t { MoveTo, LineTo, CubicTo, Close };
     bool  empty() const;
     bool  null() const;
     void  moveTo(const VPointF &p);
index 062431532ba367493607581d60cdd96d218ee0d5..d64c0a6ac685a2132acefc9002f36374ec64d438 100644 (file)
@@ -380,7 +380,7 @@ struct VRleTask {
             outRef.convert(mPath);
             outRef.convert(mCap, mJoin, mStrokeWidth, mMiterLimit);
 
-            uint points, contors;
+            uint32_t points, contors;
 
             SW_FT_Stroker_Set(stroker, outRef.ftWidth, outRef.ftCap,
                               outRef.ftJoin, outRef.ftMiterLimit);
index 051560dad6fdcb0fdeeac3c52444764ba429a33e..753db1a11d1a680202d075128ab7e6ca97f19de6 100644 (file)
@@ -41,7 +41,7 @@ static size_t _opGeneric(rle_view &a, rle_view &b, Result &result,
 static size_t _opIntersect(const VRect &, rle_view &, Result &);
 static size_t _opIntersect(rle_view &, rle_view &, Result &);
 
-static inline uchar divBy255(int x)
+static inline uint8_t divBy255(int x)
 {
     return (x + (x >> 8) + 0x80) >> 8;
 }
@@ -142,7 +142,7 @@ void VRle::Data::updateBbox() const
     }
 }
 
-void VRle::Data::operator*=(uchar alpha)
+void VRle::Data::operator*=(uint8_t alpha)
 {
     for (auto &i : mSpans) {
         i.coverage = divBy255(i.coverage * alpha);
@@ -425,7 +425,7 @@ static size_t _opIntersect(const VRect &clip, rle_view &obj, Result &result)
             out->x = minx;
         } else {
             out->x = span.x;
-            out->len = std::min(span.len, ushort(maxx - span.x + 1));
+            out->len = std::min(span.len, uint16_t(maxx - span.x + 1));
         }
         if (out->len != 0) {
             out->y = span.y;
@@ -442,12 +442,12 @@ static size_t _opIntersect(const VRect &clip, rle_view &obj, Result &result)
     return result.max_size() - available;
 }
 
-static void blitXor(VRle::Span *spans, int count, uchar *buffer, int offsetX)
+static void blitXor(VRle::Span *spans, int count, uint8_t *buffer, int offsetX)
 {
     while (count--) {
         int    x = spans->x + offsetX;
         int    l = spans->len;
-        uchar *ptr = buffer + x;
+        uint8_t *ptr = buffer + x;
         while (l--) {
             int da = *ptr;
             *ptr = divBy255((255 - spans->coverage) * (da) +
@@ -458,13 +458,13 @@ static void blitXor(VRle::Span *spans, int count, uchar *buffer, int offsetX)
     }
 }
 
-static void blitDestinationOut(VRle::Span *spans, int count, uchar *buffer,
+static void blitDestinationOut(VRle::Span *spans, int count, uint8_t *buffer,
                                int offsetX)
 {
     while (count--) {
         int    x = spans->x + offsetX;
         int    l = spans->len;
-        uchar *ptr = buffer + x;
+        uint8_t *ptr = buffer + x;
         while (l--) {
             *ptr = divBy255((255 - spans->coverage) * (*ptr));
             ptr++;
@@ -473,13 +473,13 @@ static void blitDestinationOut(VRle::Span *spans, int count, uchar *buffer,
     }
 }
 
-static void blitSrcOver(VRle::Span *spans, int count, uchar *buffer,
+static void blitSrcOver(VRle::Span *spans, int count, uint8_t *buffer,
                         int offsetX)
 {
     while (count--) {
         int    x = spans->x + offsetX;
         int    l = spans->len;
-        uchar *ptr = buffer + x;
+        uint8_t *ptr = buffer + x;
         while (l--) {
             *ptr = spans->coverage + divBy255((255 - spans->coverage) * (*ptr));
             ptr++;
@@ -488,12 +488,12 @@ static void blitSrcOver(VRle::Span *spans, int count, uchar *buffer,
     }
 }
 
-void blitSrc(VRle::Span *spans, int count, uchar *buffer, int offsetX)
+void blitSrc(VRle::Span *spans, int count, uint8_t *buffer, int offsetX)
 {
     while (count--) {
         int    x = spans->x + offsetX;
         int    l = spans->len;
-        uchar *ptr = buffer + x;
+        uint8_t *ptr = buffer + x;
         while (l--) {
             *ptr = std::max(spans->coverage, *ptr);
             ptr++;
@@ -502,15 +502,16 @@ void blitSrc(VRle::Span *spans, int count, uchar *buffer, int offsetX)
     }
 }
 
-size_t bufferToRle(uchar *buffer, int size, int offsetX, int y, VRle::Span *out)
+size_t bufferToRle(uint8_t *buffer, int size, int offsetX, int y,
+                   VRle::Span *out)
 {
     size_t count = 0;
-    uchar  value = buffer[0];
+    uint8_t value = buffer[0];
     int    curIndex = 0;
 
     // size = offsetX < 0 ? size + offsetX : size;
     for (int i = 0; i < size; i++) {
-        uchar curValue = buffer[0];
+        uint8_t curValue = buffer[0];
         if (value != curValue) {
             if (value) {
                 out->y = y;
@@ -550,10 +551,10 @@ struct SpanMerger {
             break;
         }
     }
-    using blitter = void (*)(VRle::Span *, int, uchar *, int);
+    using blitter = void (*)(VRle::Span *, int, uint8_t *, int);
     blitter                     _blitter;
     std::array<VRle::Span, 256> _result;
-    std::array<uchar, 1024>     _buffer;
+    std::array<uint8_t, 1024>   _buffer;
     VRle::Span *                _aStart{nullptr};
     VRle::Span *                _bStart{nullptr};
 
index 761e5d1bf3cd71f53a877140204067a2cdbf8b94..1bbb8365b0817cf648ddaee9bc58dfb667f37bd8 100644 (file)
@@ -36,8 +36,8 @@ public:
     struct Span {
         short  x{0};
         short  y{0};
-        ushort len{0};
-        uchar  coverage{0};
+        uint16_t len{0};
+        uint8_t  coverage{0};
     };
     using VRleSpanCb = void (*)(size_t count, const VRle::Span *spans,
                                 void *userData);
@@ -52,7 +52,7 @@ public:
     void reset() { d.write().reset(); }
     void translate(const VPoint &p) { d.write().translate(p); }
 
-    void operator*=(uchar alpha) { d.write() *= alpha; }
+    void operator*=(uint8_t alpha) { d.write() *= alpha; }
 
     void intersect(const VRect &r, VRleSpanCb cb, void *userData) const;
     void intersect(const VRle &rle, VRleSpanCb cb, void *userData) const;
@@ -91,7 +91,7 @@ public:
         void  setBbox(const VRect &bbox) const;
         void  reset();
         void  translate(const VPoint &p);
-        void  operator*=(uchar alpha);
+        void  operator*=(uint8_t alpha);
         void  opGeneric(const VRle::Data &, const VRle::Data &, Op code);
         void  opSubstract(const VRle::Data &, const VRle::Data &);
         void  opIntersect(VRle::View a, VRle::View b);