Style fixes
This commit is contained in:
@@ -355,14 +355,13 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
// Both CSS height and width set: resolve both, then clamp to viewport preserving requested ratio
|
// Both CSS height and width set: resolve both, then clamp to viewport preserving requested ratio
|
||||||
displayHeight = static_cast<int>(
|
displayHeight = static_cast<int>(
|
||||||
imgStyle.imageHeight.toPixels(emSize, static_cast<float>(self->viewportHeight)) + 0.5f);
|
imgStyle.imageHeight.toPixels(emSize, static_cast<float>(self->viewportHeight)) + 0.5f);
|
||||||
displayWidth = static_cast<int>(
|
displayWidth =
|
||||||
imgStyle.imageWidth.toPixels(emSize, static_cast<float>(containerWidth)) + 0.5f);
|
static_cast<int>(imgStyle.imageWidth.toPixels(emSize, static_cast<float>(containerWidth)) + 0.5f);
|
||||||
if (displayHeight < 1) displayHeight = 1;
|
if (displayHeight < 1) displayHeight = 1;
|
||||||
if (displayWidth < 1) displayWidth = 1;
|
if (displayWidth < 1) displayWidth = 1;
|
||||||
if (displayWidth > containerWidth || displayHeight > self->viewportHeight) {
|
if (displayWidth > containerWidth || displayHeight > self->viewportHeight) {
|
||||||
float scaleX = (displayWidth > containerWidth)
|
float scaleX =
|
||||||
? static_cast<float>(containerWidth) / displayWidth
|
(displayWidth > containerWidth) ? static_cast<float>(containerWidth) / displayWidth : 1.0f;
|
||||||
: 1.0f;
|
|
||||||
float scaleY = (displayHeight > self->viewportHeight)
|
float scaleY = (displayHeight > self->viewportHeight)
|
||||||
? static_cast<float>(self->viewportHeight) / displayHeight
|
? static_cast<float>(self->viewportHeight) / displayHeight
|
||||||
: 1.0f;
|
: 1.0f;
|
||||||
@@ -398,8 +397,8 @@ void XMLCALL ChapterHtmlSlimParser::startElement(void* userData, const XML_Char*
|
|||||||
LOG_DBG("EHP", "Display size from CSS height: %dx%d", displayWidth, displayHeight);
|
LOG_DBG("EHP", "Display size from CSS height: %dx%d", displayWidth, displayHeight);
|
||||||
} else if (hasCssWidth && !hasCssHeight && dims.width > 0 && dims.height > 0) {
|
} else if (hasCssWidth && !hasCssHeight && dims.width > 0 && dims.height > 0) {
|
||||||
// Use CSS width (resolve % against container width) and derive height from aspect ratio
|
// Use CSS width (resolve % against container width) and derive height from aspect ratio
|
||||||
displayWidth = static_cast<int>(
|
displayWidth =
|
||||||
imgStyle.imageWidth.toPixels(emSize, static_cast<float>(containerWidth)) + 0.5f);
|
static_cast<int>(imgStyle.imageWidth.toPixels(emSize, static_cast<float>(containerWidth)) + 0.5f);
|
||||||
if (displayWidth > containerWidth) displayWidth = containerWidth;
|
if (displayWidth > containerWidth) displayWidth = containerWidth;
|
||||||
if (displayWidth < 1) displayWidth = 1;
|
if (displayWidth < 1) displayWidth = 1;
|
||||||
displayHeight =
|
displayHeight =
|
||||||
|
|||||||
Reference in New Issue
Block a user