pidgin: 2b241355: Simplify a little bit

markdoliner at pidgin.im markdoliner at pidgin.im
Sun Dec 14 17:08:16 EST 2008


-----------------------------------------------------------------
Revision: 2b2413559685df17d16670e7769c19d61235fc28
Ancestor: 70eebf0941c1e8648d189bc292c08fb881a892af
Author: markdoliner at pidgin.im
Date: 2008-12-14T22:00:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2b2413559685df17d16670e7769c19d61235fc28

Modified files:
        libpurple/protocols/myspace/markup.c

ChangeLog: 

Simplify a little bit

-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/markup.c	854a43233ee85e63ed4e6d93c1edced418d48a33
+++ libpurple/protocols/myspace/markup.c	02510b48be3a87123ec1ed4865c31415ed7f9aa3
@@ -81,7 +81,9 @@ static gdouble _font_scale[] = { .85, .9
  *                                 1    2  3    4     5      6       7 */
 static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 };
 
-#define MAX_FONT_SIZE                   7       /* Purple maximum font size */
+/* Purple maximum font size.  Equivalent to sizeof(_font_scale) / sizeof(_font_scale[0]) */
+#define MAX_FONT_SIZE                   7
+
 #define POINTS_PER_INCH                 72      /* How many pt's in an inch */
 
 /* Text formatting bits for <f s=#> */
@@ -116,15 +118,11 @@ msim_point_to_purple_size(MsimSession *s
 msim_point_to_purple_size(MsimSession *session, guint point)
 {
 	guint size, this_point, base;
-	gdouble scale;
 
 	base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE);
 
-	for (size = 0;
-			size < sizeof(_font_scale) / sizeof(_font_scale[0]);
-			++size) {
-		scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1];
-		this_point = (guint)msim_round(scale * base);
+	for (size = 0; size < MAX_FONT_SIZE; ++size) {
+		this_point = (guint)msim_round(base * _font_scale[size]);
 
 		if (this_point >= point) {
 			purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n",


More information about the Commits mailing list