blob: cab7e0c842003c7a3cac5825f7e1c1a46417818a [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ui.gni")
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
}
if (use_ozone) {
import("//ui/ozone/ozone.gni")
}
# Several targets want to include this header file, and some of them are
# child dependencies of "gfx". Therefore, we separate it out here so multiple
# targets can all have a dependency for header checking purposes without
# creating circular dependencies.
source_set("gfx_export") {
sources = [
"gfx_export.h",
]
}
component("gfx") {
sources = [
"android/device_display_info.cc",
"android/device_display_info.h",
"android/gfx_jni_registrar.cc",
"android/gfx_jni_registrar.h",
"android/java_bitmap.cc",
"android/java_bitmap.h",
"android/scroller.cc",
"android/scroller.h",
"android/shared_device_display_info.cc",
"android/shared_device_display_info.h",
"android/view_configuration.cc",
"android/view_configuration.h",
"animation/animation.cc",
"animation/animation.h",
"animation/animation_container.cc",
"animation/animation_container.h",
"animation/animation_container_element.h",
"animation/animation_container_observer.h",
"animation/animation_delegate.h",
"animation/linear_animation.cc",
"animation/linear_animation.h",
"animation/multi_animation.cc",
"animation/multi_animation.h",
"animation/slide_animation.cc",
"animation/slide_animation.h",
"animation/throb_animation.cc",
"animation/throb_animation.h",
"animation/tween.cc",
"animation/tween.h",
"blit.cc",
"blit.h",
"break_list.h",
"canvas.cc",
"canvas.h",
"canvas_android.cc",
"canvas_paint_mac.h",
"canvas_paint_mac.mm",
"canvas_paint_win.cc",
"canvas_paint_win.h",
"canvas_skia.cc",
"canvas_skia_paint.h",
"codec/jpeg_codec.cc",
"codec/jpeg_codec.h",
"codec/png_codec.cc",
"codec/png_codec.h",
"color_analysis.cc",
"color_analysis.h",
"color_profile.cc",
"color_profile.h",
"color_profile_mac.mm",
"color_profile_win.cc",
"color_utils.cc",
"color_utils.h",
"display.cc",
"display.h",
"display_change_notifier.cc",
"display_change_notifier.h",
"display_observer.cc",
"display_observer.h",
"favicon_size.cc",
"favicon_size.h",
"font.cc",
"font.h",
"font_fallback.h",
"font_fallback_linux.cc",
"font_fallback_mac.cc",
"font_fallback_win.cc",
"font_fallback_win.h",
"font_list.cc",
"font_list.h",
"font_list_impl.cc",
"font_list_impl.h",
"font_render_params_android.cc",
"font_render_params_linux.cc",
"font_render_params_win.cc",
"font_render_params.cc",
"font_render_params.h",
"frame_time.h",
"gdi_util.cc",
"gdi_util.h",
"gfx_paths.cc",
"gfx_paths.h",
"gpu_memory_buffer.cc",
"gpu_memory_buffer.h",
"icon_util.cc",
"icon_util.h",
"image/canvas_image_source.cc",
"image/canvas_image_source.h",
"image/image.cc",
"image/image.h",
"image/image_family.cc",
"image/image_family.h",
"image/image_ios.mm",
"image/image_mac.mm",
"image/image_png_rep.cc",
"image/image_png_rep.h",
"image/image_skia.cc",
"image/image_skia.h",
"image/image_skia_operations.cc",
"image/image_skia_operations.h",
"image/image_skia_rep.cc",
"image/image_skia_rep.h",
"image/image_skia_source.h",
"image/image_skia_util_ios.h",
"image/image_skia_util_ios.mm",
"image/image_skia_util_mac.h",
"image/image_skia_util_mac.mm",
"image/image_util.cc",
"image/image_util.h",
"image/image_util_ios.mm",
"interpolated_transform.cc",
"interpolated_transform.h",
"linux_font_delegate.cc",
"linux_font_delegate.h",
"mac/scoped_ns_disable_screen_updates.h",
"native_widget_types.h",
"nine_image_painter.cc",
"nine_image_painter.h",
"path.cc",
"path.h",
"path_aura.cc",
"path_win.cc",
"path_win.h",
"path_x11.cc",
"path_x11.h",
"platform_font.h",
"platform_font_android.cc",
"platform_font_ios.h",
"platform_font_ios.mm",
"platform_font_mac.h",
"platform_font_mac.mm",
"platform_font_win.cc",
"platform_font_win.h",
"range/range.cc",
"range/range.h",
"range/range_mac.mm",
"range/range_win.cc",
"scoped_canvas.h",
"scoped_cg_context_save_gstate_mac.h",
"scoped_ns_graphics_context_save_gstate_mac.h",
"scoped_ns_graphics_context_save_gstate_mac.mm",
"scoped_ui_graphics_push_context_ios.h",
"scoped_ui_graphics_push_context_ios.mm",
"screen.cc",
"screen.h",
"screen_android.cc",
"screen_aura.cc",
"screen_ios.mm",
"screen_mac.mm",
"screen_win.cc",
"screen_win.h",
"scrollbar_size.cc",
"scrollbar_size.h",
"selection_model.cc",
"selection_model.h",
"sequential_id_generator.cc",
"sequential_id_generator.h",
"shadow_value.cc",
"shadow_value.h",
"skbitmap_operations.cc",
"skbitmap_operations.h",
"skia_util.cc",
"skia_util.h",
"switches.cc",
"switches.h",
"sys_color_change_listener.cc",
"sys_color_change_listener.h",
"text_constants.h",
"text_elider.cc",
"text_elider.h",
"text_utils.cc",
"text_utils.h",
"text_utils_android.cc",
"text_utils_ios.mm",
"transform.cc",
"transform.h",
"transform_util.cc",
"transform_util.h",
"ui_gfx_exports.cc",
"utf16_indexing.cc",
"utf16_indexing.h",
"vsync_provider.h",
"win/dpi.cc",
"win/dpi.h",
"win/hwnd_util.cc",
"win/hwnd_util.h",
"win/scoped_set_map_mode.h",
"win/singleton_hwnd.cc",
"win/singleton_hwnd.h",
"win/window_impl.cc",
"win/window_impl.h",
]
defines = [ "GFX_IMPLEMENTATION" ]
deps = [
":gfx_export",
"//base",
"//base:i18n",
"//base:base_static",
"//base/third_party/dynamic_annotations",
"//skia",
"//third_party/harfbuzz-ng",
"//third_party/icu:icui18n",
"//third_party/icu:icuuc",
"//third_party/libpng",
"//third_party/zlib",
"//ui/gfx/geometry",
]
forward_dependent_configs_from = [ "//skia" ]
# Text rendering conditions (complicated so separated out).
if (is_android || is_ios) {
# We don't support RenderText on these platforms.
} else {
# These text rendering files are supported everywhere text rendering is.
sources += [
"render_text.cc",
"render_text.h",
"render_text_harfbuzz.cc",
"render_text_harfbuzz.h",
"text_utils_skia.cc",
]
# These are the "native" rendering routines, only one should apply.
if (is_win) {
sources += [ "render_text_win.cc" ]
} else if (is_mac) {
sources += [ "render_text_mac.cc" ]
} else if (use_pango) {
sources += [ "render_text_pango.cc" ]
} else if (use_ozone) {
sources += [ "render_text_ozone.cc" ]
}
}
# iOS.
if (is_ios) {
sources -= [
"codec/jpeg_codec.cc",
"codec/jpeg_codec.h",
]
} else {
deps += [ "//third_party:jpeg" ]
}
# Android.
if (is_android) {
sources -= [
"animation/throb_animation.cc",
"canvas_skia.cc",
"display_observer.cc",
"selection_model.cc",
]
if (use_aura) {
sources -= [ "screen_android.cc" ]
} else {
sources -= [ "path.cc" ]
}
# TODO(GYP) re-enable when base_java exists.
#if (!is_android_webview_build) {
# deps += [ "//base:base_java" ]
#}
deps += [ ":gfx_jni_headers" ]
libs = [
"android",
"jnigraphics",
]
}
# Windows.
if (is_win) {
cflags = [
"/wd4267", # TODO(jschuh): C4267: http://crbug.com/167187 size_t -> int.
"/wd4324", # Structure was padded due to __declspec(align()), which is
# uninteresting.
]
} else {
sources -= [
"gdi_util.cc",
"gdi_util.h",
"icon_util.cc",
"icon_util.h",
]
}
# Linux.
if (is_linux) {
configs += [ "//build/config/linux:fontconfig" ]
}
# Ozone stuff.
if (use_ozone) {
sources += [
"platform_font_ozone.cc",
"ozone/impl/file_surface_factory.cc",
"ozone/impl/file_surface_factory.h",
"ozone/surface_factory_ozone.cc",
"ozone/surface_factory_ozone.h",
"ozone/surface_ozone.h",
"ozone/overlay_candidates_ozone.cc",
"ozone/overlay_candidates_ozone.h",
]
}
if (!use_aura) {
sources -= [
"nine_image_painter.cc",
"nine_image_painter.h",
"path_aura.cc",
"screen_aura.cc",
]
}
if (use_x11) {
deps += [
"//ui/gfx/x",
]
} else {
sources -= [
"path_x11.cc",
]
}
if (use_pango) {
sources += [
"pango_util.cc",
"pango_util.h",
"platform_font_pango.cc",
"platform_font_pango.h",
]
configs += [ "//build/config/linux:pangocairo" ]
}
}
# Looking for gfx_geometry? It's //ui/gfx/geometry:geometry
source_set("test_support") {
sources = [
"test/fontconfig_util_linux.cc",
"test/fontconfig_util_linux.h",
"test/gfx_util.cc",
"test/gfx_util.h",
"test/ui_cocoa_test_helper.h",
"test/ui_cocoa_test_helper.mm",
]
deps = [
"//base",
"//base/test:test_support",
"//skia",
"//testing/gtest",
]
if (is_ios) {
# The cocoa files don't apply to iOS.
sources -= [
"test/ui_cocoa_test_helper.h",
"test/ui_cocoa_test_helper.mm",
]
}
if (is_linux) {
configs += [ "//build/config/linux:fontconfig" ]
}
}
test("gfx_unittests") {
sources = [
"geometry/box_unittest.cc",
"geometry/cubic_bezier_unittest.cc",
"geometry/insets_unittest.cc",
"geometry/matrix3_unittest.cc",
"geometry/point_unittest.cc",
"geometry/point3_unittest.cc",
"geometry/quad_unittest.cc",
"geometry/rect_unittest.cc",
"geometry/safe_integer_conversions_unittest.cc",
"geometry/size_unittest.cc",
"geometry/vector2d_unittest.cc",
"geometry/vector3d_unittest.cc",
"range/range_unittest.cc",
"test/run_all_unittests.cc",
]
deps = [
":gfx",
":test_support",
"//base",
"//base/test:test_support",
"//testing/gtest",
"//ui/base",
"//ui/gfx/geometry",
"//ui/resources:ui_test_pak",
]
if (use_pango) {
sources += [
"font_render_params_linux_unittest.cc",
"platform_font_pango_unittest.cc",
]
configs += [
"//build/config/linux:pangocairo",
"//build/config/linux:pangoft2",
]
}
}
if (is_android) {
generate_jni("gfx_jni_headers") {
sources = [
"../android/java/src/org/chromium/ui/gfx/BitmapHelper.java",
"../android/java/src/org/chromium/ui/gfx/DeviceDisplayInfo.java",
"../android/java/src/org/chromium/ui/gfx/ViewConfigurationHelper.java",
]
jni_package = "gfx"
}
}