}
-static bool _translucentDownScaleImageRle(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, float scale)
+static bool _translucentDownScaleImageRle(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, uint32_t halfScale)
{
auto span = image->rle->spans;
auto img = image->data;
auto w = image->w;
auto h = image->h;
- auto halfScale = static_cast<uint32_t>(0.5f / scale);
- if (halfScale == 0) halfScale = 1;
-
for (uint32_t i = 0; i < image->rle->size; ++i, ++span) {
auto ey1 = span->y * itransform->e12 + itransform->e13;
auto ey2 = span->y * itransform->e22 + itransform->e23;
return true;
}
-static bool _translucentDownScaleImageRleMask(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, float scale, uint32_t (*blendMethod)(uint32_t))
+static bool _translucentDownScaleImageRleMask(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, uint32_t halfScale, uint32_t (*blendMethod)(uint32_t))
{
TVGLOG("SW_ENGINE", "Image Rle Alpha Mask / Inverse Alpha Mask Composition");
- auto halfScale = static_cast<uint32_t>(0.5f / scale);
- if (halfScale == 0) halfScale = 1;
-
auto span = image->rle->spans;
auto img = image->data;
auto w = image->w;
}
-static bool _rasterTranslucentDownScaleImageRle(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, float scale)
+static bool _rasterTranslucentDownScaleImageRle(SwSurface* surface, const SwImage* image, uint32_t opacity, const Matrix* itransform, uint32_t halfScale)
{
if (surface->compositor) {
if (surface->compositor->method == CompositeMethod::AlphaMask) {
- return _translucentDownScaleImageRleMask(surface, image, opacity, itransform, scale, surface->blender.alpha);
+ return _translucentDownScaleImageRleMask(surface, image, opacity, itransform, halfScale, surface->blender.alpha);
}
if (surface->compositor->method == CompositeMethod::InvAlphaMask) {
- return _translucentDownScaleImageRleMask(surface, image, opacity, itransform, scale, surface->blender.ialpha);
+ return _translucentDownScaleImageRleMask(surface, image, opacity, itransform, halfScale, surface->blender.ialpha);
}
}
- return _translucentDownScaleImageRle(surface, image, opacity, itransform, scale);
+ return _translucentDownScaleImageRle(surface, image, opacity, itransform, halfScale);
}
}
-static bool _rasterDownScaleImageRle(SwSurface* surface, const SwImage* image, const Matrix* itransform, float scale)
+static bool _rasterDownScaleImageRle(SwSurface* surface, const SwImage* image, const Matrix* itransform, uint32_t halfScale)
{
auto span = image->rle->spans;
auto img = image->data;
auto w = image->w;
auto h = image->h;
- auto halfScale = static_cast<uint32_t>(0.5f / scale);
- if (halfScale == 0) halfScale = 1;
-
for (uint32_t i = 0; i < image->rle->size; ++i, ++span) {
auto ey1 = span->y * itransform->e12 + itransform->e13;
auto ey2 = span->y * itransform->e22 + itransform->e23;
}
-static bool _translucentDownScaleImage(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, float scale)
+static bool _translucentDownScaleImage(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, uint32_t halfScale)
{
auto img = image->data;
auto w = image->w;
auto h = image->h;
-
- auto halfScale = static_cast<uint32_t>(0.5f / scale);
- if (halfScale == 0) halfScale = 1;
-
auto dbuffer = &surface->buffer[region.min.y * surface->stride + region.min.x];
for (auto y = region.min.y; y < region.max.y; ++y) {
}
-static bool _translucentDownScaleImageMask(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, float scale, uint32_t (*blendMethod)(uint32_t))
+static bool _translucentDownScaleImageMask(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, uint32_t halfScale, uint32_t (*blendMethod)(uint32_t))
{
TVGLOG("SW_ENGINE", "Transformed Image Alpha Mask / Inverse Alpha Mask Composition");
auto img = image->data;
auto w = image->w;
auto h = image->h;
-
- auto halfScale = static_cast<uint32_t>(0.5f / scale);
- if (halfScale == 0) halfScale = 1;
-
auto dbuffer = &surface->buffer[region.min.y * surface->stride + region.min.x];
auto cbuffer = &surface->compositor->image.data[region.min.y * surface->stride + region.min.x];
}
-static bool _rasterTranslucentDownScaleImage(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, float scale)
+static bool _rasterTranslucentDownScaleImage(SwSurface* surface, const SwImage* image, uint32_t opacity, const SwBBox& region, const Matrix* itransform, uint32_t halfScale)
{
if (surface->compositor) {
if (surface->compositor->method == CompositeMethod::AlphaMask) {
- return _translucentDownScaleImageMask(surface, image, opacity, region, itransform, scale, surface->blender.alpha);
+ return _translucentDownScaleImageMask(surface, image, opacity, region, itransform, halfScale, surface->blender.alpha);
}
if (surface->compositor->method == CompositeMethod::InvAlphaMask) {
- return _translucentDownScaleImageMask(surface, image, opacity, region, itransform, scale, surface->blender.ialpha);
+ return _translucentDownScaleImageMask(surface, image, opacity, region, itransform, halfScale, surface->blender.ialpha);
}
}
- return _translucentDownScaleImage(surface, image, opacity, region, itransform, scale);
+ return _translucentDownScaleImage(surface, image, opacity, region, itransform, halfScale);
}
auto translucent = _translucent(surface, opacity);
auto downScaleTolerance = 0.5f;
+ auto halfScale = static_cast<uint32_t>(0.5f / scale);
+ if (halfScale == 0) halfScale = 1;
//Clipped Image
if (image->rle) {
if (transformed) {
if (translucent) {
if (fabsf(scale - 1.0f) <= FLT_EPSILON) return _rasterTranslucentImageRle(surface, image, opacity, &itransform);
- else if (scale < downScaleTolerance) return _rasterTranslucentDownScaleImageRle(surface, image, opacity, &itransform, scale);
+ else if (scale < downScaleTolerance) return _rasterTranslucentDownScaleImageRle(surface, image, opacity, &itransform, halfScale);
else return _rasterTranslucentUpScaleImageRle(surface, image, opacity, &itransform);
} else {
if (fabsf(scale - 1.0f) <= FLT_EPSILON) return _rasterImageRle(surface, image, &itransform);
- else if (scale < downScaleTolerance) return _rasterDownScaleImageRle(surface, image, &itransform, scale);
+ else if (scale < downScaleTolerance) return _rasterDownScaleImageRle(surface, image, &itransform, halfScale);
else return _rasterUpScaleImageRle(surface, image, &itransform);
}
//Fast track
if (transformed) {
if (translucent) {
if (fabsf(scale - 1.0f) <= FLT_EPSILON) return _rasterTranslucentImage(surface, image, opacity, bbox, &itransform);
- else if (scale < downScaleTolerance) return _rasterTranslucentDownScaleImage(surface, image, opacity, bbox, &itransform, scale);
+ else if (scale < downScaleTolerance) return _rasterTranslucentDownScaleImage(surface, image, opacity, bbox, &itransform, halfScale);
else return _rasterTranslucentUpScaleImage(surface, image, opacity, bbox, &itransform);
} else {
if (fabsf(scale - 1.0f) <= FLT_EPSILON) return _rasterImage(surface, image, bbox, &itransform);
- else if (scale < downScaleTolerance) return _rasterDownScaleImage(surface, image, bbox, &itransform, scale);
+ else if (scale < downScaleTolerance) return _rasterDownScaleImage(surface, image, bbox, &itransform, halfScale);
else return _rasterUpScaleImage(surface, image, bbox, &itransform);
}
//Fast track