mozilla-cairo-lcd.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 25 Oct 2010 13:06:20 +0200
changeset 185 c03de6258fea
parent 121 f5759aada90e
child 237 676030198746
permissions -rw-r--r--
ignore empty LANGUAGE environment variable (bnc#648854)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# Parent 863b8585016fffd4755445eca723011717f4b930
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
Subject: Add a Cairo LCD filter to use FreeType LCD colour filtering features
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
References:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
https://bugzilla.mozilla.org/show_bug.cgi?id=404637
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
http://bugs.freedesktop.org/show_bug.cgi?id=10301
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
diff --git a/config/system-headers b/config/system-headers
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
--- a/config/system-headers
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
+++ b/config/system-headers
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
@@ -262,16 +262,17 @@ Font.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 Fonts.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 fp.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 fpieee.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 frame/log.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
 frame/req.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
 freetype/freetype.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
 freetype/ftcache.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 freetype/ftglyph.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
+freetype/ftlcdfil.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
 freetype/ftsynth.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 freetype/ftoutln.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
 freetype/ttnameid.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
 freetype/tttables.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
 freetype/t1tables.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
 fribidi/fribidi.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
 FSp_fopen.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
 fstream.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
diff --git a/gfx/cairo/cairo/src/cairo-font-options.c b/gfx/cairo/cairo/src/cairo-font-options.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
--- a/gfx/cairo/cairo/src/cairo-font-options.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
+++ b/gfx/cairo/cairo/src/cairo-font-options.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
@@ -34,41 +34,44 @@
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
  *      Owen Taylor <otaylor@redhat.com>
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
 #include "cairoint.h"
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
 static const cairo_font_options_t _cairo_font_options_nil = {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
     CAIRO_ANTIALIAS_DEFAULT,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
     CAIRO_SUBPIXEL_ORDER_DEFAULT,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
+    CAIRO_LCD_FILTER_DEFAULT,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
     CAIRO_HINT_STYLE_DEFAULT,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
     CAIRO_HINT_METRICS_DEFAULT
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
  * _cairo_font_options_init_default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
  * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
  * Initializes all fields of the font options object to default values.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
  **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
 void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
 _cairo_font_options_init_default (cairo_font_options_t *options)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
     options->antialias = CAIRO_ANTIALIAS_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
     options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
+    options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
     options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
     options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
 void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
 _cairo_font_options_init_copy (cairo_font_options_t		*options,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
 			       const cairo_font_options_t	*other)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
     options->antialias = other->antialias;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
     options->subpixel_order = other->subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
+    options->lcd_filter = other->lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
     options->hint_style = other->hint_style;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
     options->hint_metrics = other->hint_metrics;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
  * cairo_font_options_create:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
  * Allocates a new font options object with all options initialized
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
@@ -184,16 +187,18 @@ cairo_font_options_merge (cairo_font_opt
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
     if (cairo_font_options_status ((cairo_font_options_t *) other))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
 	return;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
     if (other->antialias != CAIRO_ANTIALIAS_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
 	options->antialias = other->antialias;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
     if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
 	options->subpixel_order = other->subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
+    if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
+	options->lcd_filter = other->lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
     if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
 	options->hint_style = other->hint_style;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
     if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
 	options->hint_metrics = other->hint_metrics;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
 slim_hidden_def (cairo_font_options_merge);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
@@ -216,16 +221,17 @@ cairo_font_options_equal (const cairo_fo
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
     if (cairo_font_options_status ((cairo_font_options_t *) other))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
 	return FALSE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
     if (options == other)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
 	return TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
     return (options->antialias == other->antialias &&
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
 	    options->subpixel_order == other->subpixel_order &&
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
+	    options->lcd_filter == other->lcd_filter &&
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 	    options->hint_style == other->hint_style &&
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
 	    options->hint_metrics == other->hint_metrics);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
 slim_hidden_def (cairo_font_options_equal);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
  * cairo_font_options_hash:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
  * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
@@ -241,17 +247,18 @@ slim_hidden_def (cairo_font_options_equa
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
 unsigned long
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
 cairo_font_options_hash (const cairo_font_options_t *options)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
     if (cairo_font_options_status ((cairo_font_options_t *) options))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
 	options = &_cairo_font_options_nil; /* force default values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
     return ((options->antialias) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
 	    (options->subpixel_order << 4) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
-	    (options->hint_style << 8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
+	    (options->lcd_filter << 8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
+	    (options->hint_style << 12) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
 	    (options->hint_metrics << 16));
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   128
 slim_hidden_def (cairo_font_options_hash);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   129
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
  * cairo_font_options_set_antialias:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
  * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
  * @antialias: the new antialiasing mode
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
@@ -323,16 +330,58 @@ cairo_font_options_get_subpixel_order (c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
     if (cairo_font_options_status ((cairo_font_options_t *) options))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
 	return CAIRO_SUBPIXEL_ORDER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
     return options->subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
+ * _cairo_font_options_set_lcd_filter:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
+ * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
+ * @lcd_filter: the new LCD filter
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
+ * Sets the LCD filter for the font options object. The LCD filter
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
+ * specifies how pixels are filtered when rendered with an antialiasing
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
+ * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
+ * #cairo_lcd_filter_t for full details.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
+ * Since: 1.8
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
+void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+_cairo_font_options_set_lcd_filter (cairo_font_options_t *options,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
+				    cairo_lcd_filter_t    lcd_filter)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
+    if (cairo_font_options_status (options))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
+	return;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
+    options->lcd_filter = lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
+}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
+ * _cairo_font_options_get_lcd_filter:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
+ * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   167
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
+ * Gets the LCD filter for the font options object.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
+ * See the documentation for #cairo_lcd_filter_t for full details.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
+ * Return value: the LCD filter for the font options object
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
+ * Since: 1.8
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
+cairo_lcd_filter_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
+_cairo_font_options_get_lcd_filter (const cairo_font_options_t *options)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   177
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
+    if (cairo_font_options_status ((cairo_font_options_t *) options))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
+	return CAIRO_LCD_FILTER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
+    return options->lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
+}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
  * cairo_font_options_set_hint_style:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
  * @options: a #cairo_font_options_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
  * @hint_style: the new hint style
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
  * Sets the hint style for font outlines for the font options object.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
  * This controls whether to fit font outlines to the pixel grid,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
  * and if so, whether to optimize for fidelity or contrast.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
  * See the documentation for #cairo_hint_style_t for full details.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
diff --git a/gfx/cairo/cairo/src/cairo-ft-font.c b/gfx/cairo/cairo/src/cairo-ft-font.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
--- a/gfx/cairo/cairo/src/cairo-ft-font.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
+++ b/gfx/cairo/cairo/src/cairo-ft-font.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
@@ -54,16 +54,38 @@
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   197
 #include FT_FREETYPE_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
 #include FT_OUTLINE_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
 #include FT_IMAGE_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
 #include FT_TRUETYPE_TABLES_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
 #if HAVE_FT_GLYPHSLOT_EMBOLDEN
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
 #include FT_SYNTHESIS_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
+#include FT_LCD_FILTER_H
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
+/* Fontconfig version older than 2.6 didn't have these options */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+#ifndef FC_LCD_FILTER
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
+#define FC_LCD_FILTER	"lcdfilter"
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
+/* Some Ubuntu versions defined FC_LCD_FILTER without defining the following */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
+#ifndef FC_LCD_NONE
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
+#define FC_LCD_NONE	0
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
+#define FC_LCD_DEFAULT	1
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+#define FC_LCD_LIGHT	2
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+#define FC_LCD_LEGACY	3
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
+/* FreeType version older than 2.3.5(?) didn't have these options */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+#ifndef FT_LCD_FILTER_NONE
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
+#define FT_LCD_FILTER_NONE	0
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+#define FT_LCD_FILTER_DEFAULT	1
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+#define FT_LCD_FILTER_LIGHT	2
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+#define FT_LCD_FILTER_LEGACY	16
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
 #define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
 #define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
 #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
 #define DOUBLE_FROM_16_16(t) ((double)(t) / 65536.0)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
 /* This is the max number of FT_face objects we keep open at once
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   234
 #define MAX_OPEN_FACES 10
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
@@ -772,46 +794,309 @@ _cairo_ft_unscaled_font_set_scale (cairo
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   236
 					unscaled->face->available_sizes[best_i].height);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
 	if (error)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   238
 	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
     return CAIRO_STATUS_SUCCESS;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
-/* Empirically-derived subpixel filtering values thanks to Keith
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
- * Packard and libXft. */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
-static const int    filters[3][3] = {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
-    /* red */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
-#if 0
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
-    {    65538*4/7,65538*2/7,65538*1/7 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
-    /* green */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
-    {    65536*1/4, 65536*2/4, 65537*1/4 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
-    /* blue */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
-    {    65538*1/7,65538*2/7,65538*4/7 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
+/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
+ * into a different format. For example, we want to convert a
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
+ * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   257
+ * ARGB or ABGR bitmap.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
+ * this function prepares a target descriptor for this operation.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
+ * input :: target bitmap descriptor. The function will set its
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
+ *          'width', 'rows' and 'pitch' fields, and only these
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   263
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
+ * slot  :: the glyph slot containing the source bitmap. this
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
+ *          function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+ * mode  :: the requested final rendering mode. supported values are
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
+ *          MONO, NORMAL (i.e. gray), LCD and LCD_V
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
+ * the function returns the size in bytes of the corresponding buffer,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+ * it's up to the caller to allocate the corresponding memory block
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
+ * before calling _fill_xrender_bitmap
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
+ * it also returns -1 in case of error (e.g. incompatible arguments,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
+ * like trying to convert a gray bitmap into a monochrome one)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   276
+ */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   277
+static int
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
+_compute_xrender_bitmap_size(FT_Bitmap      *target,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
+			     FT_GlyphSlot    slot,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
+			     FT_Render_Mode  mode)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   281
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
+    FT_Bitmap *ftbit;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
+    int width, height, pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
+    if (slot->format != FT_GLYPH_FORMAT_BITMAP)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
+	return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+    /* compute the size of the final bitmap */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+    ftbit = &slot->bitmap;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
+    width = ftbit->width;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+    height = ftbit->rows;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
+    pitch = (width + 3) & ~3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
+    switch (ftbit->pixel_mode) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   296
+    case FT_PIXEL_MODE_MONO:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
+	if (mode == FT_RENDER_MODE_MONO) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
+	    pitch = (((width + 31) & ~31) >> 3);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   299
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   301
+	/* fall-through */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+    case FT_PIXEL_MODE_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+	if (mode == FT_RENDER_MODE_LCD ||
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+	    mode == FT_RENDER_MODE_LCD_V)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+	    /* each pixel is replicated into a 32-bit ARGB value */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+	    pitch = width * 4;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+    case FT_PIXEL_MODE_LCD:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+	if (mode != FT_RENDER_MODE_LCD)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
+	    return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
+	/* horz pixel triplets are packed into 32-bit ARGB values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
+	width /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
+	pitch = width * 4;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
+    case FT_PIXEL_MODE_LCD_V:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+	if (mode != FT_RENDER_MODE_LCD_V)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+	    return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+	/* vert pixel triplets are packed into 32-bit ARGB values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+	height /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+	pitch = width * 4;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+    default:  /* unsupported source format */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+	return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+    target->width = width;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+    target->rows = height;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+    target->pitch = pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
+    target->buffer = NULL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+    return pitch * height;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
+/* this functions converts the glyph bitmap found in a FT_GlyphSlot
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+ * into a different format (see _compute_xrender_bitmap_size)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+ * you should call this function after _compute_xrender_bitmap_size
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
+ * target :: target bitmap descriptor. Note that its 'buffer' pointer
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
+ *           must point to memory allocated by the caller
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+ * slot   :: the glyph slot containing the source bitmap
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
+ * mode   :: the requested final rendering mode
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+ * bgr    :: boolean, set if BGR or VBGR pixel ordering is needed
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
+ */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
+static void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
+_fill_xrender_bitmap(FT_Bitmap      *target,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
+		     FT_GlyphSlot    slot,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+		     FT_Render_Mode  mode,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
+		     int             bgr)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
+    FT_Bitmap *ftbit = &slot->bitmap;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
+    unsigned char *srcLine = ftbit->buffer;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
+    unsigned char *dstLine = target->buffer;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
+    int src_pitch = ftbit->pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
+    int width = target->width;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+    int height = target->rows;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+    int pitch = target->pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+    int subpixel;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+    int h;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+    subpixel = (mode == FT_RENDER_MODE_LCD ||
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+		mode == FT_RENDER_MODE_LCD_V);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+    if (src_pitch < 0)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
+	srcLine -= src_pitch * (ftbit->rows - 1);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
+    target->pixel_mode = ftbit->pixel_mode;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+    switch (ftbit->pixel_mode) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+    case FT_PIXEL_MODE_MONO:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+	if (subpixel) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   383
+	    /* convert mono to ARGB32 values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
+		for (x = 0; x < width; x++) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
+		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+			((unsigned int *) dstLine)[x] = 0xffffffffU;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
+	    target->pixel_mode = FT_PIXEL_MODE_LCD;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
+	} else if (mode == FT_RENDER_MODE_NORMAL) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
+	    /* convert mono to 8-bit gray */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   398
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+		for (x = 0; x < width; x++) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+		    if (srcLine[(x >> 3)] & (0x80 >> (x & 7)))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+			dstLine[x] = 0xff;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+	    target->pixel_mode = FT_PIXEL_MODE_GRAY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+	    /* copy mono to mono */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+	    int  bytes = (width + 7) >> 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+		memcpy (dstLine, srcLine, bytes);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   416
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+    case FT_PIXEL_MODE_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+	if (subpixel) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
+	    /* convert gray to ARGB32 values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
+		unsigned int *dst = (unsigned int *) dstLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+		for (x = 0; x < width; x++) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
+		    unsigned int pix = srcLine[x];
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+		    pix |= (pix << 8);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   430
+		    pix |= (pix << 16);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   432
+		    dst[x] = pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
+	    target->pixel_mode = FT_PIXEL_MODE_LCD;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+        } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
+            /* copy gray into gray */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
+            for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
+                memcpy (dstLine, srcLine, width);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
+        }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
+        break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
+    case FT_PIXEL_MODE_LCD:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+	if (!bgr) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
+	    /* convert horizontal RGB into ARGB32 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
+		unsigned char *src = srcLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   451
+		unsigned int *dst = (unsigned int *) dstLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
+		for (x = 0; x < width; x++, src += 3) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   454
+		    unsigned int  pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   456
+		    pix = ((unsigned int)src[0] << 16) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
+			  ((unsigned int)src[1] <<  8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
+			  ((unsigned int)src[2]      ) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   459
+			  ((unsigned int)src[1] << 24) ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
+		    dst[x] = pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   465
+	    /* convert horizontal BGR into ARGB32 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
+	    for (h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+		unsigned char *src = srcLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
+		unsigned int *dst = (unsigned int *) dstLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+		for (x = 0; x < width; x++, src += 3) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
+		    unsigned int  pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
+		    pix = ((unsigned int)src[2] << 16) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
+			  ((unsigned int)src[1] <<  8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+			  ((unsigned int)src[0]      ) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
+			  ((unsigned int)src[1] << 24) ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
+		    dst[x] = pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   483
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   485
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+    default:  /* FT_PIXEL_MODE_LCD_V */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+	/* convert vertical RGB into ARGB32 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
+	if (!bgr) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+	    for (h = height; h > 0; h--, srcLine += 3 * src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+		unsigned char* src = srcLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+		unsigned int*  dst = (unsigned int *) dstLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+		for (x = 0; x < width; x++, src += 1) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+		    unsigned int pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
+#if 1
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+		    pix = ((unsigned int)src[0]           << 16) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+			  ((unsigned int)src[src_pitch]   <<  8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+			  ((unsigned int)src[src_pitch*2]      ) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+			  0xFF000000 ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+#else
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
+		    pix = ((unsigned int)src[0]           << 16) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+			  ((unsigned int)src[src_pitch]   <<  8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
+			  ((unsigned int)src[src_pitch*2]      ) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
+			  ((unsigned int)src[src_pitch]   << 24) ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
-    {    65538*9/13,65538*3/13,65538*1/13 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
-    /* green */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
-    {    65538*1/6, 65538*4/6, 65538*1/6 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
-    /* blue */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
-    {    65538*1/13,65538*3/13,65538*9/13 },
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
-};
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+		    dst[x] = pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   517
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+	    for (h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   521
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+		unsigned char *src = srcLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+		unsigned int *dst = (unsigned int *) dstLine;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+		for (x = 0; x < width; x++, src += 1) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+		    unsigned int  pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+		    pix = ((unsigned int)src[src_pitch * 2] << 16) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+			  ((unsigned int)src[src_pitch]     <<  8) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+			  ((unsigned int)src[0]                  ) |
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+			  ((unsigned int)src[src_pitch]     << 24) ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+		    dst[x] = pix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
 /* Fills in val->image with an image surface created from @bitmap
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
 static cairo_status_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   544
 _get_bitmap_surface (FT_Bitmap		     *bitmap,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
 		     cairo_bool_t	      own_buffer,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
 		     cairo_font_options_t    *font_options,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
 		     cairo_image_surface_t  **surface)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
     int width, height, stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
     unsigned char *data;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
     int format = CAIRO_FORMAT_A8;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
-    cairo_bool_t subpixel = FALSE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+    cairo_image_surface_t *image;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
     width = bitmap->width;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
     height = bitmap->rows;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   558
     if (width == 0 || height == 0) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
 	*surface = (cairo_image_surface_t *)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
 	    cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
 	return (*surface)->base.status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
@@ -858,154 +1143,63 @@ _get_bitmap_surface (FT_Bitmap		     *bi
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
 	format = CAIRO_FORMAT_A1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
 	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
     case FT_PIXEL_MODE_LCD:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
     case FT_PIXEL_MODE_LCD_V:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
     case FT_PIXEL_MODE_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   571
-	switch (font_options->antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
-	case CAIRO_ANTIALIAS_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
-	case CAIRO_ANTIALIAS_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   574
-	case CAIRO_ANTIALIAS_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
-	default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
+        if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
 	    stride = bitmap->pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
 	    if (own_buffer) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
 		data = bitmap->buffer;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
 	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
 		data = _cairo_malloc_ab (height, stride);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
 		if (!data)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
 		    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
 		memcpy (data, bitmap->buffer, stride * height);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
 	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
 	    format = CAIRO_FORMAT_A8;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
-	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
-	case CAIRO_ANTIALIAS_SUBPIXEL: {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
-	    int		    x, y;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
-	    unsigned char   *in_line, *out_line, *in;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
-	    unsigned int    *out;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
-	    unsigned int    red, green, blue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
-	    int		    rf, gf, bf;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
-	    int		    s;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
-	    int		    o, os;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
-	    unsigned char   *data_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
-	    unsigned int    width_rgba, stride_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   599
-	    int		    vmul = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
-	    int		    hmul = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   601
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
-	    switch (font_options->subpixel_order) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
-	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
-	    case CAIRO_SUBPIXEL_ORDER_RGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
-	    case CAIRO_SUBPIXEL_ORDER_BGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
-		width /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
-		hmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
-	    case CAIRO_SUBPIXEL_ORDER_VRGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
-	    case CAIRO_SUBPIXEL_ORDER_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
-		vmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
-		height /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
-	    /*
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
-	     * Filter the glyph to soften the color fringes
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
-	     */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
-	    width_rgba = width;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+	    /* if we get there, the  data from the source bitmap
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+	     * really comes from _fill_xrender_bitmap, and is
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+	     * made of 32-bit ARGB or ABGR values */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+	    assert (own_buffer != 0);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   625
+	    assert (bitmap->pixel_mode != FT_PIXEL_MODE_GRAY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   626
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+	    data = bitmap->buffer;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   628
 	    stride = bitmap->pitch;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   629
-	    stride_rgba = (width_rgba * 4 + 3) & ~3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   630
-	    data_rgba = calloc (stride_rgba, height);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
-	    if (unlikely (data_rgba == NULL)) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
-		if (own_buffer)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
-		    free (bitmap->buffer);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
-		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
-	    os = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
-	    switch (font_options->subpixel_order) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
-	    case CAIRO_SUBPIXEL_ORDER_VRGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
-		os = stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
-	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
-	    case CAIRO_SUBPIXEL_ORDER_RGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
-		rf = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
-		gf = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
-		bf = 2;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
-	    case CAIRO_SUBPIXEL_ORDER_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
-		os = stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
-	    case CAIRO_SUBPIXEL_ORDER_BGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
-		bf = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
-		gf = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
-		rf = 2;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
-	    in_line = bitmap->buffer;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
-	    out_line = data_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
-	    for (y = 0; y < height; y++)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
-	    {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
-		in = in_line;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
-		out = (unsigned int *) out_line;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
-		in_line += stride * vmul;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
-		out_line += stride_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
-		for (x = 0; x < width * hmul; x += hmul)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
-		{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
-		    red = green = blue = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
-		    o = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
-		    for (s = 0; s < 3; s++)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
-		    {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
-			red += filters[rf][s]*in[x+o];
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
-			green += filters[gf][s]*in[x+o];
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
-			blue += filters[bf][s]*in[x+o];
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
-			o += os;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
-		    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
-		    red = red / 65536;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
-		    green = green / 65536;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
-		    blue = blue / 65536;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
-		    *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   679
-		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   681
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
-	    /* Images here are stored in native format. The
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
-	     * backend must convert to its own format as needed
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
-	     */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   686
-	    if (own_buffer)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
-		free (bitmap->buffer);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
-	    data = data_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
-	    stride = stride_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
 	    format = CAIRO_FORMAT_ARGB32;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
-	    subpixel = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
-	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   693
-	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   694
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   695
 	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   696
     case FT_PIXEL_MODE_GRAY2:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   697
     case FT_PIXEL_MODE_GRAY4:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   698
 	/* These could be triggered by very rare types of TrueType fonts */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
     default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
 	if (own_buffer)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
 	    free (bitmap->buffer);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
 	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
-    *surface = (cairo_image_surface_t *)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   706
+    /* XXX */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   707
+    *surface = image = (cairo_image_surface_t *)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   708
 	cairo_image_surface_create_for_data (data,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
 					     format,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   710
 					     width, height, stride);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
-    if ((*surface)->base.status) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
+    if (image->base.status) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   713
 	free (data);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   714
 	return (*surface)->base.status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   715
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   716
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
-    if (subpixel)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
-	pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   719
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
-    _cairo_image_surface_assume_ownership_of_data ((*surface));
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   721
+    if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
+	pixman_image_set_component_alpha (image->pixman_image, TRUE);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   724
+    _cairo_image_surface_assume_ownership_of_data (image);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   725
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   726
     _cairo_debug_check_image_surface_is_defined (&(*surface)->base);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   727
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   728
     return CAIRO_STATUS_SUCCESS;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   729
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   730
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   731
 /* Converts an outline FT_GlyphSlot into an image
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   732
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   733
@@ -1022,129 +1216,169 @@ _get_bitmap_surface (FT_Bitmap		     *bi
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
  * when we add subpixel support. If so, we may want to eliminate
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   735
  * this version of the code path entirely.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   736
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   737
 static cairo_status_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   738
 _render_glyph_outline (FT_Face                    face,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   739
 		       cairo_font_options_t	 *font_options,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   740
 		       cairo_image_surface_t	**surface)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   741
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   742
+    int rgba = FC_RGBA_UNKNOWN;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   743
+    int lcd_filter = FT_LCD_FILTER_LEGACY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   744
     FT_GlyphSlot glyphslot = face->glyph;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   745
     FT_Outline *outline = &glyphslot->outline;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   746
     FT_Bitmap bitmap;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   747
     FT_BBox cbox;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   748
-    FT_Matrix matrix;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   749
-    int hmul = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   750
-    int vmul = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
-    unsigned int width, height, stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   752
-    cairo_bool_t subpixel = FALSE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   753
+    unsigned int width, height;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
     cairo_status_t status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+    FT_Error fterror;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+    FT_Library library = glyphslot->library;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   757
+    FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   758
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   759
+    switch (font_options->antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
+    case CAIRO_ANTIALIAS_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
+	render_mode = FT_RENDER_MODE_MONO;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   762
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   763
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   764
+    case CAIRO_ANTIALIAS_SUBPIXEL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   765
+	switch (font_options->subpixel_order) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
+	    case CAIRO_SUBPIXEL_ORDER_RGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
+	    case CAIRO_SUBPIXEL_ORDER_BGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
+		render_mode = FT_RENDER_MODE_LCD;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
+	    case CAIRO_SUBPIXEL_ORDER_VRGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   773
+	    case CAIRO_SUBPIXEL_ORDER_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+		render_mode = FT_RENDER_MODE_LCD_V;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   775
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   776
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   777
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+	switch (font_options->lcd_filter) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   779
+	case CAIRO_LCD_FILTER_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
+	    lcd_filter = FT_LCD_FILTER_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   781
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   782
+	case CAIRO_LCD_FILTER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
+	case CAIRO_LCD_FILTER_INTRA_PIXEL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+	    lcd_filter = FT_LCD_FILTER_LEGACY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+	case CAIRO_LCD_FILTER_FIR3:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+	    lcd_filter = FT_LCD_FILTER_LIGHT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   789
+	case CAIRO_LCD_FILTER_FIR5:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
+	    lcd_filter = FT_LCD_FILTER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   791
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   792
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   793
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
+    case CAIRO_ANTIALIAS_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   797
+    case CAIRO_ANTIALIAS_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   798
+	render_mode = FT_RENDER_MODE_NORMAL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   799
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
     FT_Outline_Get_CBox (outline, &cbox);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
     cbox.xMin &= -64;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
     cbox.yMin &= -64;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   805
     cbox.xMax = (cbox.xMax + 63) & -64;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   806
     cbox.yMax = (cbox.yMax + 63) & -64;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   807
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   808
     width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   809
     height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   810
-    stride = (width * hmul + 3) & ~3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   811
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
     if (width * height == 0) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
 	cairo_format_t format;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   814
 	/* Looks like fb handles zero-sized images just fine */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
-	switch (font_options->antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
-	case CAIRO_ANTIALIAS_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   817
+	switch (render_mode) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
+	case FT_RENDER_MODE_MONO:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   819
 	    format = CAIRO_FORMAT_A1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   820
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   821
-	case CAIRO_ANTIALIAS_SUBPIXEL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   822
+	case FT_RENDER_MODE_LCD:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   823
+	case FT_RENDER_MODE_LCD_V:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   824
 	    format= CAIRO_FORMAT_ARGB32;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   825
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   826
-	case CAIRO_ANTIALIAS_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   827
-	case CAIRO_ANTIALIAS_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   828
+	case FT_RENDER_MODE_LIGHT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   829
+	case FT_RENDER_MODE_NORMAL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   830
+	case FT_RENDER_MODE_MAX:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   831
 	default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   832
 	    format = CAIRO_FORMAT_A8;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   833
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   835
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   836
 	(*surface) = (cairo_image_surface_t *)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
 	    cairo_image_surface_create_for_data (NULL, format, 0, 0, 0);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   838
 	if ((*surface)->base.status)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   839
 	    return (*surface)->base.status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
     } else  {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   841
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   842
-	matrix.xx = matrix.yy = 0x10000L;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   843
-	matrix.xy = matrix.yx = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   845
-	switch (font_options->antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   846
-	case CAIRO_ANTIALIAS_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   847
-	    bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   848
-	    bitmap.num_grays  = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
-	    stride = ((width + 31) & -32) >> 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   850
+	int bitmap_size;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
+	switch (render_mode) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   853
+	case FT_RENDER_MODE_LCD:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   854
+	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   855
+		rgba = FC_RGBA_BGR;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   856
+	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   857
+		rgba = FC_RGBA_RGB;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   858
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   859
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   860
-	case CAIRO_ANTIALIAS_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
-	case CAIRO_ANTIALIAS_GRAY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   862
-	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
-	    bitmap.num_grays  = 256;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   864
-	    stride = (width + 3) & -4;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   865
+	case FT_RENDER_MODE_LCD_V:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   866
+	    if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   867
+		rgba = FC_RGBA_VBGR;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   868
+	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   869
+		rgba = FC_RGBA_VRGB;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
-	case CAIRO_ANTIALIAS_SUBPIXEL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
-	    switch (font_options->subpixel_order) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
-	    case CAIRO_SUBPIXEL_ORDER_RGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   875
-	    case CAIRO_SUBPIXEL_ORDER_BGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
-	    case CAIRO_SUBPIXEL_ORDER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   877
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
-		matrix.xx *= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
-		hmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   880
-		subpixel = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
-	    case CAIRO_SUBPIXEL_ORDER_VRGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
-	    case CAIRO_SUBPIXEL_ORDER_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   884
-		matrix.yy *= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   885
-		vmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   886
-		subpixel = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   887
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   888
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
-	    FT_Outline_Transform (outline, &matrix);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
-	    bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
-	    bitmap.num_grays  = 256;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
-	    stride = (width * hmul + 3) & -4;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
+	case FT_RENDER_MODE_MONO:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
+	case FT_RENDER_MODE_LIGHT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   896
+	case FT_RENDER_MODE_NORMAL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   897
+	case FT_RENDER_MODE_MAX:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
+	default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
-	bitmap.pitch = stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
-	bitmap.width = width * hmul;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
-	bitmap.rows = height * vmul;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
-	bitmap.buffer = calloc (stride, bitmap.rows);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
+	FT_Library_SetLcdFilter (library, lcd_filter);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
+	fterror = FT_Render_Glyph (face->glyph, render_mode);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   910
+	FT_Library_SetLcdFilter (library, FT_LCD_FILTER_NONE);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+	if (fterror != 0)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+	bitmap_size = _compute_xrender_bitmap_size (&bitmap,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
+						    face->glyph,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
+						    render_mode);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
+	if (bitmap_size < 0)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
+	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   920
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
+	bitmap.buffer = calloc (1, bitmap_size);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
 	if (unlikely (bitmap.buffer == NULL))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
 	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   925
-	FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   926
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
-	if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
-	    free (bitmap.buffer);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
-	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
-	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
+	_fill_xrender_bitmap (&bitmap, face->glyph, render_mode,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+			      (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR));
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+	/* Note:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   936
+	 * _get_bitmap_surface will free bitmap.buffer if there is an error
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   937
+	 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   938
 	status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
 	if (unlikely (status))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   940
 	    return status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
+	/* Note: the font's coordinate system is upside down from ours, so the
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
+	 * Y coordinate of the control box needs to be negated.  Moreover, device
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
+	 * offsets are position of glyph origin relative to top left while xMin
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
+	 * and yMax are offsets of top left relative to origin.  Another negation.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
+	 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+	cairo_surface_set_device_offset (&(*surface)->base,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+					 (double)-glyphslot->bitmap_left,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+					 (double)+glyphslot->bitmap_top);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   951
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
-    /*
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
-     * Note: the font's coordinate system is upside down from ours, so the
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
-     * Y coordinate of the control box needs to be negated.  Moreover, device
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
-     * offsets are position of glyph origin relative to top left while xMin
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
-     * and yMax are offsets of top left relative to origin.  Another negation.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
-     */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
-    cairo_surface_set_device_offset (&(*surface)->base,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
-				     floor (-(double) cbox.xMin / 64.0),
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
-				     floor (+(double) cbox.yMax / 64.0));
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
     return CAIRO_STATUS_SUCCESS;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
 /* Converts a bitmap (or other) FT_GlyphSlot into an image */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
 static cairo_status_t
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
 _render_glyph_bitmap (FT_Face		      face,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
 		      cairo_font_options_t   *font_options,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
 		      cairo_image_surface_t **surface)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
@@ -1354,16 +1588,17 @@ _get_pattern_ft_options (FcPattern *patt
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
     /* disable antialiasing if requested */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
     if (FcPatternGetBool (pattern,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   974
 			  FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   975
 	antialias = FcTrue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   976
     
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
     if (antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   978
 	cairo_subpixel_order_t subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+	int lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
 	/* disable hinting if requested */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
 	if (FcPatternGetBool (pattern,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
 			      FC_HINTING, 0, &hinting) != FcResultMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
 	    hinting = FcTrue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
 	if (FcPatternGetInteger (pattern,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
 				 FC_RGBA, 0, &rgba) != FcResultMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
@@ -1389,16 +1624,35 @@ _get_pattern_ft_options (FcPattern *patt
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   990
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
 	if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   993
 	    ft_options.base.subpixel_order = subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
 	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   997
+	if (FcPatternGetInteger (pattern,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
+				 FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
+	    switch (lcd_filter) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+	    case FC_LCD_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+	    case FC_LCD_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+	    case FC_LCD_LIGHT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+	    case FC_LCD_LEGACY:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
 #ifdef FC_HINT_STYLE    
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
 	if (FcPatternGetInteger (pattern, 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
 				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
 	    hintstyle = FC_HINT_FULL;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
 	if (!hinting)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
 	    hintstyle = FC_HINT_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
@@ -1490,16 +1744,22 @@ _cairo_ft_options_merge (cairo_ft_option
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
     if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
 	options->base.hint_style = other->base.hint_style;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
     if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
 	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
+    if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
+	options->base.lcd_filter = other->base.lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
+    if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
+	options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
     if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
 	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
 	    load_flags |= FT_LOAD_NO_HINTING;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
 	else
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
 	    load_target = FT_LOAD_TARGET_MONO;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1044
 	load_flags |= FT_LOAD_MONOCHROME;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
     } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
 	switch (options->base.hint_style) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1047
@@ -1513,21 +1773,21 @@ _cairo_ft_options_merge (cairo_ft_option
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
 	case CAIRO_HINT_STYLE_FULL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1050
 	case CAIRO_HINT_STYLE_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
 	    if (options->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
 		switch (options->base.subpixel_order) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
 		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
 		case CAIRO_SUBPIXEL_ORDER_RGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
 		case CAIRO_SUBPIXEL_ORDER_BGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
-		    load_target |= FT_LOAD_TARGET_LCD;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+		    load_target = FT_LOAD_TARGET_LCD;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
 		    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
 		case CAIRO_SUBPIXEL_ORDER_VRGB:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
 		case CAIRO_SUBPIXEL_ORDER_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
-		    load_target |= FT_LOAD_TARGET_LCD_V;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+		    load_target = FT_LOAD_TARGET_LCD_V;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
 		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
 		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
 	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
     options->load_flags = load_flags | load_target;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
@@ -2510,16 +2770,44 @@ _cairo_ft_font_options_substitute (const
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
 		rgba = FC_RGBA_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1073
 	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1075
 	    if (! FcPatternAddInteger (pattern, FC_RGBA, rgba))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
 		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1077
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1079
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1080
+    if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1081
+    {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
+	if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1083
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
+	    int lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+	    switch (options->lcd_filter) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1087
+	    case CAIRO_LCD_FILTER_NONE:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1088
+		lcd_filter = FT_LCD_FILTER_NONE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1090
+	    case CAIRO_LCD_FILTER_DEFAULT:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+	    case CAIRO_LCD_FILTER_INTRA_PIXEL:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1092
+		lcd_filter = FT_LCD_FILTER_LEGACY;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
+	    case CAIRO_LCD_FILTER_FIR3:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
+		lcd_filter = FT_LCD_FILTER_LIGHT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+	    case CAIRO_LCD_FILTER_FIR5:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
+		lcd_filter = FT_LCD_FILTER_DEFAULT;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1101
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1103
+	    if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
+		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1105
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
     if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1109
     {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
 	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
 	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
 	    if (! FcPatternAddBool (pattern,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
 			            FC_HINTING,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
 				    options->hint_style != CAIRO_HINT_STYLE_NONE))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
 		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
diff --git a/gfx/cairo/cairo/src/cairo-surface.c b/gfx/cairo/cairo/src/cairo-surface.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
--- a/gfx/cairo/cairo/src/cairo-surface.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
+++ b/gfx/cairo/cairo/src/cairo-surface.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
@@ -60,16 +60,17 @@ const cairo_surface_t name = {					\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1120
     0.0,				/* y_fallback_resolution */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
     NULL,				/* clip */		\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
     0,					/* next_clip_serial */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
     0,					/* current_clip_serial */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
     FALSE,				/* is_snapshot */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
     FALSE,				/* has_font_options */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
     { CAIRO_ANTIALIAS_DEFAULT,		/* antialias */		\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
       CAIRO_SUBPIXEL_ORDER_DEFAULT,	/* subpixel_order */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+      CAIRO_LCD_FILTER_DEFAULT,		/* lcd_filter */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
       CAIRO_HINT_STYLE_DEFAULT,		/* hint_style */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
       CAIRO_HINT_METRICS_DEFAULT	/* hint_metrics */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
     }					/* font_options */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_NO_MEMORY, _cairo_surface_nil);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_CONTENT, _cairo_surface_nil_invalid_content);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_FORMAT, _cairo_surface_nil_invalid_format);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
diff --git a/gfx/cairo/cairo/src/cairo-types-private.h b/gfx/cairo/cairo/src/cairo-types-private.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
--- a/gfx/cairo/cairo/src/cairo-types-private.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+++ b/gfx/cairo/cairo/src/cairo-types-private.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
@@ -110,19 +110,45 @@ struct _cairo_array {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
     unsigned int size;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
     unsigned int num_elements;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
     unsigned int element_size;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
     char **elements;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
     cairo_bool_t is_snapshot;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+ * cairo_lcd_filter_t:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+ * @CAIRO_LCD_FILTER_DEFAULT: Use the default LCD filter for
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+ *   font backend and target device
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+ * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+ * @CAIRO_LCD_FILTER_INTRA_PIXEL: Intra-pixel filter
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+ * @CAIRO_LCD_FILTER_FIR3: FIR filter with a 3x3 kernel
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+ * @CAIRO_LCD_FILTER_FIR5: FIR filter with a 5x5 kernel
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+ * The LCD filter specifies the low-pass filter applied to LCD-optimized
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+ * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
+ * Note: This API was temporarily made available in the public
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+ * interface during the 1.7.x development series, but was made private
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+ * before 1.8.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+typedef enum _cairo_lcd_filter {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+    CAIRO_LCD_FILTER_DEFAULT,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+    CAIRO_LCD_FILTER_NONE,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+    CAIRO_LCD_FILTER_INTRA_PIXEL,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+    CAIRO_LCD_FILTER_FIR3,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+    CAIRO_LCD_FILTER_FIR5
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+} cairo_lcd_filter_t;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
 struct _cairo_font_options {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
     cairo_antialias_t antialias;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
     cairo_subpixel_order_t subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1177
+    cairo_lcd_filter_t lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
     cairo_hint_style_t hint_style;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1179
     cairo_hint_metrics_t hint_metrics;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1180
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1181
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1182
 typedef cairo_bool_t (*cairo_cache_predicate_func_t) (const void *entry);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1183
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1184
 struct _cairo_cache {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1185
     cairo_hash_table_t *hash_table;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1186
diff --git a/gfx/cairo/cairo/src/cairo-xlib-screen.c b/gfx/cairo/cairo/src/cairo-xlib-screen.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1187
--- a/gfx/cairo/cairo/src/cairo-xlib-screen.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1188
+++ b/gfx/cairo/cairo/src/cairo-xlib-screen.c
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1189
@@ -145,23 +145,32 @@ get_integer_default (Display    *dpy,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1190
 static void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1191
 _cairo_xlib_init_screen_font_options (Display *dpy,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1192
 				      cairo_xlib_screen_info_t *info)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1193
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1194
     cairo_bool_t xft_hinting;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1195
     cairo_bool_t xft_antialias;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1196
     int xft_hintstyle;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1197
     int xft_rgba;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1198
+    int xft_lcdfilter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1199
     cairo_antialias_t antialias;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1200
     cairo_subpixel_order_t subpixel_order;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1201
+    cairo_lcd_filter_t lcd_filter;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1202
     cairo_hint_style_t hint_style;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1203
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1204
     if (!get_boolean_default (dpy, "antialias", &xft_antialias))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1205
 	xft_antialias = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1206
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1207
+    if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1208
+	/* -1 is an non-existant Fontconfig constant used to differentiate
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1209
+	 * the case when no lcdfilter property is available.
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1210
+	 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1211
+	xft_lcdfilter = -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1212
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1213
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1214
     if (!get_boolean_default (dpy, "hinting", &xft_hinting))
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1215
 	xft_hinting = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1216
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer