swiftfn / Cpp4Susans

Tool to automatically create bindings around C++ for other languages, based on Clang/LLVM
1 stars 0 forks source link

C: Consider using opaque pointer (class) for special C++ structs #1

Open ngocdaothanh opened 5 years ago

ngocdaothanh commented 5 years ago

https://github.com/google/skia/blob/master/include/core/SkCanvas.h

ImageSetEntry has destructor:

struct SK_API ImageSetEntry {
    ImageSetEntry(sk_sp<const SkImage> image, const SkRect& srcRect, const SkRect& dstRect,
                  int matrixIndex, float alpha, unsigned aaFlags, bool hasClip);

    ImageSetEntry(sk_sp<const SkImage> image, const SkRect& srcRect, const SkRect& dstRect,
                  float alpha, unsigned aaFlags);

    ImageSetEntry();
    ~ImageSetEntry();
    ImageSetEntry(const ImageSetEntry&);
    ImageSetEntry& operator=(const ImageSetEntry&);

    sk_sp<const SkImage> fImage;
    SkRect fSrcRect;
    SkRect fDstRect;
    int fMatrixIndex = -1; // Index into the preViewMatrices arg, or < 0
    float fAlpha = 1.f;
    unsigned fAAFlags = kNone_QuadAAFlags; // QuadAAFlags
    bool fHasClip = false; // True to use next 4 points in dstClip arg as quad
};

Let Swift know, if a struct is used as a class.