[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-zaurus:742] Re: jfbterm のrotate パッチ
<200301091055.TAA27866@xxxxxxxxxxxxxxxxxx>の記事において
私は書きました。
>> 以前はこれでちゃんと動いてたような気もしたのですが、自分でとった
>> screen shot をみるとやっぱりずれているようなので、bug だと思います。な
>> んとかします。
直してみました。何故か C700 も回転してるんですね... しない方が良さそ
うなのに。
--
野首 貴嗣
E-mail: knok@xxxxxxxxxxxxx
knok@xxxxxxxxxx / knok@xxxxxxxxxx
diff -ur jfbterm-0.3.10/fbcommon.c jfbterm-0.3.10-lh/fbcommon.c
--- jfbterm-0.3.10/fbcommon.c Mon Jun 17 14:35:23 2002
+++ jfbterm-0.3.10-lh/fbcommon.c Tue Jun 18 13:28:02 2002
@@ -85,6 +85,15 @@
},
#endif
#if (defined(JFB_16BPP) && defined(JFB_PACKED) && defined(JFB_TRUECOLOR))
+#ifdef JFB_ROTATE
+ {
+ 16, FB_TYPE_PACKED_PIXELS, FB_VISUAL_TRUECOLOR,
+ tfbm_fill_rect_16bpp_packed_rot,
+ tfbm_overlay_16bpp_packed_rot,
+ tfbm_clear_all_16bpp_packed_rot,
+ tfbm_reverse_16bpp_packed_rot
+ },
+#else
{
16, FB_TYPE_PACKED_PIXELS, FB_VISUAL_TRUECOLOR,
tfbm_fill_rect_16bpp_packed,
@@ -92,6 +101,7 @@
tfbm_clear_all_16bpp_packed,
tfbm_reverse_16bpp_packed
},
+#endif /* JFB_ROTATE */
#endif
#if (defined(JFB_16BPP) && defined(JFB_PACKED) && defined(JFB_DIRECTCOLOR))
{
@@ -499,8 +509,16 @@
tfbm_initcolors(p, &fb_var, &fb_fix);
/* fix: scanline length is not necessarily the same as display width */
+#if !defined(JFB_ROTATE)
p->width = fb_var.xres;
p->height = fb_var.yres;
+#else
+ p->width = fb_var.yres;
+ p->height = fb_var.xres;
+#ifdef DEBUG
+ fprintf(stderr, "swap x/y axis\n");
+#endif
+#endif
p->bytePerLine = fb_fix.line_length;
p->soff = (u_long)(fb_fix.smem_start) & (~PAGE_MASK);
diff -ur jfbterm-0.3.10/fbdpsp.c jfbterm-0.3.10-lh/fbdpsp.c
--- jfbterm-0.3.10/fbdpsp.c Mon Jun 17 14:35:23 2002
+++ jfbterm-0.3.10-lh/fbdpsp.c Thu Jun 20 19:29:17 2002
@@ -301,6 +301,7 @@
#endif /* JFBTERM_15BPP */
#ifdef JFB_16BPP
+#if !defined(JFB_ROTATE)
/* 16 bpp */
void tfbm_fill_rect_16bpp_packed(
TFrameBufferMemory* p,
@@ -397,6 +398,105 @@
}
}
}
+
+#else /* JFB_ROTATE */
+/* rotated 16 bpp */
+void tfbm_fill_rect_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int sx, u_int sy, u_int lx, u_int ly, u_int color)
+{
+ u_int x,y;
+ u_short *d;
+ u_short icol;
+
+ icol = tfbm_select_16_color(color);
+ for (y = sy ; y < sy+ly ; y++) {
+ d = (u_short*)(p->smem + p->bytePerLine + sx * p->bytePerLine - y * 2 - 2);
+ for(x=0;x<lx;x++){
+ *(d + p->bytePerLine * x/2) = icol;
+ }
+ }
+}
+
+void tfbm_clear_all_16bpp_packed_rot(
+ TFrameBufferMemory* p, u_int color)
+{
+ u_int lp;
+ u_short *d=(u_short*)(p->smem);
+ u_short icol;
+
+ icol = tfbm_select_16_color(color);
+ for(lp=0;lp<((p->slen)/2);lp++){
+ d[lp]=icol;
+ }
+}
+
+void tfbm_overlay_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int xd, u_int yd,
+ const u_char* ps, u_int lx, u_int ly, u_int gap, u_int color)
+{
+ u_int y;
+ u_short* wp;
+ const u_char* tps;
+ u_int i;
+ u_int sb;
+ u_short icol;
+
+ icol = tfbm_select_16_color(color);
+ for (y = yd ; y < yd+ly ; y++) {
+ tps = ps;
+ wp = (u_short*)(p->smem + p->bytePerLine + xd * p->bytePerLine - y * 2 - 2);
+ for (i = lx ; i >= 8 ; i -= 8) {
+ sb = *tps++;
+ if (sb & 0x80) *wp = icol;
+ if (sb & 0x40) *(wp + p->bytePerLine * 1/2) = icol;
+ if (sb & 0x20) *(wp + p->bytePerLine * 2/2) = icol;
+ if (sb & 0x10) *(wp + p->bytePerLine * 3/2) = icol;
+ if (sb & 0x08) *(wp + p->bytePerLine * 4/2) = icol;
+ if (sb & 0x04) *(wp + p->bytePerLine * 5/2) = icol;
+ if (sb & 0x02) *(wp + p->bytePerLine * 6/2) = icol;
+ if (sb & 0x01) *(wp + p->bytePerLine * 7/2) = icol;
+ wp += p->bytePerLine * 8/2;
+ }
+ if (i) {
+ sb = *tps++;
+ switch (i) {
+ case 7: if (sb & 0x02) *(wp + p->bytePerLine * 6/2) = icol;
+ case 6: if (sb & 0x04) *(wp + p->bytePerLine * 5/2) = icol;
+ case 5: if (sb & 0x08) *(wp + p->bytePerLine * 4/2) = icol;
+ case 4: if (sb & 0x10) *(wp + p->bytePerLine * 3/2) = icol;
+ case 3: if (sb & 0x20) *(wp + p->bytePerLine * 2/2) = icol;
+ case 2: if (sb & 0x40) *(wp + p->bytePerLine * 1/2) = icol;
+ case 1: if (sb & 0x80) *(wp + p->bytePerLine * 0) = icol;
+ }
+ }
+ ps += gap;
+ }
+}
+
+#ifndef min
+# define min(a, b) (((a) > (b))?(b):(a))
+#endif
+
+void tfbm_reverse_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int sx, u_int sy, u_int lx, u_int ly, u_int color)
+{
+ u_int x,y;
+ u_short *d;
+ u_short icol;
+
+ icol = tfbm_select_16_color(color);
+ for (y = sy ; y < min(sy+ly, p->height) ; y++) {
+ d = (u_short*)(p->smem + p->bytePerLine + sx * p->bytePerLine - y * 2 - 2);
+ for (x = 0 ; x < lx ; x++) {
+ *(d + p->bytePerLine * x/2) ^= icol;
+ }
+ }
+}
+#endif /* JFB_ROTATE */
+
#endif /* JFB_16BPP */
#ifdef JFB_24BPP
Only in jfbterm-0.3.10-lh: fbdpsp.c~
diff -ur jfbterm-0.3.10/fbdpsp.h jfbterm-0.3.10-lh/fbdpsp.h
--- jfbterm-0.3.10/fbdpsp.h Mon Oct 18 07:16:47 1999
+++ jfbterm-0.3.10-lh/fbdpsp.h Fri Jun 14 19:15:42 2002
@@ -72,6 +72,20 @@
#endif /* JFB_15BPP */
#ifdef JFB_16BPP
+#ifdef JFB_ROTATE
+void tfbm_fill_rect_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int sx, u_int sy, u_int lx, u_int ly, u_int color);
+void tfbm_overlay_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int xd, u_int yd,
+ const u_char* ps, u_int lx, u_int ly, u_int gap, u_int color);
+void tfbm_clear_all_16bpp_packed_rot(
+ struct Raw_TFrameBufferMemory* p, u_int color);
+void tfbm_reverse_16bpp_packed_rot(
+ TFrameBufferMemory* p,
+ u_int sx, u_int sy, u_int lx, u_int ly, u_int color);
+#else
void tfbm_fill_rect_16bpp_packed(
TFrameBufferMemory* p,
u_int sx, u_int sy, u_int lx, u_int ly, u_int color);
@@ -84,6 +98,7 @@
void tfbm_reverse_16bpp_packed(
TFrameBufferMemory* p,
u_int sx, u_int sy, u_int lx, u_int ly, u_int color);
+#endif /* JFB_ROTATE */
#endif /* JFB_16BPP */
#ifdef JFB_24BPP
--
ML: linux-zaurus@xxxxxxxxxxx
使い方: http://QuickML.com/