Thu Jul 22 12:52:59 2010 UTC ()
Umm, revert unintended changes.


(tsutsui)
diff -r1.48 -r1.49 src/sys/dev/wsfont/wsfont.c

cvs diff -r1.48 -r1.49 src/sys/dev/wsfont/wsfont.c (expand / switch to unified diff)

--- src/sys/dev/wsfont/wsfont.c 2010/07/22 12:48:00 1.48
+++ src/sys/dev/wsfont/wsfont.c 2010/07/22 12:52:59 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wsfont.c,v 1.48 2010/07/22 12:48:00 tsutsui Exp $ */ 1/* $NetBSD: wsfont.c,v 1.49 2010/07/22 12:52:59 tsutsui Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.48 2010/07/22 12:48:00 tsutsui Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: wsfont.c,v 1.49 2010/07/22 12:52:59 tsutsui Exp $");
34 34
35#include "opt_wsfont.h" 35#include "opt_wsfont.h"
36 36
37#include <sys/param.h> 37#include <sys/param.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39#include <sys/time.h> 39#include <sys/time.h>
40#include <sys/malloc.h> 40#include <sys/malloc.h>
41#include <sys/queue.h> 41#include <sys/queue.h>
42 42
43#include <dev/wscons/wsdisplayvar.h> 43#include <dev/wscons/wsdisplayvar.h>
44#include <dev/wscons/wsconsio.h> 44#include <dev/wscons/wsconsio.h>
45#include <dev/wsfont/wsfont.h> 45#include <dev/wsfont/wsfont.h>
46 46
@@ -369,43 +369,37 @@ wsfont_rotate_cw_internal(struct wsdispl @@ -369,43 +369,37 @@ wsfont_rotate_cw_internal(struct wsdispl
369 * new one... 369 * new one...
370 */ 370 */
371 free(newbits, M_DEVBUF); 371 free(newbits, M_DEVBUF);
372 free(newfont, M_DEVBUF); 372 free(newfont, M_DEVBUF);
373 newfont = NULL; 373 newfont = NULL;
374 } 374 }
375 375
376 return (newfont); 376 return (newfont);
377} 377}
378 378
379struct wsdisplay_font * 379struct wsdisplay_font *
380wsfont_rotate_ccw_internal(struct wsdisplay_font *font) 380wsfont_rotate_ccw_internal(struct wsdisplay_font *font)
381{ 381{
382 int b, n, r, namelen, newstride; 382 int b, n, r, newstride;
383 struct wsdisplay_font *newfont; 383 struct wsdisplay_font *newfont;
384 char *newname, *newbits; 384 char *newbits;
385 385
386 /* Duplicate the existing font... */ 386 /* Duplicate the existing font... */
387 newfont = malloc(sizeof(*font), M_DEVBUF, M_WAITOK); 387 newfont = malloc(sizeof(*font), M_DEVBUF, M_WAITOK);
388 if (newfont == NULL) 388 if (newfont == NULL)
389 return (NULL); 389 return (NULL);
390 390
391 *newfont = *font; 391 *newfont = *font;
392 392
393 namelen = strlen(font->name) + 4; 
394 newname = malloc(namelen, M_DEVBUF, M_WAITOK); 
395 strlcpy(newname, font->name, namelen); 
396 strlcat(newname, "_ccw", namelen); 
397 newfont->name = newname; 
398 
399 /* Allocate a buffer big enough for the rotated font. */ 393 /* Allocate a buffer big enough for the rotated font. */
400 newstride = (font->fontheight + 7) / 8; 394 newstride = (font->fontheight + 7) / 8;
401 newbits = malloc(newstride * font->fontwidth * font->numchars, 395 newbits = malloc(newstride * font->fontwidth * font->numchars,
402 M_DEVBUF, M_WAITOK|M_ZERO); 396 M_DEVBUF, M_WAITOK|M_ZERO);
403 if (newbits == NULL) { 397 if (newbits == NULL) {
404 free(newfont, M_DEVBUF); 398 free(newfont, M_DEVBUF);
405 return (NULL); 399 return (NULL);
406 } 400 }
407 401
408 /* Rotate the font a bit at a time. */ 402 /* Rotate the font a bit at a time. */
409 for (n = 0; n < font->numchars; n++) { 403 for (n = 0; n < font->numchars; n++) {
410 unsigned char *ch = (unsigned char *)font->data + 404 unsigned char *ch = (unsigned char *)font->data +
411 (n * font->stride * font->fontheight); 405 (n * font->stride * font->fontheight);