1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import("//build/config/ui.gni") 6 7 if (is_android) { 8 import("//build/config/android/config.gni") 9 import("//build/config/android/rules.gni") 10 } 11 if (use_ozone) { 12 import("//ui/ozone/ozone.gni") 13 } 14 15 # Several targets want to include this header file, and some of them are 16 # child dependencies of "gfx". Therefore, we separate it out here so multiple 17 # targets can all have a dependency for header checking purposes without 18 # creating circular dependencies. 19 source_set("gfx_export") { 20 sources = [ 21 "gfx_export.h", 22 ] 23 } 24 25 component("gfx") { 26 sources = [ 27 "android/device_display_info.cc", 28 "android/device_display_info.h", 29 "android/gfx_jni_registrar.cc", 30 "android/gfx_jni_registrar.h", 31 "android/java_bitmap.cc", 32 "android/java_bitmap.h", 33 "android/scroller.cc", 34 "android/scroller.h", 35 "android/shared_device_display_info.cc", 36 "android/shared_device_display_info.h", 37 "android/view_configuration.cc", 38 "android/view_configuration.h", 39 "animation/animation.cc", 40 "animation/animation.h", 41 "animation/animation_container.cc", 42 "animation/animation_container.h", 43 "animation/animation_container_element.h", 44 "animation/animation_container_observer.h", 45 "animation/animation_delegate.h", 46 "animation/linear_animation.cc", 47 "animation/linear_animation.h", 48 "animation/multi_animation.cc", 49 "animation/multi_animation.h", 50 "animation/slide_animation.cc", 51 "animation/slide_animation.h", 52 "animation/throb_animation.cc", 53 "animation/throb_animation.h", 54 "animation/tween.cc", 55 "animation/tween.h", 56 "blit.cc", 57 "blit.h", 58 "break_list.h", 59 "canvas.cc", 60 "canvas.h", 61 "canvas_android.cc", 62 "canvas_paint_mac.h", 63 "canvas_paint_mac.mm", 64 "canvas_paint_win.cc", 65 "canvas_paint_win.h", 66 "canvas_skia.cc", 67 "canvas_skia_paint.h", 68 "codec/jpeg_codec.cc", 69 "codec/jpeg_codec.h", 70 "codec/png_codec.cc", 71 "codec/png_codec.h", 72 "color_analysis.cc", 73 "color_analysis.h", 74 "color_profile.cc", 75 "color_profile.h", 76 "color_profile_mac.mm", 77 "color_profile_win.cc", 78 "color_utils.cc", 79 "color_utils.h", 80 "display.cc", 81 "display.h", 82 "display_observer.cc", 83 "display_observer.h", 84 "favicon_size.cc", 85 "favicon_size.h", 86 "font.cc", 87 "font.h", 88 "font_fallback_win.cc", 89 "font_fallback_win.h", 90 "font_list.cc", 91 "font_list.h", 92 "font_list_impl.cc", 93 "font_list_impl.h", 94 "font_render_params_android.cc", 95 "font_render_params_linux.cc", 96 "font_render_params_linux.h", 97 "font_smoothing_win.cc", 98 "font_smoothing_win.h", 99 "frame_time.h", 100 "gdi_util.cc", 101 "gdi_util.h", 102 "gfx_paths.cc", 103 "gfx_paths.h", 104 "gpu_memory_buffer.cc", 105 "gpu_memory_buffer.h", 106 "icon_util.cc", 107 "icon_util.h", 108 "image/canvas_image_source.cc", 109 "image/canvas_image_source.h", 110 "image/image.cc", 111 "image/image.h", 112 "image/image_family.cc", 113 "image/image_family.h", 114 "image/image_ios.mm", 115 "image/image_mac.mm", 116 "image/image_png_rep.cc", 117 "image/image_png_rep.h", 118 "image/image_skia.cc", 119 "image/image_skia.h", 120 "image/image_skia_operations.cc", 121 "image/image_skia_operations.h", 122 "image/image_skia_rep.cc", 123 "image/image_skia_rep.h", 124 "image/image_skia_source.h", 125 "image/image_skia_util_ios.h", 126 "image/image_skia_util_ios.mm", 127 "image/image_skia_util_mac.h", 128 "image/image_skia_util_mac.mm", 129 "image/image_util.cc", 130 "image/image_util.h", 131 "image/image_util_ios.mm", 132 "interpolated_transform.cc", 133 "interpolated_transform.h", 134 "linux_font_delegate.cc", 135 "linux_font_delegate.h", 136 "mac/scoped_ns_disable_screen_updates.h", 137 "native_widget_types.h", 138 "nine_image_painter.cc", 139 "nine_image_painter.h", 140 "path.cc", 141 "path.h", 142 "path_aura.cc", 143 "path_win.cc", 144 "path_win.h", 145 "path_x11.cc", 146 "path_x11.h", 147 "platform_font.h", 148 "platform_font_android.cc", 149 "platform_font_ios.h", 150 "platform_font_ios.mm", 151 "platform_font_mac.h", 152 "platform_font_mac.mm", 153 "platform_font_win.cc", 154 "platform_font_win.h", 155 "range/range.cc", 156 "range/range.h", 157 "range/range_mac.mm", 158 "range/range_win.cc", 159 "scoped_canvas.h", 160 "scoped_cg_context_save_gstate_mac.h", 161 "scoped_ns_graphics_context_save_gstate_mac.h", 162 "scoped_ns_graphics_context_save_gstate_mac.mm", 163 "scoped_ui_graphics_push_context_ios.h", 164 "scoped_ui_graphics_push_context_ios.mm", 165 "screen.cc", 166 "screen.h", 167 "screen_android.cc", 168 "screen_aura.cc", 169 "screen_ios.mm", 170 "screen_mac.mm", 171 "screen_win.cc", 172 "screen_win.h", 173 "scrollbar_size.cc", 174 "scrollbar_size.h", 175 "selection_model.cc", 176 "selection_model.h", 177 "sequential_id_generator.cc", 178 "sequential_id_generator.h", 179 "shadow_value.cc", 180 "shadow_value.h", 181 "skbitmap_operations.cc", 182 "skbitmap_operations.h", 183 "skia_util.cc", 184 "skia_util.h", 185 "switches.cc", 186 "switches.h", 187 "sys_color_change_listener.cc", 188 "sys_color_change_listener.h", 189 "text_constants.h", 190 "text_elider.cc", 191 "text_elider.h", 192 "text_utils.cc", 193 "text_utils.h", 194 "text_utils_android.cc", 195 "text_utils_ios.mm", 196 "transform.cc", 197 "transform.h", 198 "transform_util.cc", 199 "transform_util.h", 200 "ui_gfx_exports.cc", 201 "utf16_indexing.cc", 202 "utf16_indexing.h", 203 "vsync_provider.h", 204 "win/dpi.cc", 205 "win/dpi.h", 206 "win/hwnd_util.cc", 207 "win/hwnd_util.h", 208 "win/scoped_set_map_mode.h", 209 "win/singleton_hwnd.cc", 210 "win/singleton_hwnd.h", 211 "win/window_impl.cc", 212 "win/window_impl.h", 213 ] 214 215 defines = [ "GFX_IMPLEMENTATION" ] 216 217 deps = [ 218 ":gfx_export", 219 "//base", 220 "//base:i18n", 221 "//base:base_static", 222 "//base/third_party/dynamic_annotations", 223 "//skia", 224 "//third_party/harfbuzz-ng", 225 "//third_party/icu:icui18n", 226 "//third_party/icu:icuuc", 227 "//third_party/libpng", 228 "//third_party/zlib", 229 "//ui/gfx/geometry", 230 ] 231 232 # Text rendering conditions (complicated so separated out). 233 if (is_android || is_ios) { 234 # We don't support RenderText on these platforms. 235 } else { 236 # These text rendering files are supported everywhere text rendering is. 237 sources += [ 238 "render_text.cc", 239 "render_text.h", 240 "render_text_harfbuzz.cc", 241 "render_text_harfbuzz.h", 242 "text_utils_skia.cc", 243 ] 244 # These are the "native" rendering routines, only one should apply. 245 if (is_win) { 246 sources += [ "render_text_win.cc" ] 247 } else if (is_mac) { 248 sources += [ "render_text_mac.cc" ] 249 } else if (use_pango) { 250 sources += [ "render_text_pango.cc" ] 251 } else if (use_ozone) { 252 sources += [ "render_text_ozone.cc" ] 253 } 254 } 255 256 # iOS. 257 if (is_ios) { 258 sources -= [ 259 "codec/jpeg_codec.cc", 260 "codec/jpeg_codec.h", 261 ] 262 } else { 263 deps += [ "//third_party:jpeg" ] 264 } 265 266 # Android. 267 if (is_android) { 268 sources -= [ 269 "animation/throb_animation.cc", 270 "canvas_skia.cc", 271 "display_observer.cc", 272 "selection_model.cc", 273 ] 274 275 if (use_aura) { 276 sources -= [ "screen_android.cc" ] 277 } else { 278 sources -= [ "path.cc" ] 279 } 280 281 # TODO(GYP) re-enable when base_java exists. 282 #if (!is_android_webview_build) { 283 # deps += [ "//base:base_java" ] 284 #} 285 286 deps += [ ":gfx_jni_headers" ] 287 libs = [ 288 "android", 289 "jnigraphics", 290 ] 291 } 292 293 # Windows. 294 if (is_win) { 295 cflags = [ 296 "/wd4267", # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int. 297 "/wd4324", # Structure was padded due to __declspec(align()), which is 298 # uninteresting. 299 ] 300 } else { 301 sources -= [ 302 "gdi_util.cc", 303 "gdi_util.h", 304 "icon_util.cc", 305 "icon_util.h", 306 ] 307 } 308 309 # Linux. 310 if (is_linux) { 311 configs += [ "//build/config/linux:fontconfig" ] 312 } 313 314 # Ozone stuff. 315 if (use_ozone) { 316 sources += [ 317 "platform_font_ozone.cc", 318 "ozone/impl/file_surface_factory.cc", 319 "ozone/impl/file_surface_factory.h", 320 "ozone/surface_factory_ozone.cc", 321 "ozone/surface_factory_ozone.h", 322 "ozone/surface_ozone.h", 323 "ozone/overlay_candidates_ozone.cc", 324 "ozone/overlay_candidates_ozone.h", 325 ] 326 } 327 328 if (!use_aura) { 329 sources -= [ 330 "nine_image_painter.cc", 331 "nine_image_painter.h", 332 "path_aura.cc", 333 "screen_aura.cc", 334 ] 335 } 336 337 if (use_x11) { 338 deps += [ 339 ":gfx_x11", 340 ] 341 } else { 342 sources -= [ 343 "path_x11.cc", 344 ] 345 } 346 347 if (use_pango) { 348 sources += [ 349 "pango_util.cc", 350 "pango_util.h", 351 "platform_font_pango.cc", 352 "platform_font_pango.h", 353 ] 354 configs += [ "//build/config/linux:pangocairo" ] 355 } 356 } 357 358 # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry 359 360 source_set("gfx_test_support") { 361 sources = [ 362 "test/gfx_util.cc", 363 "test/gfx_util.h", 364 "test/ui_cocoa_test_helper.h", 365 "test/ui_cocoa_test_helper.mm", 366 ] 367 368 deps = [ 369 "//base", 370 "//base/test:test_support", 371 "//skia", 372 "//testing/gtest", 373 ] 374 375 if (is_ios) { 376 # The cocoa files don't apply to iOS. 377 sources -= [ 378 "test/ui_cocoa_test_helper.h", 379 "test/ui_cocoa_test_helper.mm", 380 ] 381 } 382 } 383 384 test("gfx_unittests") { 385 sources = [ 386 "geometry/box_unittest.cc", 387 "geometry/cubic_bezier_unittest.cc", 388 "geometry/insets_unittest.cc", 389 "geometry/matrix3_unittest.cc", 390 "geometry/point_unittest.cc", 391 "geometry/point3_unittest.cc", 392 "geometry/quad_unittest.cc", 393 "geometry/rect_unittest.cc", 394 "geometry/safe_integer_conversions_unittest.cc", 395 "geometry/size_unittest.cc", 396 "geometry/vector2d_unittest.cc", 397 "geometry/vector3d_unittest.cc", 398 "range/range_unittest.cc", 399 ] 400 401 deps = [ 402 ":gfx", 403 "//base", 404 "//base/test:run_all_unittests", 405 "//base/test:run_all_unittests", 406 "//testing/gtest", 407 "//ui/gfx/geometry", 408 ] 409 } 410 411 if (is_android) { 412 generate_jni("gfx_jni_headers") { 413 sources = [ 414 "../android/java/src/org/chromium/ui/gfx/BitmapHelper.java", 415 "../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java", 416 "../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java", 417 ] 418 jni_package = "gfx" 419 } 420 } 421 422 if (use_x11) { 423 component("gfx_x11") { 424 sources = [ 425 "x/x11_atom_cache.cc", 426 "x/x11_atom_cache.h", 427 "x/x11_connection.cc", 428 "x/x11_connection.h", 429 "x/x11_error_tracker.cc", 430 "x/x11_error_tracker.h", 431 "x/x11_switches.cc", 432 "x/x11_switches.h", 433 "x/x11_types.cc", 434 "x/x11_types.h", 435 ] 436 437 defines = [ "GFX_IMPLEMENTATION" ] 438 configs += [ "//build/config/linux:x11" ] 439 440 deps = [ 441 ":gfx_export", 442 "//base" 443 ] 444 } 445 } 446