Clean up RS C++ API visibility and fix some inconsistencies. Bug: 10427951 - Constructors should mostly be protected, since we use Builders and create() methods for most RS objects. - Type::setY() should only accept unsigned input. Change-Id: Id96138a6a8820348b2c26fc0772383326d321d50
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h index dca2bb1..1d0f9de 100644 --- a/cpp/rsCppStructs.h +++ b/cpp/rsCppStructs.h
@@ -397,15 +397,6 @@ static sp<const Element> createPixel(sp<RS> rs, RsDataType dt, RsDataKind dk); bool isCompatible(sp<const Element>e) const; - Element(void *id, sp<RS> rs, - std::vector<sp<Element> > &elements, - std::vector<std::string> &elementNames, - std::vector<uint32_t> &arraySizes); - Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size); - Element(sp<RS> rs); - virtual ~Element(); - - protected: class Builder { private: sp<RS> mRS; @@ -421,6 +412,15 @@ sp<const Element> create(); }; +protected: + Element(void *id, sp<RS> rs, + std::vector<sp<Element> > &elements, + std::vector<std::string> &elementNames, + std::vector<uint32_t> &arraySizes); + Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size); + Element(sp<RS> rs); + virtual ~Element(); + private: void updateVisibleSubElements(); @@ -544,6 +544,8 @@ size_t mElementCount; sp<const Element> mElement; + Type(void *id, sp<RS> rs); + void calcElementCount(); virtual void updateFromNative(); @@ -581,8 +583,6 @@ return mElementCount * mElement->getSizeBytes(); } - Type(void *id, sp<RS> rs); - static sp<const Type> create(sp<RS> rs, sp<const Element> e, uint32_t dimX, uint32_t dimY, uint32_t dimZ); class Builder { @@ -599,7 +599,7 @@ Builder(sp<RS> rs, sp<const Element> e); void setX(uint32_t value); - void setY(int value); + void setY(uint32_t value); void setMipmaps(bool value); void setFaces(bool value); sp<const Type> create();