1# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7EXPORTS.mozilla += [
8    "GenericRefCounted.h",
9]
10
11EXPORTS.mozilla.gfx += [
12    "2D.h",
13    "BaseCoord.h",
14    "BaseMargin.h",
15    "BasePoint.h",
16    "BasePoint3D.h",
17    "BasePoint4D.h",
18    "BaseRect.h",
19    "BaseSize.h",
20    "BezierUtils.h",
21    "Blur.h",
22    "BorrowedContext.h",
23    "Coord.h",
24    "CriticalSection.h",
25    "DataSurfaceHelpers.h",
26    "DrawEventRecorder.h",
27    "DrawTargetOffset.h",
28    "DrawTargetRecording.h",
29    "DrawTargetSkia.h",
30    "Filters.h",
31    "FontVariation.h",
32    "Helpers.h",
33    "HelpersCairo.h",
34    "InlineTranslator.h",
35    "IterableArena.h",
36    "Logging.h",
37    "LoggingConstants.h",
38    "Matrix.h",
39    "MatrixFwd.h",
40    "NumericTools.h",
41    "PathHelpers.h",
42    "PathSkia.h",
43    "PatternHelpers.h",
44    "Point.h",
45    "Polygon.h",
46    "Quaternion.h",
47    "RecordedEvent.h",
48    "RecordingTypes.h",
49    "Rect.h",
50    "RectAbsolute.h",
51    "Scale.h",
52    "ScaleFactor.h",
53    "ScaleFactors2D.h",
54    "SourceSurfaceCairo.h",
55    "SourceSurfaceRawData.h",
56    "StackArray.h",
57    "Swizzle.h",
58    "Tools.h",
59    "Triangle.h",
60    "Types.h",
61    "UserData.h",
62]
63
64EXPORTS.mozilla.gfx += ["ssse3-scaler.h"]
65
66if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
67    EXPORTS.mozilla.gfx += [
68        "MacIOSurface.h",
69        "UnscaledFontMac.h",
70    ]
71    UNIFIED_SOURCES += [
72        "NativeFontResourceMac.cpp",
73        "ScaledFontMac.cpp",
74    ]
75elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
76    EXPORTS.mozilla.gfx += [
77        "dw-extra.h",
78        "DWriteSettings.h",
79        "UnscaledFontDWrite.h",
80        "UnscaledFontGDI.h",
81    ]
82    SOURCES += [
83        "ConicGradientEffectD2D1.cpp",
84        "DrawTargetD2D1.cpp",
85        "DWriteSettings.cpp",
86        "ExtendInputEffectD2D1.cpp",
87        "FilterNodeD2D1.cpp",
88        "NativeFontResourceDWrite.cpp",
89        "NativeFontResourceGDI.cpp",
90        "PathD2D.cpp",
91        "RadialGradientEffectD2D1.cpp",
92        "ScaledFontDWrite.cpp",
93        "ScaledFontWin.cpp",
94        "SourceSurfaceD2D1.cpp",
95    ]
96    DEFINES["WIN32"] = True
97
98if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):
99    EXPORTS.mozilla.gfx += [
100        "UnscaledFontFreeType.h",
101    ]
102    SOURCES += [
103        "NativeFontResourceFreeType.cpp",
104        "UnscaledFontFreeType.cpp",
105    ]
106
107if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
108    SOURCES += [
109        "ScaledFontFontconfig.cpp",
110    ]
111
112if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
113    SOURCES += [
114        "ScaledFontFreeType.cpp",
115    ]
116
117SOURCES += [
118    "ConvolutionFilter.cpp",
119    "DrawTargetSkia.cpp",
120    "PathSkia.cpp",
121    "SourceSurfaceSkia.cpp",
122]
123if CONFIG["CC_TYPE"] == "clang":
124    # Suppress warnings from Skia header files.
125    SOURCES["DrawTargetSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
126    SOURCES["PathSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
127    SOURCES["SourceSurfaceSkia.cpp"].flags += ["-Wno-implicit-fallthrough"]
128EXPORTS.mozilla.gfx += [
129    "ConvolutionFilter.h",
130    "HelpersSkia.h",
131]
132
133# Are we targeting x86 or x64?  If so, build SSE2 files.
134if CONFIG["INTEL_ARCHITECTURE"]:
135    SOURCES += [
136        "BlurSSE2.cpp",
137        "FilterProcessingSSE2.cpp",
138        "ImageScalingSSE2.cpp",
139        "ssse3-scaler.c",
140        "SwizzleAVX2.cpp",
141        "SwizzleSSE2.cpp",
142        "SwizzleSSSE3.cpp",
143    ]
144    DEFINES["USE_SSE2"] = True
145    # The file uses SSE2 intrinsics, so it needs special compile flags on some
146    # compilers.
147    SOURCES["BlurSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
148    SOURCES["FilterProcessingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
149    SOURCES["ImageScalingSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
150    SOURCES["SwizzleAVX2.cpp"].flags += ["-mavx2"]
151    SOURCES["SwizzleSSE2.cpp"].flags += CONFIG["SSE2_FLAGS"]
152    SOURCES["SwizzleSSSE3.cpp"].flags += CONFIG["SSSE3_FLAGS"]
153    SOURCES["ssse3-scaler.c"].flags += CONFIG["SSSE3_FLAGS"]
154elif CONFIG["CPU_ARCH"].startswith("mips"):
155    SOURCES += [
156        "BlurLS3.cpp",
157    ]
158
159UNIFIED_SOURCES += [
160    "BezierUtils.cpp",
161    "Blur.cpp",
162    "BufferEdgePad.cpp",
163    "BufferUnrotate.cpp",
164    "DataSourceSurface.cpp",
165    "DataSurfaceHelpers.cpp",
166    "DrawEventRecorder.cpp",
167    "DrawTarget.cpp",
168    "DrawTargetCairo.cpp",
169    "DrawTargetOffset.cpp",
170    "DrawTargetRecording.cpp",
171    "FilterNodeSoftware.cpp",
172    "FilterProcessing.cpp",
173    "FilterProcessingScalar.cpp",
174    "ImageScaling.cpp",
175    "Matrix.cpp",
176    "NativeFontResource.cpp",
177    "Path.cpp",
178    "PathCairo.cpp",
179    "PathHelpers.cpp",
180    "PathRecording.cpp",
181    "Quaternion.cpp",
182    "RecordedEvent.cpp",
183    "Scale.cpp",
184    "ScaledFontBase.cpp",
185    "SFNTData.cpp",
186    "SourceSurfaceCairo.cpp",
187    "SourceSurfaceRawData.cpp",
188    "Swizzle.cpp",
189    "Types.cpp",
190]
191
192SOURCES += [
193    "Factory.cpp",  # Need to suppress warnings in Skia header files.
194    "InlineTranslator.cpp",
195]
196
197if CONFIG["CC_TYPE"] == "clang":
198    SOURCES["Factory.cpp"].flags += ["-Wno-implicit-fallthrough"]
199
200if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
201    EXPORTS.mozilla.gfx += [
202        "QuartzSupport.h",
203    ]
204    SOURCES += [
205        "MacIOSurface.cpp",
206        "QuartzSupport.mm",
207    ]
208
209if CONFIG["CPU_ARCH"] == "aarch64" or CONFIG["BUILD_ARM_NEON"]:
210    SOURCES += [
211        "BlurNEON.cpp",
212        "LuminanceNEON.cpp",
213        "SwizzleNEON.cpp",
214    ]
215    DEFINES["USE_NEON"] = True
216    SOURCES["BlurNEON.cpp"].flags += CONFIG["NEON_FLAGS"]
217    SOURCES["LuminanceNEON.cpp"].flags += CONFIG["NEON_FLAGS"]
218    SOURCES["SwizzleNEON.cpp"].flags += CONFIG["NEON_FLAGS"]
219
220include("/ipc/chromium/chromium-config.mozbuild")
221
222FINAL_LIBRARY = "xul"
223
224for var in ("USE_CAIRO", "MOZ2D_HAS_MOZ_CAIRO"):
225    DEFINES[var] = True
226
227if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):
228    DEFINES["MOZ_ENABLE_FREETYPE"] = True
229
230CXXFLAGS += ["-Werror=switch"]
231
232if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("android", "gtk"):
233    CXXFLAGS += CONFIG["CAIRO_FT_CFLAGS"]
234
235LOCAL_INCLUDES += CONFIG["SKIA_INCLUDES"]
236LOCAL_INCLUDES += [
237    "/gfx/cairo/cairo/src",
238]
239