keep api parameter naming consistency.
ptsCnt, cmdCnt, triangleCnt ...
Change-Id: Ie2b6c7e7781877700dd446a838c254ef73d02413
* If a mesh is provided, the transform property of the Picture will apply to the triangle mesh, and the
* image data will be used as the texture.
*
- * If triangles is null, or triangleCount is 0, the mesh will be removed.
+ * If @p triangles is @c nullptr, or @p triangleCnt is 0, the mesh will be removed.
*
* Only raster image types are supported at this time (png, jpg). Vector types like svg and tvg do not support.
* mesh deformation. However, if required you should be able to render a vector image to a raster image and then apply a mesh.
*
- * @param[in] triangles An array of Polygon objects (triangles) that make up the mesh, or null to remove the mesh.
- * @param[in] triangleCount The number of Polygon objects (triangles) provided, or 0 to remove the mesh.
+ * @param[in] triangles An array of Polygons(triangles) that make up the mesh, or null to remove the mesh.
+ * @param[in] triangleCnt The number of Polygons(triangles) provided, or 0 to remove the mesh.
*
* @retval Result::Success When succeed.
* @retval Result::Unknown If fails
*
* @BETA_API
*/
- Result mesh(const Polygon* triangles, const uint32_t triangleCount) noexcept;
+ Result mesh(const Polygon* triangles, const uint32_t triangleCnt) noexcept;
/**
* @brief Return the number of triangles in the mesh, and optionally get a pointer to the array of triangles in the mesh.
{
SwImage image;
Polygon* triangles;
- uint32_t triangleCount;
+ uint32_t triangleCnt;
void run(unsigned tid) override
{
imageReset(&image);
if (!image.data || image.w == 0 || image.h == 0) goto end;
- if (!imagePrepare(&image, triangles, triangleCount, transform, clipRegion, bbox, mpool, tid)) goto end;
+ if (!imagePrepare(&image, triangles, triangleCnt, transform, clipRegion, bbox, mpool, tid)) goto end;
// TODO: How do we clip the triangle mesh? Only clip non-meshed images for now
- if (triangleCount == 0 && clips.count > 0) {
+ if (triangleCnt == 0 && clips.count > 0) {
if (!imageGenRle(&image, bbox, false)) goto end;
if (image.rle) {
for (auto clip = clips.data; clip < (clips.data + clips.count); ++clip) {
if (task->opacity == 0) return true;
- return rasterImageMesh(surface, &task->image, task->triangles, task->triangleCount, task->transform, task->bbox, task->opacity);
+ return rasterImageMesh(surface, &task->image, task->triangles, task->triangleCnt, task->transform, task->bbox, task->opacity);
}
}
-RenderData SwRenderer::prepare(Surface* image, Polygon* triangles, uint32_t triangleCount, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags)
+RenderData SwRenderer::prepare(Surface* image, Polygon* triangles, uint32_t triangleCnt, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags)
{
//prepare task
auto task = static_cast<SwImageTask*>(data);
task->image.h = image->h;
task->image.stride = image->stride;
task->triangles = triangles;
- task->triangleCount = triangleCount;
+ task->triangleCnt = triangleCnt;
}
return prepareCommon(task, transform, opacity, clips, flags);
}
}
-Result Picture::mesh(const Polygon* triangles, const uint32_t triangleCount) noexcept
+Result Picture::mesh(const Polygon* triangles, const uint32_t triangleCnt) noexcept
{
- if (pImpl->mesh(triangles, triangleCount)) return Result::Success;
+ if (pImpl->mesh(triangles, triangleCnt)) return Result::Success;
return Result::Unknown;
}
uint32_t Picture::mesh(const Polygon** triangles) const noexcept
{
if (triangles) *triangles = pImpl->triangles;
- return pImpl->triangleCount;
+ return pImpl->triangleCnt;
}
Paint* paint = nullptr; //vector picture uses
Surface* surface = nullptr; //bitmap picture uses
Polygon* triangles = nullptr; //mesh data
- uint32_t triangleCount = 0; //mesh triangle count
+ uint32_t triangleCnt = 0; //mesh triangle count
void* rdata = nullptr; //engine data
float w = 0, h = 0;
bool resizing = false;
if (surface) {
auto transform = resizeTransform(pTransform);
- rdata = renderer.prepare(surface, triangles, triangleCount, rdata, &transform, opacity, clips, static_cast<RenderUpdateFlag>(pFlag | flag));
+ rdata = renderer.prepare(surface, triangles, triangleCnt, rdata, &transform, opacity, clips, static_cast<RenderUpdateFlag>(pFlag | flag));
} else if (paint) {
if (resizing) {
loader->resize(paint, w, h);
bool bounds(float* x, float* y, float* w, float* h)
{
- if (triangleCount > 0) {
+ if (triangleCnt > 0) {
Point min = { triangles[0].vertex[0].pt.x, triangles[0].vertex[0].pt.y };
Point max = { triangles[0].vertex[0].pt.x, triangles[0].vertex[0].pt.y };
- for (uint32_t i = 0; i < triangleCount; ++i) {
+ for (uint32_t i = 0; i < triangleCnt; ++i) {
if (triangles[i].vertex[0].pt.x < min.x) min.x = triangles[i].vertex[0].pt.x;
else if (triangles[i].vertex[0].pt.x > max.x) max.x = triangles[i].vertex[0].pt.x;
if (triangles[i].vertex[0].pt.y < min.y) min.y = triangles[i].vertex[0].pt.y;
return Result::Success;
}
- bool mesh(const Polygon* triangles, const uint32_t triangleCount)
+ bool mesh(const Polygon* triangles, const uint32_t triangleCnt)
{
- if (triangles && triangleCount > 0) {
- this->triangleCount = triangleCount;
- this->triangles = (Polygon*)malloc(sizeof(Polygon) * triangleCount);
- memcpy(this->triangles, triangles, sizeof(Polygon) * triangleCount);
+ if (triangles && triangleCnt > 0) {
+ this->triangleCnt = triangleCnt;
+ this->triangles = (Polygon*)malloc(sizeof(Polygon) * triangleCnt);
+ memcpy(this->triangles, triangles, sizeof(Polygon) * triangleCnt);
} else {
free(this->triangles);
this->triangles = nullptr;
- this->triangleCount = 0;
+ this->triangleCnt = 0;
}
return true;
}
dup->h = h;
dup->resizing = resizing;
- if (triangleCount > 0) {
- dup->triangleCount = triangleCount;
- dup->triangles = (Polygon*)malloc(sizeof(Polygon) * triangleCount);
- memcpy(dup->triangles, triangles, sizeof(Polygon) * triangleCount);
+ if (triangleCnt > 0) {
+ dup->triangleCnt = triangleCnt;
+ dup->triangles = (Polygon*)malloc(sizeof(Polygon) * triangleCnt);
+ memcpy(dup->triangles, triangles, sizeof(Polygon) * triangleCnt);
}
return ret.release();