OSDN Git Service

* Adjust width for android.
authorAtsushi Konno <konn@users.sourceforge.jp>
Tue, 19 Apr 2011 17:11:37 +0000 (02:11 +0900)
committerAtsushi Konno <konn@users.sourceforge.jp>
Tue, 19 Apr 2011 17:11:37 +0000 (02:11 +0900)
include/mod_chxj.h
src/chxj_android.c
src/chxj_img_conv_format.c

index d990d43..648be63 100755 (executable)
@@ -569,6 +569,7 @@ extern void *rpl_malloc(size_t n);
 
 
 #define TO_ADDR(X) ((unsigned int)(apr_size_t)(X))
+#define ADJUST_WIDTH_FOR_ANDROID (40)
 #endif
 /*
  * vim:ts=2 et
index 1d3b3ec..0bfb478 100644 (file)
@@ -1363,7 +1363,7 @@ s_android_start_head_tag(void *pdoc, Node *node)
     W_L("name=\"viewport\" ");
     W_L("id=\"android-viewport\" ");
     W_L("content=\"width=");
-    char *ww = apr_psprintf(r->pool, "%d", (int)((double)android->spec->width * (double)1.5));
+    char *ww = apr_psprintf(r->pool, "%d", (int)((double)android->spec->width * (double)1.5) - ADJUST_WIDTH_FOR_ANDROID);
     W_V(ww);
     W_L(",user-scalable=no,maximum-scale=0.6667\" />");
     W_L("<meta name=\"format-detection\" content=\"telephone=no\" />");
@@ -7063,7 +7063,7 @@ s_android_end_span_tag(void *pdoc, Node *UNUSED(node))
 /**
  * It is a handler who processes the STYLE tag.
  *
- * @param pdoc  [i/o] The pointer to the SoftBank XHTML structure at the output
+ * @param pdoc  [i/o] The pointer to the XHTML structure at the output
  *                     destination is specified.
  * @param node   [i]   The STYLE tag node is specified.
  * @return The conversion result is returned.
index 93f62c0..77d2fc4 100644 (file)
@@ -671,6 +671,9 @@ s_create_cache_file(request_rec          *r,
     if (IS_IPHONE(spec) || IS_ANDROID(spec)) {
       ww = (int)((double)ww * (double)1.5);
       hh = (int)((double)hh * (double)1.5);
+      if (IS_ANDROID(spec)) {
+        ww = ww - ADJUST_WIDTH_FOR_ANDROID;
+      }
     }
     if ((qsp->mode == IMG_CONV_MODE_WALLPAPER && spec->wp_width < oldw && spec->wp_heigh < oldh)
       || (qsp->mode != IMG_CONV_MODE_WALLPAPER && ww < oldw && hh < oldh)) {
@@ -1117,6 +1120,9 @@ s_create_blob_data(request_rec          *r,
     if (IS_IPHONE(spec) || IS_ANDROID(spec)) {
       ww = (int)((double)ww * (double)1.5);
       hh = (int)((double)hh * (double)1.5);
+      if (IS_ANDROID(spec)) {
+        ww = ww - ADJUST_WIDTH_FOR_ANDROID;
+      }
     }
     if ((qsp->mode == IMG_CONV_MODE_WALLPAPER && spec->wp_width < oldw && spec->wp_heigh < oldh)
       || (qsp->mode != IMG_CONV_MODE_WALLPAPER && ww < oldw && hh < oldh)) {
@@ -1291,6 +1297,9 @@ s_fixup_size(MagickWand           *magick_wand,
   if (IS_IPHONE(spec) || IS_ANDROID(spec)) {
     c_width = (int)((double)c_width * (double)1.5);
     c_heigh = (int)((double)c_heigh * (double)1.5);
+    if (IS_ANDROID(spec)) {
+      c_width = c_width - ADJUST_WIDTH_FOR_ANDROID;
+    }
     DBG(r,"REQ[%X] detect iphone/android width=[%d]", TO_ADDR(r),c_width);
     DBG(r,"REQ[%X] detect iphone/android heigh=[%d]", TO_ADDR(r),c_heigh);
   }