[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Revert part of 56e012be: hardcode again "too small" preview size
From:       Jean-Marc Lasgouttes <lasgouttes () lyx ! org>
Date:       2020-05-28 18:20:48
Message-ID: 20200528182048.5E95C280299 () lyx ! lyx ! org
[Download RAW message or body]

commit e06e2e24e74789356bdf73373c5abc32ead8f802
Author: Jean-Marc Lasgouttes <lasgouttes@lyx.org>
Date:   Thu May 28 20:40:30 2020 +0200

    Revert part of 56e012be: hardcode again "too small" preview size
    
    It seems that the use of zoom in determining the size of the minimal
    value was a bad idea.
    
    It still think that the situation is not very satisfying, we need a new idea.
---
 src/mathed/InsetMathHull.cpp |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 7754e4d..8e16787 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -511,11 +511,9 @@ bool InsetMathHull::previewState(const BufferView *const bv) const
 namespace {
 const int ERROR_FRAME_WIDTH = 2;
 
-bool previewTooSmall(MetricsBase const & mb, Dimension const & dim)
+bool previewTooSmall(Dimension const & dim)
 {
-	// Value was hardcoded to 10 pixels
-	int const minval = mb.bv->zoomedPixels(10);
-	return dim.width() <= minval && dim.height() <= minval;
+	return dim.width() <= 10 && dim.height() <= 10;
 }
 }
 
@@ -528,7 +526,7 @@ void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
 
 	if (previewState(mi.base.bv)) {
 		preview_->metrics(mi, dim);
-		if (previewTooSmall(mi.base, dim)) {
+		if (previewTooSmall(dim)) {
 			// preview image is too small
 			dim.wid += 2 * ERROR_FRAME_WIDTH;
 			dim.asc += 2 * ERROR_FRAME_WIDTH;
@@ -593,7 +591,7 @@ ColorCode InsetMathHull::backgroundColor(PainterInfo const & pi) const
 	BufferView const * const bv = pi.base.bv;
 	if (previewState(bv)) {
 		Dimension const dim = dimension(*pi.base.bv);
-		if (previewTooSmall(pi.base, dim))
+		if (previewTooSmall(dim))
 			return Color_error;
 		return graphics::PreviewLoader::backgroundColor();
 	}
@@ -623,7 +621,7 @@ void InsetMathHull::drawMarkers(PainterInfo & pi, int x, int y) const
 void InsetMathHull::drawBackground(PainterInfo & pi, int x, int y) const
 {
 	Dimension const dim = dimension(*pi.base.bv);
-	if (previewTooSmall(pi.base, dim)) {
+	if (previewTooSmall(dim)) {
 		pi.pain.fillRectangle(x, y - 2 * ERROR_FRAME_WIDTH,
 		    dim.wid, dim.asc + dim.des, backgroundColor(pi));
 		return;
@@ -652,7 +650,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
 		// already.
 		Changer dummy = !canPaintChange(*bv) ? make_change(pi.change, Change())
 			: Changer();
-		if (previewTooSmall(pi.base, dim)) {
+		if (previewTooSmall(dim)) {
 			// we have an extra frame
 			preview_->draw(pi, x + ERROR_FRAME_WIDTH, y);
 		} else {
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic