mozilla-cairo-lcd.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 30 Mar 2011 11:21:12 +0200
changeset 251 4c9ebbedd59c
parent 237 676030198746
permissions -rw-r--r--
adopt patches to new base
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
     1
Description: Add a Cairo LCD filter to use FreeType LCD colour filtering features
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
     2
Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=404637
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
     3
Bug-Cairo: http://bugs.freedesktop.org/show_bug.cgi?id=10301
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
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
     6
--- 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
     7
+++ b/config/system-headers
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
     8
@@ -267,16 +267,17 @@ Font.h
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
 Fonts.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 fp.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 fpieee.h
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 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
    13
 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
    14
 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
    15
 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
    16
 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
    17
+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
    18
 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
    19
 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
    20
 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
    21
 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
    22
 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
    23
 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
    24
 FSp_fopen.h
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
    25
 fstream
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
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
    27
--- 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
    28
+++ 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
    29
@@ -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
    30
  *      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
    31
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
 #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
    34
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 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
    36
     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
    37
     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
    38
+    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
    39
     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
    40
     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
    41
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
  * _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
    45
  * @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
    46
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
  * 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
    48
  **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
 void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
 _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
    51
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
     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
    53
     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
    54
+    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
    55
     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
    56
     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
    57
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
 void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
 _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
    61
 			       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
    62
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
     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
    64
     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
    65
+    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
    66
     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
    67
     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
    68
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
  * 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
    72
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
  * 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
    74
@@ -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
    75
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
     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
    77
 	return;
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 (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
    80
 	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
    81
     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
    82
 	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
    83
+    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
    84
+	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
    85
     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
    86
 	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
    87
     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
    88
 	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
    89
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
 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
    91
 
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
@@ -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
    94
     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
    95
 	return FALSE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
     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
    98
 	return TRUE;
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
     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
   101
 	    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
   102
+	    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
   103
 	    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
   104
 	    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
   105
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 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
   107
 
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
  * 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
   110
  * @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
   111
@@ -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
   112
 unsigned long
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
 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
   114
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
     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
   116
 	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
   117
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
     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
   119
 	    (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
   120
-	    (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
   121
+	    (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
   122
+	    (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
   123
 	    (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
   124
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
 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
   126
 
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
  * 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
   129
  * @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
   130
  * @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
   131
@@ -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
   132
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
     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
   134
 	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
   135
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
     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
   137
 }
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
 /**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
+ * _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
   141
+ * @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
   142
+ * @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
   143
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
+ * 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
   145
+ * 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
   146
+ * 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
   147
+ * #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
   148
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
+ * 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
   150
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
+void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
+_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
   153
+				    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
   154
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
+    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
   156
+	return;
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
+    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
   159
+}
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
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
+ * _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
   163
+ * @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
   164
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
+ * 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
   166
+ * 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
   167
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
+ * 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
   169
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
+ * 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
   171
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
+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
   173
+_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
   174
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
+    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
   176
+	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
   177
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
+    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
   179
+}
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
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
  * 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
   183
  * @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
   184
  * @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
   185
  *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
  * 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
   187
  * 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
   188
  * 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
   189
  * 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
   190
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
   191
--- 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
   192
+++ 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
   193
@@ -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
   194
 #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
   195
 #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
   196
 #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
   197
 #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
   198
 #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
   199
 #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
   200
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
 
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_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
   203
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
+/* 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
   205
+#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
   206
+#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
   207
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+/* 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
   209
+#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
   210
+#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
   211
+#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
   212
+#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
   213
+#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
   214
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
+/* 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
   217
+#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
   218
+#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
   219
+#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
   220
+#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
   221
+#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
   222
+#endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
 #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
   225
 #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
   226
 #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
   227
 #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
   228
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
 /* 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
   230
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
 #define MAX_OPEN_FACES 10
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   232
@@ -774,45 +796,309 @@ _cairo_ft_unscaled_font_set_scale (cairo
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
 					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
   234
 	if (error)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
 	    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
   236
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
 
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_STATUS_SUCCESS;
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
-/* 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
   242
- * 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
   243
-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
   244
-    /* red */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
-#if 0
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
-    {    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
   247
-    /* green */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
-    {    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
   249
-    /* blue */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
-    {    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
   251
+/* 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
   252
+ * 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
   253
+ * 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
   254
+ * 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
   255
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
+ * 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
   257
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
+ * 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
   259
+ *          '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
   260
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
+ * 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
   262
+ *          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
   263
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
+ * 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
   265
+ *          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
   266
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
+ * 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
   268
+ * 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
   269
+ * 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
   270
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
+ * 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
   272
+ * 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
   273
+ */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
+static int
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
+_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
   276
+			     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
   277
+			     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
   278
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
+    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
   280
+    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
   281
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
+    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
   283
+	return -1;
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
+    /* 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
   286
+    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
   287
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
+    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
   289
+    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
   290
+    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
   291
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
+    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
   293
+    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
   294
+	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
   295
+	    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
   296
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
+	/* fall-through */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   299
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+    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
   301
+	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
   302
+	    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
   303
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+	    /* 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
   305
+	    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
   306
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+    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
   310
+	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
   311
+	    return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
+	/* 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
   314
+	width /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+	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
   316
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
+    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
   319
+	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
   320
+	    return -1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
+	/* 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
   323
+	height /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+	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
   325
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+    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
   328
+	return -1;
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
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+    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
   332
+    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
   333
+    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
   334
+    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
   335
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+    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
   337
+}
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
+/* 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
   340
+ * 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
   341
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
+ * 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
   343
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+ * 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
   345
+ *           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
   346
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
+ * 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
   348
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+ * 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
   350
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+ * 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
   352
+ */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+static void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+_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
   355
+		     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
   356
+		     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
   357
+		     int             bgr)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
+{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+    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
   360
+    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
   361
+    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
   362
+    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
   363
+    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
   364
+    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
   365
+    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
   366
+    int subpixel;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+    int h;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+    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
   370
+		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
   371
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+    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
   373
+	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
   374
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+    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
   376
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+    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
   378
+    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
   379
+	if (subpixel) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+	    /* 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
   381
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+	    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
   383
+		int x;
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 (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
   386
+		    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
   387
+			((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
   388
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
+	    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
   391
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+	} 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
   393
+	    /* 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
   394
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
+	    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
   396
+		int x;
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 (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
   399
+		    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
   400
+			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
   401
+		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+	    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
   404
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+	    /* 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
   407
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+	    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
   409
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+	    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
   411
+		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
   412
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+    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
   416
+	if (subpixel) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
+	    /* 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
   418
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+	    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
   420
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+		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
   422
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+		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
   424
+		    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
   425
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
+		    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
   427
+		    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
   428
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
+		    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
   430
+		}
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
+	    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
   433
+        } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+            /* 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
   435
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+            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
   437
+                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
   438
+        }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
+        break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
+    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
   442
+	if (!bgr) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
+	    /* 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
   444
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
+	    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
   446
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
+		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
   448
+		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
   449
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
+		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
   451
+		    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
   452
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
+		    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
   454
+			  ((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
   455
+			  ((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
   456
+			  ((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
   457
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
+		    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
   459
+		}
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
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
+	    /* 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
   463
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
+	    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
   465
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
+		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
   468
+		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
   469
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+		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
   471
+		    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
   472
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
+		    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
   474
+			  ((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
   475
+			  ((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
   476
+			  ((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
   477
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
+		    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
   479
+		}
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
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+	break;
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
+    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
   485
+	/* 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
   486
+	if (!bgr) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
+	    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
   489
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
+		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
   491
+		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
   492
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+		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
   494
+		    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
   495
+#if 1
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+		    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
   497
+			  ((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
   498
+			  ((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
   499
+			  0xFF000000 ;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+#else
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+		    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
   502
+			  ((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
   503
+			  ((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
   504
+			  ((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
   505
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
-    {    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
   507
-    /* green */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
-    {    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
   509
-    /* blue */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
-    {    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
   511
-};
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
+		    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
   513
+		}
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
+	} else {
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
+	    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
   518
+		int x;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+		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
   520
+		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
   521
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+		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
   523
+		    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
   524
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+		    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
   526
+			  ((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
   527
+			  ((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
   528
+			  ((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
   529
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+		    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
   531
+		}
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
+	}
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
 /* 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
   539
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
 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
   541
 _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
   542
 		     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
   543
 		     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
   544
 		     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
   545
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
     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
   547
     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
   548
     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
   549
+    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
   550
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
     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
   552
     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
   553
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
     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
   555
 	*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
   556
 	    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
   557
 	return (*surface)->base.status;
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   558
@@ -859,150 +1145,63 @@ _get_bitmap_surface (FT_Bitmap		     *bi
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
 #endif
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
 	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
   562
 	break;
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
     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
   565
     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
   566
     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
   567
-	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
   568
-	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
   569
-	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
   570
-	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
   571
-	default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
+        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
   573
 	    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
   574
 	    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
   575
 		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
   576
 	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
 		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
   578
 		if (!data)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
 		    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
   580
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
 		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
   582
 	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
 	    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
   584
-	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
-	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
   586
-	    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
   587
-	    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
   588
-	    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
   589
-	    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
   590
-	    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
   591
-	    int		    s;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
-	    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
   593
-	    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
   594
-	    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
   595
-	    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
   596
-	    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
   597
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
-	    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
   599
-	    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
   600
-	    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
   601
-	    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
   602
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
-		width /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
-		hmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
-	    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
   607
-	    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
   608
-		vmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
-		height /= 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
-	    /*
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
-	     * 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
   614
-	     */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
-	    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
   616
+	} else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+	    /* 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
   618
+	     * 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
   619
+	     * 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
   620
+	    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
   621
+	    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
   622
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+	    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
   624
 	    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
   625
-	    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
   626
-	    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
   627
-	    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
   628
-		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
   629
-		    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
   630
-		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
   631
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
-	    os = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
-	    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
   635
-	    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
   636
-		os = stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
-	    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
   638
-	    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
   639
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
-		rf = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
-		gf = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
-		bf = 2;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
-	    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
   645
-		os = stride;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
-	    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
   647
-		bf = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
-		gf = 1;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
-		rf = 2;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
-	    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
   653
-	    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
   654
-	    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
   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 = in_line;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
-		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
   658
-		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
   659
-		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
   660
-		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
   661
-		{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
-		    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
   663
-		    o = 0;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
-		    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
   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 += 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
   667
-			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
   668
-			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
   669
-			o += os;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
-		    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
-		    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
   672
-		    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
   673
-		    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
   674
-		    *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
   675
-		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
-	    /* 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
   679
-	     * 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
   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
-	    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
   683
-		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
   684
-	    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
   685
-	    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
   686
 	    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
   687
-	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
-	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
 	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
     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
   692
     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
   693
 	/* 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
   694
     default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   695
 	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
   696
 	    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
   697
 	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
   698
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
-    *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
   701
+    /* XXX */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
+    *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
   703
 	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
   704
 					     format,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
 					     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
   706
-    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
   707
+    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
   708
 	free (data);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
 	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
   710
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
-    _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
   713
+    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
   714
+	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
   715
+
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   716
+    _cairo_image_surface_assume_ownership_of_data ((image));
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
     _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
   719
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
     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
   721
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
 /* 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
   724
  *
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   725
@@ -1019,129 +1218,169 @@ _get_bitmap_surface (FT_Bitmap		     *bi
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   726
  * 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
   727
  * 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
   728
  */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   729
 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
   730
 _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
   731
 		       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
   732
 		       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
   733
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
+    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
   735
+    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
   736
     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
   737
     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
   738
     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
   739
     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
   740
-    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
   741
-    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
   742
-    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
   743
-    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
   744
-    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
   745
+    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
   746
     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
   747
+    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
   748
+    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
   749
+    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
   750
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
+    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
   752
+    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
   753
+	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
   754
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
+    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
   757
+	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
   758
+	    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
   759
+	    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
   760
+	    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
   761
+		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
   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_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
   765
+	    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
   766
+		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
   767
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
+	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
   771
+	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
   772
+	    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
   773
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+	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
   775
+	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
   776
+	    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
   777
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+	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
   779
+	    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
   780
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   781
+	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
   782
+	    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
   783
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+	break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+    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
   789
+    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
   790
+	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
   791
+    }
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
     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
   794
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
     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
   796
     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
   797
     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
   798
     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
   799
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
     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
   801
     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
   802
-    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
   803
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
     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
   805
 	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
   806
 	/* 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
   807
-	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
   808
-	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
   809
+	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
   810
+	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
   811
 	    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
   812
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
-	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
   814
+	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
   815
+	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
   816
 	    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
   817
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
-	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
   819
-	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
   820
+	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
   821
+	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
   822
+	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
   823
 	default:
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_A8;
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
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   827
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   828
 	(*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
   829
 	    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
   830
 	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
   831
 	    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
   832
     } else  {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   833
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
-	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
   835
-	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
   836
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
-	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
   838
-	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
   839
-	    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
   840
-	    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
   841
-	    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
   842
+	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
   843
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
+	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
   845
+	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
   846
+	    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
   847
+		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
   848
+	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
+		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
   850
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
-	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
   853
-	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
   854
-	    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
   855
-	    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
   856
-	    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
   857
+	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
   858
+	    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
   859
+		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
   860
+	    } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
+		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
   862
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   864
-	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
   865
-	    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
   866
-	    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
   867
-	    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
   868
-	    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
   869
-	    default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
-		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
   871
-		hmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
-		subpixel = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
-		break;
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_VRGB:
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_VBGR:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
-		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
   877
-		vmul = 3;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
-		subpixel = TRUE;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
-		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   880
-	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
-	    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
   882
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
-	    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
   884
-	    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
   885
-	    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
   886
+	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
   887
+	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
   888
+	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
   889
+	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
   890
+	default:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
-	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
   895
-	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
   896
-	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
   897
-	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
   898
+	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
   899
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
+	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
   901
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
+	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
   903
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+	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
   905
+	    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
   906
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
+	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
   908
+						    face->glyph,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
+						    render_mode);
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   910
+	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
   911
+	    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
   912
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+	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
   914
 	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
   915
 	    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
   916
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
-	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
   918
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
-	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
   920
-	    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
   921
-	    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
   922
-	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
+	_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
   925
+			      (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
   926
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
+	/* Note:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
+	 * _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
   929
+	 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
 	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
   931
 	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
   932
 	    return status;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+	/* 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
   935
+	 * 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
   936
+	 * 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
   937
+	 * 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
   938
+	 */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
+	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
   940
+					 (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
   941
+					 (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
   942
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
-    /*
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
-     * 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
   946
-     * 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
   947
-     * 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
   948
-     * 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
   949
-     */
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
-    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
   951
-				     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
   952
-				     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
   953
-
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
     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
   955
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
 /* 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
   958
 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
   959
 _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
   960
 		      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
   961
 		      cairo_image_surface_t **surface)
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   962
@@ -1350,16 +1589,17 @@ _get_pattern_ft_options (FcPattern *patt
121
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
     /* 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
   965
     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
   966
 			  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
   967
 	antialias = FcTrue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
     
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
     if (antialias) {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
 	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
   971
+	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
   972
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
 	/* 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
   974
 	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
   975
 			      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
   976
 	    hinting = FcTrue;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   978
 	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
   979
 				 FC_RGBA, 0, &rgba) != FcResultMatch)
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
   980
@@ -1385,16 +1625,35 @@ _get_pattern_ft_options (FcPattern *patt
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
 	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
   985
 	    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
   986
 	    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
   987
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
+	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
   990
+				 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
   991
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+	    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
   993
+	    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
   994
+		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
   995
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
+	    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
   997
+		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
   998
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
+	    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
  1000
+		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
  1001
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+	    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
  1003
+		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
  1004
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1008
 #ifdef FC_HINT_STYLE
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1009
 	if (FcPatternGetInteger (pattern,
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
 				 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
  1011
 	    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
  1012
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
 	if (!hinting)
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
 	    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
  1015
 
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1016
@@ -1486,16 +1745,22 @@ _cairo_ft_options_merge (cairo_ft_option
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
     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
  1020
 	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
  1021
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
     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
  1023
 	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
  1024
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
+    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
  1026
+	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
  1027
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
+    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
  1029
+	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
  1030
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
     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
  1032
 	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
  1033
 	    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
  1034
 	else
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
 	    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
  1036
 	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
  1037
     } else {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
 	switch (options->base.hint_style) {
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1039
@@ -1509,21 +1774,21 @@ _cairo_ft_options_merge (cairo_ft_option
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
 	    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
 	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
  1042
 	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
  1043
 	    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
  1044
 		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
  1045
 		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
  1046
 		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
  1047
 		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
  1048
-		    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
  1049
+		    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
  1050
 		    break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
 		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
  1052
 		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
  1053
-		    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
  1054
+		    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
  1055
 		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
 		}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
 	    }
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
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
     options->load_flags = load_flags | load_target;
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1063
@@ -2512,16 +2777,44 @@ _cairo_ft_font_options_substitute (const
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
 		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
  1065
 	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
 	    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
  1068
 		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
  1069
 	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
     }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
+    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
  1073
+    {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
+	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
  1075
+	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
+	    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
  1077
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
+	    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
  1079
+	    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
  1080
+		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
  1081
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
+	    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
  1083
+	    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
  1084
+		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
  1085
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
+	    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
  1087
+		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
  1088
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
+	    default:
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_FIR5:
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
+		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
  1092
+		break;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+	    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
+	    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
  1096
+		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
  1097
+	}
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+    }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
     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
  1101
     {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
 	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
  1103
 	{
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
 	    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
  1105
 			            FC_HINTING,
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
 				    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
  1107
 		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
  1108
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
  1109
--- 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
  1110
+++ b/gfx/cairo/cairo/src/cairo-surface.c
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1111
@@ -68,16 +68,17 @@ const cairo_surface_t name = {					\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1112
     NULL,				/* snapshot_detach */	\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1113
     { 0,	/* size */					\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1114
       0,	/* num_elements */				\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1115
       0,	/* element_size */				\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1116
       NULL,	/* elements */					\
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1117
     },					/* snapshots */		\
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
     { 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
  1119
       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
  1120
+      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
  1121
       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
  1122
       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
  1123
     }					/* font_options */	\
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
 }
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
 
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1126
 /* XXX error object! */
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1127
 
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
 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
  1129
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
  1130
--- 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
  1131
+++ b/gfx/cairo/cairo/src/cairo-types-private.h
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1132
@@ -112,19 +112,45 @@ struct _cairo_array {
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
     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
  1134
     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
  1135
     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
  1136
     char **elements;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
     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
  1139
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
 
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+/**
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+ * 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
  1144
+ * @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
  1145
+ *   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
  1146
+ * @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
  1147
+ * @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
  1148
+ * @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
  1149
+ * @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
  1150
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+ * 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
  1152
+ * 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
  1153
+ *
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+ * 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
  1155
+ * 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
  1156
+ * 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
  1157
+ **/
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+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
  1159
+    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
  1160
+    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
  1161
+    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
  1162
+    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
  1163
+    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
  1164
+} 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
  1165
+
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
 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
  1167
     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
  1168
     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
  1169
+    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
  1170
     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
  1171
     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
  1172
 };
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
 
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1174
 /* XXX: Right now, the _cairo_color structure puts unpremultiplied
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1175
    color in the doubles and premultiplied color in the shorts. Yes,
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1176
    this is crazy insane, (but at least we don't export this
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1177
    madness). I'm still working on a cleaner API, but in the meantime,
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
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
  1179
--- 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
  1180
+++ b/gfx/cairo/cairo/src/cairo-xlib-screen.c
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1181
@@ -56,16 +56,23 @@
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1182
 
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1183
 #include "cairo-xlib-private.h"
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1184
 #include "cairo-xlib-xrender-private.h"
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1185
 
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1186
 #include "cairo-xlib-surface-private.h"
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1187
 
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1188
 #include <fontconfig/fontconfig.h>
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1189
 
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1190
+#ifndef FC_LCD_NONE
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1191
+#define FC_LCD_NONE	0
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1192
+#define FC_LCD_DEFAULT	1
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1193
+#define FC_LCD_LIGHT	2
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1194
+#define FC_LCD_LEGACY	3
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1195
+#endif
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1196
+
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1197
 static int
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1198
 parse_boolean (const char *v)
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1199
 {
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1200
     char c0, c1;
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1201
 
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1202
     c0 = *v;
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1203
     if (c0 == 't' || c0 == 'T' || c0 == 'y' || c0 == 'Y' || c0 == '1')
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1204
 	return 1;
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1205
@@ -145,23 +152,32 @@ get_integer_default (Display    *dpy,
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1206
 static void
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1207
 _cairo_xlib_init_screen_font_options (Display *dpy,
237
676030198746 reapply mozilla-cairo-lcd.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents: 121
diff changeset
  1208
 				      cairo_xlib_screen_t *info)
121
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1209
 {
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply yet)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1210
     cairo_bool_t xft_hinting;
f5759aada90e add cairo lcd patch from 1.9.2 branch (doesn't apply y