diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-27 16:56:06 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-27 16:56:06 +0000 |
commit | 4ffa789e031a7f0c8345e56a3c0813cb148176b4 (patch) | |
tree | e80237b500780d6bfb663353121655c3ec0beb2c | |
parent | fc91f92efc008ec9efac09814f37b66cb580cbf5 (diff) | |
download | chromium_src-4ffa789e031a7f0c8345e56a3c0813cb148176b4.zip chromium_src-4ffa789e031a7f0c8345e56a3c0813cb148176b4.tar.gz chromium_src-4ffa789e031a7f0c8345e56a3c0813cb148176b4.tar.bz2 |
Remove last dependencies on ui/base from ui/gfx
BUG=103304
R=sky@chromium.org
Review URL: https://codereview.chromium.org/23498059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225722 0039d316-1c4b-4281-b951-d872f2087c98
104 files changed, 438 insertions, 383 deletions
diff --git a/ui/aura/test/test_aura_initializer.cc b/ui/aura/test/test_aura_initializer.cc index ebd8485..c336eb4 100644 --- a/ui/aura/test/test_aura_initializer.cc +++ b/ui/aura/test/test_aura_initializer.cc @@ -12,19 +12,15 @@ namespace aura { namespace test { TestAuraInitializer::TestAuraInitializer() { -#if defined(OS_LINUX) base::FilePath pak_file; PathService::Get(base::DIR_MODULE, &pak_file); pak_file = pak_file.Append(FILE_PATH_LITERAL( "aura_test_support_resources.pak")); ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); -#endif } TestAuraInitializer::~TestAuraInitializer() { -#if defined(OS_LINUX) ui::ResourceBundle::CleanupSharedInstance(); -#endif } } // namespace test diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 8d2815d..761aab8 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -41,6 +41,7 @@ #endif #if defined(OS_WIN) +#include "ui/base/win/dpi_setup.h" #include "ui/gfx/win/dpi.h" #endif @@ -562,6 +563,7 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) { if (base::mac::IsOSLionOrLater()) supported_scale_factors.push_back(SCALE_FACTOR_200P); #elif defined(OS_WIN) + ui::win::InitDeviceScaleFactor(); // Have high-DPI resources for 140% and 180% scaling on Windows based on // default scaling for Metro mode. Round to nearest supported scale in // all cases. diff --git a/ui/base/win/dpi_setup.cc b/ui/base/win/dpi_setup.cc new file mode 100644 index 0000000..b80b8126 --- /dev/null +++ b/ui/base/win/dpi_setup.cc @@ -0,0 +1,26 @@ +// Copyright (c) 2013 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. + +#include "ui/base/win/dpi_setup.h" + +#include "ui/base/layout.h" +#include "ui/gfx/display.h" +#include "ui/gfx/win/dpi.h" + +namespace ui { +namespace win { + +void InitDeviceScaleFactor() { + float scale = 1.0f; + if (gfx::IsHighDPIEnabled()) { + float scale = gfx::Display::HasForceDeviceScaleFactor() ? + gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale(); + // Quantize to nearest supported scale factor. + scale = ui::GetImageScale(ui::GetSupportedScaleFactor(scale)); + } + gfx::InitDeviceScaleFactor(scale); +} + +} // namespace win +} // namespace ui diff --git a/ui/base/win/dpi_setup.h b/ui/base/win/dpi_setup.h new file mode 100644 index 0000000..a885849 --- /dev/null +++ b/ui/base/win/dpi_setup.h @@ -0,0 +1,22 @@ +// Copyright (c) 2013 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. + +#ifndef UI_BASE_WIN_DPI_SETUP_H_ +#define UI_BASE_WIN_DPI_SETUP_H_ + +#include "ui/base/ui_export.h" + +namespace ui { +namespace win { + +// Initializes the device scale factor. If support is enabled, this will set +// the best available scale based on the screen's pixel density. This can be +// affected (overridden) by --force-device-scale-factor=x +// This function can be called only once for the lifetime of a process. +UI_EXPORT void InitDeviceScaleFactor(); + +} // namespace win +} // namespace ui + +#endif // UI_BASE_WIN_DPI_SETUP_H_ diff --git a/ui/base/win/foreground_helper.h b/ui/base/win/foreground_helper.h index e8101a0..a2d9ea2 100644 --- a/ui/base/win/foreground_helper.h +++ b/ui/base/win/foreground_helper.h @@ -6,6 +6,7 @@ #define UI_BASE_WIN_FOREGROUND_HELPER_H_ #include "base/logging.h" +#include "ui/base/ui_export.h" #include "ui/gfx/win/window_impl.h" namespace ui { diff --git a/ui/compositor/test/test_suite.cc b/ui/compositor/test/test_suite.cc index d6601b0..b811bfd 100644 --- a/ui/compositor/test/test_suite.cc +++ b/ui/compositor/test/test_suite.cc @@ -15,6 +15,10 @@ #include <X11/Xlib.h> #endif +#if defined(OS_WIN) +#include "ui/gfx/win/dpi.h" +#endif + namespace ui { namespace test { @@ -32,6 +36,10 @@ void CompositorTestSuite::Initialize() { gfx::RegisterPathProvider(); +#if defined(OS_WIN) + gfx::InitDeviceScaleFactor(1.0f); +#endif + message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); } diff --git a/ui/gfx/DEPS b/ui/gfx/DEPS index 6381715..07a2ea9 100644 --- a/ui/gfx/DEPS +++ b/ui/gfx/DEPS @@ -4,7 +4,5 @@ include_rules = [ "+skia/ext", "+third_party/angle", "+third_party/skia", - "+ui/base/ui_export.h", # TODO(beng): remove - "+ui/base/layout.h", # TODO(davemoore): remove "+ui/test/ui_unittests_resource.h", # TODO(beng): remove ] diff --git a/ui/gfx/android/device_display_info.h b/ui/gfx/android/device_display_info.h index 9f90f89..c989b98 100644 --- a/ui/gfx/android/device_display_info.h +++ b/ui/gfx/android/device_display_info.h @@ -16,7 +16,7 @@ namespace gfx { // Facilitates access to device information typically only // available using the Android SDK, including Display properties. -class UI_EXPORT DeviceDisplayInfo { +class GFX_EXPORT DeviceDisplayInfo { public: DeviceDisplayInfo(); ~DeviceDisplayInfo(); diff --git a/ui/gfx/android/java_bitmap.h b/ui/gfx/android/java_bitmap.h index 319ad79..9d1e443 100644 --- a/ui/gfx/android/java_bitmap.h +++ b/ui/gfx/android/java_bitmap.h @@ -17,7 +17,7 @@ namespace gfx { // This class wraps a JNI AndroidBitmap object to make it easier to use. It // handles locking and unlocking of the underlying pixels, along with wrapping // various JNI methods. -class UI_EXPORT JavaBitmap { +class GFX_EXPORT JavaBitmap { public: explicit JavaBitmap(jobject bitmap); ~JavaBitmap(); @@ -41,14 +41,15 @@ class UI_EXPORT JavaBitmap { DISALLOW_COPY_AND_ASSIGN(JavaBitmap); }; -UI_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( +GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( const SkBitmap* skbitmap); -UI_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); +GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(JavaBitmap& jbitmap); // If the resource loads successfully, it will be resized to |size|. // Note: If the source resource is smaller than |size|, quality may suffer. -UI_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, gfx::Size size); +GFX_EXPORT SkBitmap CreateSkBitmapFromResource(const char* name, + gfx::Size size); } // namespace gfx diff --git a/ui/gfx/blit.h b/ui/gfx/blit.h index f066817..af56636 100644 --- a/ui/gfx/blit.h +++ b/ui/gfx/blit.h @@ -17,35 +17,35 @@ class Rect; class Vector2d; // Blits a rectangle from the source context into the destination context. -UI_EXPORT void BlitContextToContext(NativeDrawingContext dst_context, +GFX_EXPORT void BlitContextToContext(NativeDrawingContext dst_context, + const Rect& dst_rect, + NativeDrawingContext src_context, + const Point& src_origin); + +// Blits a rectangle from the source context into the destination canvas. +GFX_EXPORT void BlitContextToCanvas(SkCanvas *dst_canvas, const Rect& dst_rect, NativeDrawingContext src_context, const Point& src_origin); -// Blits a rectangle from the source context into the destination canvas. -UI_EXPORT void BlitContextToCanvas(SkCanvas *dst_canvas, - const Rect& dst_rect, - NativeDrawingContext src_context, - const Point& src_origin); - // Blits a rectangle from the source canvas into the destination context. -UI_EXPORT void BlitCanvasToContext(NativeDrawingContext dst_context, +GFX_EXPORT void BlitCanvasToContext(NativeDrawingContext dst_context, + const Rect& dst_rect, + SkCanvas *src_canvas, + const Point& src_origin); + +// Blits a rectangle from the source canvas into the destination canvas. +GFX_EXPORT void BlitCanvasToCanvas(SkCanvas *dst_canvas, const Rect& dst_rect, SkCanvas *src_canvas, const Point& src_origin); -// Blits a rectangle from the source canvas into the destination canvas. -UI_EXPORT void BlitCanvasToCanvas(SkCanvas *dst_canvas, - const Rect& dst_rect, - SkCanvas *src_canvas, - const Point& src_origin); - // Scrolls the given subset of the given canvas by the given offset. // The canvas should not have a clip or a transform applied, since platforms // may implement those operations differently. -UI_EXPORT void ScrollCanvas(SkCanvas* canvas, - const Rect& clip, - const Vector2d& offset); +GFX_EXPORT void ScrollCanvas(SkCanvas* canvas, + const Rect& clip, + const Vector2d& offset); } // namespace gfx diff --git a/ui/gfx/box_f.h b/ui/gfx/box_f.h index 01063b1..fb2c191 100644 --- a/ui/gfx/box_f.h +++ b/ui/gfx/box_f.h @@ -12,7 +12,7 @@ namespace gfx { // A 3d version of gfx::RectF, with the positive z-axis pointed towards // the camera. -class UI_EXPORT BoxF { +class GFX_EXPORT BoxF { public: BoxF() : width_(0.f), @@ -101,7 +101,7 @@ class UI_EXPORT BoxF { float depth_; }; -UI_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b); +GFX_EXPORT BoxF UnionBoxes(const BoxF& a, const BoxF& b); inline BoxF ScaleBox(const BoxF& b, float x_scale, diff --git a/ui/gfx/canvas.h b/ui/gfx/canvas.h index d6479cc..9aa7a0a 100644 --- a/ui/gfx/canvas.h +++ b/ui/gfx/canvas.h @@ -38,7 +38,7 @@ class Transform; // source and destination colors are combined. Unless otherwise specified, // the variant that does not take a SkXfermode::Mode uses a transfer mode // of kSrcOver_Mode. -class UI_EXPORT Canvas { +class GFX_EXPORT Canvas { public: enum TruncateFadeMode { TruncateFadeTail, diff --git a/ui/gfx/canvas_paint.h b/ui/gfx/canvas_paint.h index 4ae8b7c..4d38df3 100644 --- a/ui/gfx/canvas_paint.h +++ b/ui/gfx/canvas_paint.h @@ -17,7 +17,7 @@ class CanvasPaint { public: // Creates a canvas that paints to |view| when it is destroyed. The canvas is // sized to the client area of |view|. - UI_EXPORT static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); + GFX_EXPORT static CanvasPaint* CreateCanvasPaint(gfx::NativeView view); virtual ~CanvasPaint() {} diff --git a/ui/gfx/canvas_paint_gtk.h b/ui/gfx/canvas_paint_gtk.h index 889f308..649407a 100644 --- a/ui/gfx/canvas_paint_gtk.h +++ b/ui/gfx/canvas_paint_gtk.h @@ -17,7 +17,7 @@ namespace gfx { // On construction, it will set up a context for painting into, and on // destruction, it will commit it to the GdkWindow. // Note: The created context is always inialized to (0, 0, 0, 0). -class UI_EXPORT CanvasSkiaPaint : public Canvas { +class GFX_EXPORT CanvasSkiaPaint : public Canvas { public: // This constructor assumes the result is opaque. explicit CanvasSkiaPaint(GdkEventExpose* event); diff --git a/ui/gfx/canvas_paint_mac.h b/ui/gfx/canvas_paint_mac.h index 16d7410..f3658c3 100644 --- a/ui/gfx/canvas_paint_mac.h +++ b/ui/gfx/canvas_paint_mac.h @@ -17,7 +17,7 @@ namespace gfx { // graphics context. On construction, it will set up a context for painting // into, and on destruction, it will commit it to the current context. // Note: The created context is always inialized to (0, 0, 0, 0). -class UI_EXPORT CanvasSkiaPaint : public Canvas { +class GFX_EXPORT CanvasSkiaPaint : public Canvas { public: // This constructor assumes the result is opaque. explicit CanvasSkiaPaint(NSRect dirtyRect); diff --git a/ui/gfx/canvas_paint_win.h b/ui/gfx/canvas_paint_win.h index c5d3aee..9028cba 100644 --- a/ui/gfx/canvas_paint_win.h +++ b/ui/gfx/canvas_paint_win.h @@ -33,7 +33,7 @@ namespace gfx { // return 0; // } // Note: The created context is always inialized to (0, 0, 0, 0). -class UI_EXPORT CanvasSkiaPaint : public Canvas { +class GFX_EXPORT CanvasSkiaPaint : public Canvas { public: // This constructor assumes the canvas is opaque. CanvasSkiaPaint(HWND hwnd, HDC dc, const PAINTSTRUCT& ps); diff --git a/ui/gfx/codec/jpeg_codec.h b/ui/gfx/codec/jpeg_codec.h index b6b7088..8219221 100644 --- a/ui/gfx/codec/jpeg_codec.h +++ b/ui/gfx/codec/jpeg_codec.h @@ -18,7 +18,7 @@ namespace gfx { // which has an inconvenient interface for callers. This is only used for UI // elements, WebKit has its own more complicated JPEG decoder which handles, // among other things, partially downloaded data. -class UI_EXPORT JPEGCodec { +class GFX_EXPORT JPEGCodec { public: enum ColorFormat { // 3 bytes per pixel (packed), in RGB order regardless of endianness. diff --git a/ui/gfx/codec/png_codec.h b/ui/gfx/codec/png_codec.h index 86f170d..dbb86a5 100644 --- a/ui/gfx/codec/png_codec.h +++ b/ui/gfx/codec/png_codec.h @@ -23,7 +23,7 @@ class Size; // isn't as robust as would be required for a browser (see Decode() for more). // WebKit has its own more complicated PNG decoder which handles, among other // things, partially downloaded data. -class UI_EXPORT PNGCodec { +class GFX_EXPORT PNGCodec { public: enum ColorFormat { // 3 bytes per pixel (packed), in RGB order regardless of endianness. @@ -43,7 +43,7 @@ class UI_EXPORT PNGCodec { }; // Represents a comment in the tEXt ancillary chunk of the png. - struct UI_EXPORT Comment { + struct GFX_EXPORT Comment { Comment(const std::string& k, const std::string& t); ~Comment(); diff --git a/ui/gfx/color_analysis.h b/ui/gfx/color_analysis.h index 797b4f9..dcbfabc 100644 --- a/ui/gfx/color_analysis.h +++ b/ui/gfx/color_analysis.h @@ -25,7 +25,7 @@ namespace color_utils { // Note: Samplers should be deterministic, as the same image may be analyzed // twice with two sampler instances and the results displayed side-by-side // to the user. -class UI_EXPORT KMeanImageSampler { +class GFX_EXPORT KMeanImageSampler { public: virtual int GetSample(int width, int height) = 0; @@ -35,7 +35,7 @@ class UI_EXPORT KMeanImageSampler { }; // This sampler will pick pixels from an evenly spaced grid. -class UI_EXPORT GridSampler : public KMeanImageSampler { +class GFX_EXPORT GridSampler : public KMeanImageSampler { public: GridSampler(); virtual ~GridSampler(); @@ -49,8 +49,8 @@ class UI_EXPORT GridSampler : public KMeanImageSampler { // Returns the color in an ARGB |image| that is closest in RGB-space to the // provided |color|. Exported for testing. -UI_EXPORT SkColor FindClosestColor(const uint8_t* image, int width, int height, - SkColor color); +GFX_EXPORT SkColor FindClosestColor(const uint8_t* image, int width, int height, + SkColor color); // Returns an SkColor that represents the calculated dominant color in the png. // This uses a KMean clustering algorithm to find clusters of pixel colors in @@ -89,7 +89,7 @@ UI_EXPORT SkColor FindClosestColor(const uint8_t* image, int width, int height, // // Note: Switching to HSV space did not improve the results of this algorithm // for typical favicon images. -UI_EXPORT SkColor CalculateKMeanColorOfPNG( +GFX_EXPORT SkColor CalculateKMeanColorOfPNG( scoped_refptr<base::RefCountedMemory> png, uint32_t darkness_limit, uint32_t brightness_limit, @@ -97,10 +97,10 @@ UI_EXPORT SkColor CalculateKMeanColorOfPNG( // Computes a dominant color for an SkBitmap using the above algorithm and // reasonable defaults for |darkness_limit|, |brightness_limit| and |sampler|. -UI_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap); +GFX_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap); // Compute color covariance matrix for the input bitmap. -UI_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap); +GFX_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap); // Apply a color reduction transform defined by |color_transform| vector to // |source_bitmap|. The result is put into |target_bitmap|, which is expected @@ -108,7 +108,7 @@ UI_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap); // If |fit_to_range|, result is transfored linearly to fit 0-0xFF range. // Otherwise, data is clipped. // Returns true if the target has been computed. -UI_EXPORT bool ApplyColorReduction(const SkBitmap& source_bitmap, +GFX_EXPORT bool ApplyColorReduction(const SkBitmap& source_bitmap, const gfx::Vector3dF& color_transform, bool fit_to_range, SkBitmap* target_bitmap); @@ -119,7 +119,7 @@ UI_EXPORT bool ApplyColorReduction(const SkBitmap& source_bitmap, // Returns true if the conversion succeeded. Note that there might be legitimate // reasons for the process to fail even if all input was correct. This is a // condition the caller must be able to handle. -UI_EXPORT bool ComputePrincipalComponentImage(const SkBitmap& source_bitmap, +GFX_EXPORT bool ComputePrincipalComponentImage(const SkBitmap& source_bitmap, SkBitmap* target_bitmap); } // namespace color_utils diff --git a/ui/gfx/color_profile.h b/ui/gfx/color_profile.h index 3a3f5b2..20a02bf 100644 --- a/ui/gfx/color_profile.h +++ b/ui/gfx/color_profile.h @@ -16,7 +16,7 @@ namespace gfx { static const size_t kMinProfileLength = 128; static const size_t kMaxProfileLength = 4 * 1024 * 1024; -class UI_EXPORT ColorProfile { +class GFX_EXPORT ColorProfile { public: // On Windows, this reads a file from disk so it shouldn't be run on the UI // or IO thread. @@ -32,7 +32,7 @@ class UI_EXPORT ColorProfile { }; // Loads the monitor color space if available. -UI_EXPORT void GetColorProfile(std::vector<char>* profile); +GFX_EXPORT void GetColorProfile(std::vector<char>* profile); } // namespace gfx diff --git a/ui/gfx/color_utils.h b/ui/gfx/color_utils.h index 440e382..2bf3bcd 100644 --- a/ui/gfx/color_utils.h +++ b/ui/gfx/color_utils.h @@ -20,14 +20,14 @@ struct HSL { double l; }; -UI_EXPORT unsigned char GetLuminanceForColor(SkColor color); +GFX_EXPORT unsigned char GetLuminanceForColor(SkColor color); // Calculated according to http://www.w3.org/TR/WCAG20/#relativeluminancedef -UI_EXPORT double RelativeLuminance(SkColor color); +GFX_EXPORT double RelativeLuminance(SkColor color); // Note: these transformations assume sRGB as the source color space -UI_EXPORT void SkColorToHSL(SkColor c, HSL* hsl); -UI_EXPORT SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); +GFX_EXPORT void SkColorToHSL(SkColor c, HSL* hsl); +GFX_EXPORT SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); // HSL-Shift an SkColor. The shift values are in the range of 0-1, with the // option to specify -1 for 'no change'. The shift values are defined as: @@ -43,7 +43,7 @@ UI_EXPORT SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha); // 0 = remove all lightness (make all pixels black). // 0.5 = leave unchanged. // 1 = full lightness (make all pixels white). -UI_EXPORT SkColor HSLShift(SkColor color, const HSL& shift); +GFX_EXPORT SkColor HSLShift(SkColor color, const HSL& shift); // Determine if a given alpha value is nearly completely transparent. bool IsColorCloseToTransparent(SkAlpha alpha); @@ -53,19 +53,19 @@ bool IsColorCloseToGrey(int r, int g, int b); // Builds a histogram based on the Y' of the Y'UV representation of // this image. -UI_EXPORT void BuildLumaHistogram(const SkBitmap& bitmap, int histogram[256]); +GFX_EXPORT void BuildLumaHistogram(const SkBitmap& bitmap, int histogram[256]); // Returns a blend of the supplied colors, ranging from |background| (for // |alpha| == 0) to |foreground| (for |alpha| == 255). The alpha channels of // the supplied colors are also taken into account, so the returned color may // be partially transparent. -UI_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background, - SkAlpha alpha); +GFX_EXPORT SkColor AlphaBlend(SkColor foreground, SkColor background, + SkAlpha alpha); // Makes a dark color lighter or a light color darker by blending |color| with // white or black depending on its current luminance. |alpha| controls the // amount of white or black that will be alpha-blended into |color|. -UI_EXPORT SkColor BlendTowardOppositeLuminance(SkColor color, SkAlpha alpha); +GFX_EXPORT SkColor BlendTowardOppositeLuminance(SkColor color, SkAlpha alpha); // Given an opaque foreground and background color, try to return a foreground // color that is "readable" over the background color by luma-inverting the @@ -76,13 +76,13 @@ UI_EXPORT SkColor BlendTowardOppositeLuminance(SkColor color, SkAlpha alpha); // // NOTE: This won't do anything but waste time if the supplied foreground color // has a luma value close to the midpoint (0.5 in the HSL representation). -UI_EXPORT SkColor GetReadableColor(SkColor foreground, SkColor background); +GFX_EXPORT SkColor GetReadableColor(SkColor foreground, SkColor background); // Invert a color. -UI_EXPORT SkColor InvertColor(SkColor color); +GFX_EXPORT SkColor InvertColor(SkColor color); // Gets a Windows system color as a SkColor -UI_EXPORT SkColor GetSysSkColor(int which); +GFX_EXPORT SkColor GetSysSkColor(int which); } // namespace color_utils diff --git a/ui/gfx/display.h b/ui/gfx/display.h index 17cedfe..324b961 100644 --- a/ui/gfx/display.h +++ b/ui/gfx/display.h @@ -20,7 +20,7 @@ namespace gfx { // system. For platforms that support DIP (density independent pixel), // |bounds()| and |work_area| will return values in DIP coordinate // system, not in backing pixels. -class UI_EXPORT Display { +class GFX_EXPORT Display { public: // Screen Rotation in clock-wise degrees. enum Rotation { diff --git a/ui/gfx/display_observer.h b/ui/gfx/display_observer.h index 1e7cd8c..ca97247 100644 --- a/ui/gfx/display_observer.h +++ b/ui/gfx/display_observer.h @@ -13,7 +13,7 @@ class Display; // Observers for display configuration changes. // TODO(oshima): consolidate |WorkAreaWatcherObserver| and // |DisplaySettingsProvier|. crbug.com/122863. -class UI_EXPORT DisplayObserver { +class GFX_EXPORT DisplayObserver { public: // Called when the |display|'s bound has changed. virtual void OnDisplayBoundsChanged(const Display& display) = 0; diff --git a/ui/gfx/favicon_size.h b/ui/gfx/favicon_size.h index ecab851..ad51a9b 100644 --- a/ui/gfx/favicon_size.h +++ b/ui/gfx/favicon_size.h @@ -10,12 +10,12 @@ namespace gfx { // Size (along each axis) of the favicon. -UI_EXPORT extern const int kFaviconSize; +GFX_EXPORT extern const int kFaviconSize; // If the width or height is bigger than the favicon size, a new width/height // is calculated and returned in width/height that maintains the aspect // ratio of the supplied values. -UI_EXPORT void CalculateFaviconTargetSize(int* width, int* height); +GFX_EXPORT void CalculateFaviconTargetSize(int* width, int* height); } // namespace gfx diff --git a/ui/gfx/font.h b/ui/gfx/font.h index dfbf410..5187ec4 100644 --- a/ui/gfx/font.h +++ b/ui/gfx/font.h @@ -18,7 +18,7 @@ class PlatformFont; // Font provides a wrapper around an underlying font. Copy and assignment // operators are explicitly allowed, and cheap. -class UI_EXPORT Font { +class GFX_EXPORT Font { public: // The following constants indicate the font style. enum FontStyle { diff --git a/ui/gfx/font_fallback_win.h b/ui/gfx/font_fallback_win.h index 7e206da..ee67571 100644 --- a/ui/gfx/font_fallback_win.h +++ b/ui/gfx/font_fallback_win.h @@ -20,20 +20,20 @@ namespace internal { // // Sets |filename| and |font_name| respectively. If a field is not present // or could not be parsed, the corresponding parameter will be cleared. -void UI_EXPORT ParseFontLinkEntry(const std::string& entry, +void GFX_EXPORT ParseFontLinkEntry(const std::string& entry, std::string* filename, std::string* font_name); // Parses a font |family| in the format "FamilyFoo & FamilyBar (TrueType)". // Splits by '&' and strips off the trailing parenthesized expression. -void UI_EXPORT ParseFontFamilyString(const std::string& family, +void GFX_EXPORT ParseFontFamilyString(const std::string& family, std::vector<std::string>* font_names); } // namespace internal // Iterator over linked fallback fonts for a given font. The linked font chain // comes from the Windows registry, but gets cached between uses. -class UI_EXPORT LinkedFontsIterator { +class GFX_EXPORT LinkedFontsIterator { public: // Instantiates the iterator over the linked font chain for |font|. The first // item will be |font| itself. diff --git a/ui/gfx/font_list.h b/ui/gfx/font_list.h index ae96251..96398a1 100644 --- a/ui/gfx/font_list.h +++ b/ui/gfx/font_list.h @@ -32,7 +32,7 @@ namespace gfx { // // FontList allows operator= since FontList is a data member type in RenderText, // and operator= is used in RenderText::SetFontList(). -class UI_EXPORT FontList { +class GFX_EXPORT FontList { public: // Creates a font list with a Font with default name and style. FontList(); diff --git a/ui/gfx/font_render_params_linux.h b/ui/gfx/font_render_params_linux.h index 9ba6ca9..ac8323c 100644 --- a/ui/gfx/font_render_params_linux.h +++ b/ui/gfx/font_render_params_linux.h @@ -10,7 +10,7 @@ namespace gfx { // A collection of parameters describing how text should be rendered on Linux. -struct UI_EXPORT FontRenderParams { +struct GFX_EXPORT FontRenderParams { // No constructor to avoid static initialization. // Level of hinting to be applied. @@ -54,16 +54,16 @@ struct UI_EXPORT FontRenderParams { }; // Returns the system's default parameters for font rendering. -UI_EXPORT const FontRenderParams& GetDefaultFontRenderParams(); +GFX_EXPORT const FontRenderParams& GetDefaultFontRenderParams(); // Returns the system's default parameters for WebKit font rendering. -UI_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams(); +GFX_EXPORT const FontRenderParams& GetDefaultWebKitFontRenderParams(); // Returns the system's default parameters for WebKit subpixel positioning. // Subpixel positioning is special since neither GTK nor FontConfig currently // track it as a preference. // See https://bugs.freedesktop.org/show_bug.cgi?id=50736 -UI_EXPORT bool GetDefaultWebkitSubpixelPositioning(); +GFX_EXPORT bool GetDefaultWebkitSubpixelPositioning(); } // namespace gfx diff --git a/ui/gfx/gdi_util.h b/ui/gfx/gdi_util.h index 53b6e91..d8563b6 100644 --- a/ui/gfx/gdi_util.h +++ b/ui/gfx/gdi_util.h @@ -15,7 +15,8 @@ namespace gfx { // Creates a BITMAPINFOHEADER structure given the bitmap's size. -UI_EXPORT void CreateBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); +GFX_EXPORT void CreateBitmapHeader(int width, int height, + BITMAPINFOHEADER* hdr); // Creates a BITMAPINFOHEADER structure given the bitmap's size and // color depth in bits per pixel. @@ -25,28 +26,29 @@ void CreateBitmapHeaderWithColorDepth(int width, int height, int color_depth, // Creates a BITMAPV4HEADER structure given the bitmap's size. You probably // only need to use BMP V4 if you need transparency (alpha channel). This // function sets the AlphaMask to 0xff000000. -UI_EXPORT void CreateBitmapV4Header(int width, int height, BITMAPV4HEADER* hdr); +GFX_EXPORT void CreateBitmapV4Header(int width, int height, + BITMAPV4HEADER* hdr); // Creates a monochrome bitmap header. void CreateMonochromeBitmapHeader(int width, int height, BITMAPINFOHEADER* hdr); // Modify the given hrgn by subtracting the given rectangles. -UI_EXPORT void SubtractRectanglesFromRegion( +GFX_EXPORT void SubtractRectanglesFromRegion( HRGN hrgn, const std::vector<gfx::Rect>& cutouts); -UI_EXPORT HRGN ConvertPathToHRGN(const gfx::Path& path); +GFX_EXPORT HRGN ConvertPathToHRGN(const gfx::Path& path); // Calculate scale to fit an entire page on DC. -UI_EXPORT double CalculatePageScale(HDC dc, int page_width, int page_height); +GFX_EXPORT double CalculatePageScale(HDC dc, int page_width, int page_height); // Apply scaling to the DC. -UI_EXPORT bool ScaleDC(HDC dc, double scale_factor); +GFX_EXPORT bool ScaleDC(HDC dc, double scale_factor); -UI_EXPORT void StretchDIBits(HDC hdc, - int dest_x, int dest_y, int dest_w, int dest_h, - int src_x, int src_y, int src_w, int src_h, - void* pixels, const BITMAPINFO* bitmap_info); +GFX_EXPORT void StretchDIBits(HDC hdc, + int dest_x, int dest_y, int dest_w, int dest_h, + int src_x, int src_y, int src_w, int src_h, + void* pixels, const BITMAPINFO* bitmap_info); } // namespace gfx diff --git a/ui/gfx/gfx_export.h b/ui/gfx/gfx_export.h index f610d98..a6aaf02 100644 --- a/ui/gfx/gfx_export.h +++ b/ui/gfx/gfx_export.h @@ -5,10 +5,6 @@ #ifndef UI_GFX_GFX_EXPORT_H_ #define UI_GFX_GFX_EXPORT_H_ -// TODO(beng): remove include once gfx dependencies have been corrected. - -#include "ui/base/ui_export.h" - #if defined(COMPONENT_BUILD) #if defined(WIN32) diff --git a/ui/gfx/gfx_paths.h b/ui/gfx/gfx_paths.h index d5eec96..7a779ed 100644 --- a/ui/gfx/gfx_paths.h +++ b/ui/gfx/gfx_paths.h @@ -22,7 +22,7 @@ enum { }; // Call once to register the provider for the path keys defined above. -UI_EXPORT void RegisterPathProvider(); +GFX_EXPORT void RegisterPathProvider(); } // namespace gfx diff --git a/ui/gfx/gpu_memory_buffer.h b/ui/gfx/gpu_memory_buffer.h index c600527..17bb669 100644 --- a/ui/gfx/gpu_memory_buffer.h +++ b/ui/gfx/gpu_memory_buffer.h @@ -47,7 +47,7 @@ struct GpuMemoryBufferHandle { // This interface is thread-safe. However, multiple threads mapping // a buffer for Write or ReadOrWrite simultaneously may result in undefined // behavior and is not allowed. -class UI_EXPORT GpuMemoryBuffer { +class GFX_EXPORT GpuMemoryBuffer { public: enum AccessMode { READ_ONLY, diff --git a/ui/gfx/gtk_native_view_id_manager.h b/ui/gfx/gtk_native_view_id_manager.h index 242cf09..4421920 100644 --- a/ui/gfx/gtk_native_view_id_manager.h +++ b/ui/gfx/gtk_native_view_id_manager.h @@ -31,7 +31,7 @@ struct _GtkPreserveWindow; // pointers and observes the various signals from the widget for when an X // window is created, destroyed etc. Thus it provides a thread safe mapping // from NativeViewIds to the current XID for that widget. -class UI_EXPORT GtkNativeViewManager { +class GFX_EXPORT GtkNativeViewManager { public: // Returns the singleton instance. static GtkNativeViewManager* GetInstance(); diff --git a/ui/gfx/gtk_preserve_window.h b/ui/gfx/gtk_preserve_window.h index f48be3f..5b5198b 100644 --- a/ui/gfx/gtk_preserve_window.h +++ b/ui/gfx/gtk_preserve_window.h @@ -46,25 +46,25 @@ struct _GtkPreserveWindowClass { GtkFixedClass parent_class; }; -UI_EXPORT GType gtk_preserve_window_get_type() G_GNUC_CONST; -UI_EXPORT GtkWidget* gtk_preserve_window_new(); +GFX_EXPORT GType gtk_preserve_window_get_type() G_GNUC_CONST; +GFX_EXPORT GtkWidget* gtk_preserve_window_new(); // Whether or not we should preserve associated windows as the widget // is realized or unrealized. -UI_EXPORT gboolean gtk_preserve_window_get_preserve(GtkPreserveWindow* widget); -UI_EXPORT void gtk_preserve_window_set_preserve(GtkPreserveWindow* widget, - gboolean value); +GFX_EXPORT gboolean gtk_preserve_window_get_preserve(GtkPreserveWindow* widget); +GFX_EXPORT void gtk_preserve_window_set_preserve(GtkPreserveWindow* widget, + gboolean value); // Whether or not someone else will gdk_window_resize the GdkWindow associated // with this widget (needed by the GPU process to synchronize resizing // with swapped between front and back buffer). -UI_EXPORT void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, - gboolean delegate); +GFX_EXPORT void gtk_preserve_window_delegate_resize(GtkPreserveWindow* widget, + gboolean delegate); // Provide a function to return an AtkObject* when calls to get_accessible // are made on this widget. The parameter |userdata| will be passed to the // factory function. -UI_EXPORT void gtk_preserve_window_set_accessible_factory( +GFX_EXPORT void gtk_preserve_window_set_accessible_factory( GtkPreserveWindow* widget, AtkObject* (*factory)(void* userdata), gpointer userdata); diff --git a/ui/gfx/gtk_util.h b/ui/gfx/gtk_util.h index 5672bbd..91f864b 100644 --- a/ui/gfx/gtk_util.h +++ b/ui/gfx/gtk_util.h @@ -24,28 +24,28 @@ class Rect; // Call gtk_init() / gdk_init() using the argc and argv from command_line. // These init functions want an argc and argv that they can mutate; we provide // those, but leave the original CommandLine unaltered. -UI_EXPORT void GtkInitFromCommandLine(const CommandLine& command_line); -UI_EXPORT void GdkInitFromCommandLine(const CommandLine& command_line); +GFX_EXPORT void GtkInitFromCommandLine(const CommandLine& command_line); +GFX_EXPORT void GdkInitFromCommandLine(const CommandLine& command_line); // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so // it is an expensive operation. The returned GdkPixbuf will have a refcount of // 1, and the caller is responsible for unrefing it when done. -UI_EXPORT GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); +GFX_EXPORT GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); // Modify the given region by subtracting the given rectangles. -UI_EXPORT void SubtractRectanglesFromRegion(GdkRegion* region, - const std::vector<Rect>& cutouts); +GFX_EXPORT void SubtractRectanglesFromRegion(GdkRegion* region, + const std::vector<Rect>& cutouts); // Returns a static instance of a GdkCursor* object, sharable across the // process. Caller must gdk_cursor_ref() it if they want to assume ownership. -UI_EXPORT GdkCursor* GetCursor(int type); +GFX_EXPORT GdkCursor* GetCursor(int type); // Initialize some GTK settings so that our dialogs are consistent. -UI_EXPORT void InitRCStyles(); +GFX_EXPORT void InitRCStyles(); // Queries GtkSettings for the cursor blink cycle time. Returns a 0 duration if // blinking is disabled. -UI_EXPORT base::TimeDelta GetCursorBlinkCycle(); +GFX_EXPORT base::TimeDelta GetCursorBlinkCycle(); } // namespace gfx diff --git a/ui/gfx/icon_util.h b/ui/gfx/icon_util.h index d56f5a1..0cb3508 100644 --- a/ui/gfx/icon_util.h +++ b/ui/gfx/icon_util.h @@ -57,7 +57,7 @@ class SkBitmap; // ::DestroyIcon(icon); // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT IconUtil { +class GFX_EXPORT IconUtil { public: // The size of the large icon entries in .ico files on Windows Vista+. static const int kLargeIconSize = 256; diff --git a/ui/gfx/image/cairo_cached_surface.h b/ui/gfx/image/cairo_cached_surface.h index 7c0204a..ceece4b 100644 --- a/ui/gfx/image/cairo_cached_surface.h +++ b/ui/gfx/image/cairo_cached_surface.h @@ -27,7 +27,7 @@ namespace gfx { // them with a certain XDisplay. Some users of surfaces (CustomDrawButtonBase, // for example) own their surfaces instead since they interact with the // ResourceBundle instead of the GtkThemeService. -class UI_EXPORT CairoCachedSurface { +class GFX_EXPORT CairoCachedSurface { public: CairoCachedSurface(); ~CairoCachedSurface(); diff --git a/ui/gfx/image/canvas_image_source.h b/ui/gfx/image/canvas_image_source.h index 88e891d..0ce170d 100644 --- a/ui/gfx/image/canvas_image_source.h +++ b/ui/gfx/image/canvas_image_source.h @@ -19,7 +19,7 @@ class ImageSkiaRep; // a scale factor using gfx::Canvas. It creates a new Canvas // with target scale factor and generates ImageSkiaRep when drawing is // completed. -class UI_EXPORT CanvasImageSource : public gfx::ImageSkiaSource { +class GFX_EXPORT CanvasImageSource : public gfx::ImageSkiaSource { public: CanvasImageSource(const gfx::Size& size, bool is_opaque); diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h index 00b5baa..d4093b74 100644 --- a/ui/gfx/image/image.h +++ b/ui/gfx/image/image.h @@ -53,7 +53,7 @@ class ImageRep; class ImageStorage; } -class UI_EXPORT Image { +class GFX_EXPORT Image { public: enum RepresentationType { kImageRepGdk, diff --git a/ui/gfx/image/image_family.h b/ui/gfx/image/image_family.h index c794371..93e005d 100644 --- a/ui/gfx/image/image_family.h +++ b/ui/gfx/image/image_family.h @@ -25,7 +25,7 @@ class Size; // size, with high-DPI bitmap versions; use an Image or ImageSkia for that. Each // image in an ImageFamily should have a different logical size (and may also // include high-DPI representations). -class UI_EXPORT ImageFamily { +class GFX_EXPORT ImageFamily { private: // An <aspect ratio, DIP width> pair. // A 0x0 image has aspect ratio 1.0. 0xN and Nx0 images are treated as 0x0. @@ -41,7 +41,7 @@ class UI_EXPORT ImageFamily { public: // Type for iterating over all images in the family, in order. // Dereferencing this iterator returns a gfx::Image. - class UI_EXPORT const_iterator : + class GFX_EXPORT const_iterator : std::iterator<std::bidirectional_iterator_tag, const gfx::Image> { public: const_iterator(); diff --git a/ui/gfx/image/image_ios.mm b/ui/gfx/image/image_ios.mm index f792e0d..126bfb4 100644 --- a/ui/gfx/image/image_ios.mm +++ b/ui/gfx/image/image_ios.mm @@ -11,7 +11,6 @@ #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsobject.h" -#include "ui/base/layout.h" #include "ui/gfx/image/image_png_rep.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_util_ios.h" diff --git a/ui/gfx/image/image_png_rep.h b/ui/gfx/image/image_png_rep.h index 98e37454..5c26134 100644 --- a/ui/gfx/image/image_png_rep.h +++ b/ui/gfx/image/image_png_rep.h @@ -13,7 +13,7 @@ class Size; // An ImagePNGRep represents a bitmap's png encoded data and the scale factor it // was intended for. -struct UI_EXPORT ImagePNGRep { +struct GFX_EXPORT ImagePNGRep { public: ImagePNGRep(); ImagePNGRep(const scoped_refptr<base::RefCountedMemory>& data, diff --git a/ui/gfx/image/image_skia.h b/ui/gfx/image/image_skia.h index ec3e65a..fa5d070 100644 --- a/ui/gfx/image/image_skia.h +++ b/ui/gfx/image/image_skia.h @@ -34,7 +34,7 @@ class TestOnThread; // returned from ImageSkia::GetRepresentation, not on ImageSkia. // // ImageSkia is cheap to copy and intentionally supports copy semantics. -class UI_EXPORT ImageSkia { +class GFX_EXPORT ImageSkia { public: typedef std::vector<ImageSkiaRep> ImageSkiaReps; diff --git a/ui/gfx/image/image_skia_operations.h b/ui/gfx/image/image_skia_operations.h index 92da50c..5b81df7 100644 --- a/ui/gfx/image/image_skia_operations.h +++ b/ui/gfx/image/image_skia_operations.h @@ -17,7 +17,7 @@ class ImageSkia; class Rect; class Size; -class UI_EXPORT ImageSkiaOperations { +class GFX_EXPORT ImageSkiaOperations { public: // Create an image that is a blend of two others. The alpha argument // specifies the opacity of the second imag. The provided image must diff --git a/ui/gfx/image/image_skia_rep.h b/ui/gfx/image/image_skia_rep.h index 66179fb..7a1e837 100644 --- a/ui/gfx/image/image_skia_rep.h +++ b/ui/gfx/image/image_skia_rep.h @@ -12,7 +12,7 @@ namespace gfx { // An ImageSkiaRep represents a bitmap and the scale factor it is intended for. -class UI_EXPORT ImageSkiaRep { +class GFX_EXPORT ImageSkiaRep { public: // Create null bitmap. ImageSkiaRep(); diff --git a/ui/gfx/image/image_skia_source.h b/ui/gfx/image/image_skia_source.h index 35be479..6250032 100644 --- a/ui/gfx/image/image_skia_source.h +++ b/ui/gfx/image/image_skia_source.h @@ -13,7 +13,7 @@ namespace gfx { class ImageSkiaRep; -class UI_EXPORT ImageSkiaSource { +class GFX_EXPORT ImageSkiaSource { public: virtual ~ImageSkiaSource() {} diff --git a/ui/gfx/image/image_skia_util_ios.h b/ui/gfx/image/image_skia_util_ios.h index 6c5f30df..6576ff8 100644 --- a/ui/gfx/image/image_skia_util_ios.h +++ b/ui/gfx/image/image_skia_util_ios.h @@ -18,22 +18,22 @@ class ImageSkia; class ImageSkiaRep; // Converts to ImageSkia from UIImage. -UI_EXPORT gfx::ImageSkia ImageSkiaFromUIImage(UIImage* image); +GFX_EXPORT gfx::ImageSkia ImageSkiaFromUIImage(UIImage* image); // Converts to an ImageSkiaRep of |scale_factor| from UIImage. // |scale| is passed explicitly in order to allow this method to be used // with a |scale| which is not supported by the platform. -UI_EXPORT gfx::ImageSkiaRep ImageSkiaRepOfScaleFromUIImage( +GFX_EXPORT gfx::ImageSkiaRep ImageSkiaRepOfScaleFromUIImage( UIImage* image, float scale); // Converts to UIImage from ImageSkia. The returned UIImage will be at the scale // of the ImageSkiaRep in |image_skia| which most closely matches the device's // scale factor (eg Retina iPad -> 2x). Returns an autoreleased UIImage. -UI_EXPORT UIImage* UIImageFromImageSkia(const gfx::ImageSkia& image_skia); +GFX_EXPORT UIImage* UIImageFromImageSkia(const gfx::ImageSkia& image_skia); // Converts to UIImage from ImageSkiaRep. Returns an autoreleased UIImage. -UI_EXPORT UIImage* UIImageFromImageSkiaRep( +GFX_EXPORT UIImage* UIImageFromImageSkiaRep( const gfx::ImageSkiaRep& image_skia_rep); } // namespace gfx diff --git a/ui/gfx/image/image_skia_util_mac.h b/ui/gfx/image/image_skia_util_mac.h index 10d05b0..553c3f8 100644 --- a/ui/gfx/image/image_skia_util_mac.h +++ b/ui/gfx/image/image_skia_util_mac.h @@ -25,21 +25,21 @@ namespace gfx { class ImageSkia; // Converts to ImageSkia from NSImage. -UI_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image); +GFX_EXPORT gfx::ImageSkia ImageSkiaFromNSImage(NSImage* image); // Resizes NSImage to |size| DIP and then converts to ImageSkia. -UI_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, - NSSize size); +GFX_EXPORT gfx::ImageSkia ImageSkiaFromResizedNSImage(NSImage* image, + NSSize size); // Resizes |[NSImage imageNamed:@NSApplicationIcon]| to have edge width of // |size| DIP and returns result as ImageSkia. -UI_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size); +GFX_EXPORT gfx::ImageSkia ApplicationIconAtSize(int size); // Converts to NSImage from ImageSkia. -UI_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia); +GFX_EXPORT NSImage* NSImageFromImageSkia(const gfx::ImageSkia& image_skia); // Converts to NSImage from given ImageSkia and a color space. -UI_EXPORT NSImage* NSImageFromImageSkiaWithColorSpace( +GFX_EXPORT NSImage* NSImageFromImageSkiaWithColorSpace( const gfx::ImageSkia& image_skia, CGColorSpaceRef color_space); diff --git a/ui/gfx/image/image_util.h b/ui/gfx/image/image_util.h index a039557..f33835c 100644 --- a/ui/gfx/image/image_util.h +++ b/ui/gfx/image/image_util.h @@ -18,8 +18,8 @@ namespace gfx { // Creates an image from the given JPEG-encoded input. If there was an error // creating the image, returns an IsEmpty() Image. -UI_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, - size_t input_size); +GFX_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, + size_t input_size); // Fills the |dst| vector with JPEG-encoded bytes of the 1x representation of // the given image. @@ -27,9 +27,9 @@ UI_EXPORT Image ImageFrom1xJPEGEncodedData(const unsigned char* input, // was encoded successfully. // |quality| determines the compression level, 0 == lowest, 100 == highest. // Returns true if the Image was encoded successfully. -UI_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, - int quality, - std::vector<unsigned char>* dst); +GFX_EXPORT bool JPEG1xEncodedDataFromImage(const Image& image, + int quality, + std::vector<unsigned char>* dst); } // namespace gfx diff --git a/ui/gfx/insets.h b/ui/gfx/insets.h index 571751d..a419059 100644 --- a/ui/gfx/insets.h +++ b/ui/gfx/insets.h @@ -18,7 +18,7 @@ typedef struct _GtkBorder GtkBorder; namespace gfx { // An integer version of gfx::Insets. -class UI_EXPORT Insets : public InsetsBase<Insets, int> { +class GFX_EXPORT Insets : public InsetsBase<Insets, int> { public: Insets(); Insets(int top, int left, int bottom, int right); diff --git a/ui/gfx/insets_base.h b/ui/gfx/insets_base.h index ab105bc..da7aca1 100644 --- a/ui/gfx/insets_base.h +++ b/ui/gfx/insets_base.h @@ -12,7 +12,7 @@ namespace gfx { // An insets represents the borders of a container (the space the container must // leave at each of its edges). template<typename Class, typename Type> -class UI_EXPORT InsetsBase { +class GFX_EXPORT InsetsBase { public: Type top() const { return top_; } Type left() const { return left_; } diff --git a/ui/gfx/insets_f.h b/ui/gfx/insets_f.h index 045b8a0..43b801d 100644 --- a/ui/gfx/insets_f.h +++ b/ui/gfx/insets_f.h @@ -14,7 +14,7 @@ namespace gfx { // A floating versin of gfx::Insets. -class UI_EXPORT InsetsF : public InsetsBase<InsetsF, float> { +class GFX_EXPORT InsetsF : public InsetsBase<InsetsF, float> { public: InsetsF(); InsetsF(float top, float left, float bottom, float right); diff --git a/ui/gfx/interpolated_transform.h b/ui/gfx/interpolated_transform.h index 474e3a9..dea9ce9 100644 --- a/ui/gfx/interpolated_transform.h +++ b/ui/gfx/interpolated_transform.h @@ -25,7 +25,7 @@ namespace ui { // scale from 0.3 to 1 from between times 0.75 and 1. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedTransform { +class GFX_EXPORT InterpolatedTransform { public: InterpolatedTransform(); // The interpolated transform varies only when t in (start_time, end_time). @@ -84,7 +84,7 @@ class UI_EXPORT InterpolatedTransform { // Represents an animated rotation. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedRotation : public InterpolatedTransform { +class GFX_EXPORT InterpolatedRotation : public InterpolatedTransform { public: InterpolatedRotation(float start_degrees, float end_degrees); InterpolatedRotation(float start_degrees, @@ -109,7 +109,7 @@ class UI_EXPORT InterpolatedRotation : public InterpolatedTransform { // Represents an animated rotation. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { +class GFX_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { public: InterpolatedAxisAngleRotation(const gfx::Vector3dF& axis, float start_degrees, @@ -138,7 +138,7 @@ class UI_EXPORT InterpolatedAxisAngleRotation : public InterpolatedTransform { // Represents an animated scale. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedScale : public InterpolatedTransform { +class GFX_EXPORT InterpolatedScale : public InterpolatedTransform { public: InterpolatedScale(float start_scale, float end_scale); InterpolatedScale(float start_scale, float end_scale, @@ -161,7 +161,7 @@ class UI_EXPORT InterpolatedScale : public InterpolatedTransform { DISALLOW_COPY_AND_ASSIGN(InterpolatedScale); }; -class UI_EXPORT InterpolatedTranslation : public InterpolatedTransform { +class GFX_EXPORT InterpolatedTranslation : public InterpolatedTransform { public: InterpolatedTranslation(const gfx::Point& start_pos, const gfx::Point& end_pos); @@ -190,7 +190,7 @@ class UI_EXPORT InterpolatedTranslation : public InterpolatedTransform { // See InterpolatedTransformAboutPivot for an example of its usage. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedConstantTransform : public InterpolatedTransform { +class GFX_EXPORT InterpolatedConstantTransform : public InterpolatedTransform { public: explicit InterpolatedConstantTransform(const gfx::Transform& transform); virtual ~InterpolatedConstantTransform(); @@ -212,7 +212,8 @@ class UI_EXPORT InterpolatedConstantTransform : public InterpolatedTransform { // P * T * P^-1 where P is a constant transform to the new origin. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT InterpolatedTransformAboutPivot : public InterpolatedTransform { +class GFX_EXPORT InterpolatedTransformAboutPivot + : public InterpolatedTransform { public: // Takes ownership of the passed transform. InterpolatedTransformAboutPivot(const gfx::Point& pivot, @@ -236,7 +237,7 @@ class UI_EXPORT InterpolatedTransformAboutPivot : public InterpolatedTransform { DISALLOW_COPY_AND_ASSIGN(InterpolatedTransformAboutPivot); }; -class UI_EXPORT InterpolatedMatrixTransform : public InterpolatedTransform { +class GFX_EXPORT InterpolatedMatrixTransform : public InterpolatedTransform { public: InterpolatedMatrixTransform(const gfx::Transform& start_transform, const gfx::Transform& end_transform); diff --git a/ui/gfx/matrix3_f.h b/ui/gfx/matrix3_f.h index 83f9cd9..a8ae5b5 100644 --- a/ui/gfx/matrix3_f.h +++ b/ui/gfx/matrix3_f.h @@ -10,7 +10,7 @@ namespace gfx { -class UI_EXPORT Matrix3F { +class GFX_EXPORT Matrix3F { public: ~Matrix3F(); diff --git a/ui/gfx/pango_util.h b/ui/gfx/pango_util.h index 8401638..05c525a 100644 --- a/ui/gfx/pango_util.h +++ b/ui/gfx/pango_util.h @@ -51,13 +51,13 @@ class ScopedPangoFontDescription { }; // Uses Pango to draw text onto |cr|. This is the public method for d -void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, - const base::string16& text, - const gfx::Font& font, - const gfx::Rect& bounds, - const gfx::Rect& clip, - SkColor text_color, - int flags); +void GFX_EXPORT DrawTextOntoCairoSurface(cairo_t* cr, + const base::string16& text, + const gfx::Font& font, + const gfx::Rect& bounds, + const gfx::Rect& clip, + SkColor text_color, + int flags); // ---------------------------------------------------------------------------- // All other methods in this file are only to be used within the ui/ directory. diff --git a/ui/gfx/path.h b/ui/gfx/path.h index f1c7718..257a65c 100644 --- a/ui/gfx/path.h +++ b/ui/gfx/path.h @@ -12,7 +12,7 @@ namespace gfx { -class UI_EXPORT Path : public SkPath { +class GFX_EXPORT Path : public SkPath { public: // Used by Path(Point,size_t) constructor. struct Point { diff --git a/ui/gfx/path_win.h b/ui/gfx/path_win.h index f64bc80..cc471e8 100644 --- a/ui/gfx/path_win.h +++ b/ui/gfx/path_win.h @@ -15,7 +15,7 @@ namespace gfx { // Creates a new HRGN given |path|. The caller is responsible for destroying // the returned region. -UI_EXPORT HRGN CreateHRGNFromSkPath(const SkPath& path); +GFX_EXPORT HRGN CreateHRGNFromSkPath(const SkPath& path); } // namespace gfx diff --git a/ui/gfx/path_x11.h b/ui/gfx/path_x11.h index e5a3092..5b1610e 100644 --- a/ui/gfx/path_x11.h +++ b/ui/gfx/path_x11.h @@ -16,7 +16,7 @@ namespace gfx { // Creates a new REGION given |path|. The caller is responsible for destroying // the returned region. -UI_EXPORT REGION* CreateRegionFromSkPath(const SkPath& path); +GFX_EXPORT REGION* CreateRegionFromSkPath(const SkPath& path); } // namespace gfx diff --git a/ui/gfx/platform_font.h b/ui/gfx/platform_font.h index 09bf8be..7670d47 100644 --- a/ui/gfx/platform_font.h +++ b/ui/gfx/platform_font.h @@ -16,7 +16,7 @@ namespace gfx { class Font; -class UI_EXPORT PlatformFont : public base::RefCounted<PlatformFont> { +class GFX_EXPORT PlatformFont : public base::RefCounted<PlatformFont> { public: // Creates an appropriate PlatformFont implementation. static PlatformFont* CreateDefault(); diff --git a/ui/gfx/platform_font_pango.h b/ui/gfx/platform_font_pango.h index 1804f37..0846f5e 100644 --- a/ui/gfx/platform_font_pango.h +++ b/ui/gfx/platform_font_pango.h @@ -18,7 +18,7 @@ class SkPaint; namespace gfx { -class UI_EXPORT PlatformFontPango : public PlatformFont { +class GFX_EXPORT PlatformFontPango : public PlatformFont { public: PlatformFontPango(); explicit PlatformFontPango(NativeFont native_font); diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h index ffa8249..77f3658 100644 --- a/ui/gfx/platform_font_win.h +++ b/ui/gfx/platform_font_win.h @@ -14,7 +14,7 @@ namespace gfx { -class UI_EXPORT PlatformFontWin : public PlatformFont { +class GFX_EXPORT PlatformFontWin : public PlatformFont { public: PlatformFontWin(); explicit PlatformFontWin(NativeFont native_font); diff --git a/ui/gfx/point.h b/ui/gfx/point.h index cb233da..020c4e1 100644 --- a/ui/gfx/point.h +++ b/ui/gfx/point.h @@ -22,7 +22,7 @@ typedef struct tagPOINT POINT; namespace gfx { // A point has an x and y coordinate. -class UI_EXPORT Point : public PointBase<Point, int, Vector2d> { +class GFX_EXPORT Point : public PointBase<Point, int, Vector2d> { public: Point() : PointBase<Point, int, Vector2d>(0, 0) {} Point(int x, int y) : PointBase<Point, int, Vector2d>(x, y) {} diff --git a/ui/gfx/point3_f.h b/ui/gfx/point3_f.h index 5ea0c31..485f655 100644 --- a/ui/gfx/point3_f.h +++ b/ui/gfx/point3_f.h @@ -14,7 +14,7 @@ namespace gfx { // A point has an x, y and z coordinate. -class UI_EXPORT Point3F { +class GFX_EXPORT Point3F { public: Point3F() : x_(0), y_(0), z_(0) {} @@ -90,15 +90,15 @@ inline bool operator!=(const Point3F& lhs, const Point3F& rhs) { } // Add a vector to a point, producing a new point offset by the vector. -UI_EXPORT Point3F operator+(const Point3F& lhs, const Vector3dF& rhs); +GFX_EXPORT Point3F operator+(const Point3F& lhs, const Vector3dF& rhs); // Subtract a vector from a point, producing a new point offset by the vector's // inverse. -UI_EXPORT Point3F operator-(const Point3F& lhs, const Vector3dF& rhs); +GFX_EXPORT Point3F operator-(const Point3F& lhs, const Vector3dF& rhs); // Subtract one point from another, producing a vector that represents the // distances between the two points along each axis. -UI_EXPORT Vector3dF operator-(const Point3F& lhs, const Point3F& rhs); +GFX_EXPORT Vector3dF operator-(const Point3F& lhs, const Point3F& rhs); inline Point3F PointAtOffsetFromOrigin(const Vector3dF& offset) { return Point3F(offset.x(), offset.y(), offset.z()); diff --git a/ui/gfx/point_base.h b/ui/gfx/point_base.h index 17f1d51..d7a3951 100644 --- a/ui/gfx/point_base.h +++ b/ui/gfx/point_base.h @@ -15,7 +15,7 @@ namespace gfx { // A point has an x and y coordinate. template<typename Class, typename Type, typename VectorClass> -class UI_EXPORT PointBase { +class GFX_EXPORT PointBase { public: Type x() const { return x_; } Type y() const { return y_; } diff --git a/ui/gfx/point_conversions.h b/ui/gfx/point_conversions.h index 9467a92..942edd7 100644 --- a/ui/gfx/point_conversions.h +++ b/ui/gfx/point_conversions.h @@ -11,13 +11,13 @@ namespace gfx { // Returns a Point with each component from the input PointF floored. -UI_EXPORT Point ToFlooredPoint(const PointF& point); +GFX_EXPORT Point ToFlooredPoint(const PointF& point); // Returns a Point with each component from the input PointF ceiled. -UI_EXPORT Point ToCeiledPoint(const PointF& point); +GFX_EXPORT Point ToCeiledPoint(const PointF& point); // Returns a Point with each component from the input PointF rounded. -UI_EXPORT Point ToRoundedPoint(const PointF& point); +GFX_EXPORT Point ToRoundedPoint(const PointF& point); } // namespace gfx diff --git a/ui/gfx/point_f.h b/ui/gfx/point_f.h index d9fc18c..664c18d 100644 --- a/ui/gfx/point_f.h +++ b/ui/gfx/point_f.h @@ -14,7 +14,7 @@ namespace gfx { // A floating version of gfx::Point. -class UI_EXPORT PointF : public PointBase<PointF, float, Vector2dF> { +class GFX_EXPORT PointF : public PointBase<PointF, float, Vector2dF> { public: PointF() : PointBase<PointF, float, Vector2dF>(0, 0) {} PointF(float x, float y) : PointBase<PointF, float, Vector2dF>(x, y) {} @@ -60,7 +60,7 @@ inline PointF PointAtOffsetFromOrigin(const Vector2dF& offset_from_origin) { return PointF(offset_from_origin.x(), offset_from_origin.y()); } -UI_EXPORT PointF ScalePoint(const PointF& p, float x_scale, float y_scale); +GFX_EXPORT PointF ScalePoint(const PointF& p, float x_scale, float y_scale); inline PointF ScalePoint(const PointF& p, float scale) { return ScalePoint(p, scale, scale); diff --git a/ui/gfx/quad_f.h b/ui/gfx/quad_f.h index 5bbc3cd..b8a42e9 100644 --- a/ui/gfx/quad_f.h +++ b/ui/gfx/quad_f.h @@ -17,7 +17,7 @@ namespace gfx { // A Quad is defined by four corners, allowing it to have edges that are not // axis-aligned, unlike a Rect. -class UI_EXPORT QuadF { +class GFX_EXPORT QuadF { public: QuadF() {} QuadF(const PointF& p1, const PointF& p2, const PointF& p3, const PointF& p4) @@ -99,10 +99,10 @@ inline bool operator!=(const QuadF& lhs, const QuadF& rhs) { } // Add a vector to a quad, offseting each point in the quad by the vector. -UI_EXPORT QuadF operator+(const QuadF& lhs, const Vector2dF& rhs); +GFX_EXPORT QuadF operator+(const QuadF& lhs, const Vector2dF& rhs); // Subtract a vector from a quad, offseting each point in the quad by the // inverse of the vector. -UI_EXPORT QuadF operator-(const QuadF& lhs, const Vector2dF& rhs); +GFX_EXPORT QuadF operator-(const QuadF& lhs, const Vector2dF& rhs); } // namespace gfx diff --git a/ui/gfx/range/range.h b/ui/gfx/range/range.h index c41c98c..d0d2a3e 100644 --- a/ui/gfx/range/range.h +++ b/ui/gfx/range/range.h @@ -31,7 +31,7 @@ namespace gfx { // position; when they are the same, the Range is akin to a caret. Note that // |start_| can be greater than |end_| to respect the directionality of the // range. -class UI_EXPORT Range { +class GFX_EXPORT Range { public: // Creates an empty range {0,0}. Range(); @@ -110,7 +110,7 @@ class UI_EXPORT Range { size_t end_; }; -UI_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range); +GFX_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range); } // namespace gfx diff --git a/ui/gfx/rect.h b/ui/gfx/rect.h index d983770..df7f9aa 100644 --- a/ui/gfx/rect.h +++ b/ui/gfx/rect.h @@ -35,7 +35,7 @@ namespace gfx { class Insets; -class UI_EXPORT Rect +class GFX_EXPORT Rect : public RectBase<Rect, Point, Size, Insets, Vector2d, int> { public: Rect() : RectBase<Rect, Point, Size, Insets, Vector2d, int>(Point()) {} @@ -89,16 +89,16 @@ inline bool operator!=(const Rect& lhs, const Rect& rhs) { return !(lhs == rhs); } -UI_EXPORT Rect operator+(const Rect& lhs, const Vector2d& rhs); -UI_EXPORT Rect operator-(const Rect& lhs, const Vector2d& rhs); +GFX_EXPORT Rect operator+(const Rect& lhs, const Vector2d& rhs); +GFX_EXPORT Rect operator-(const Rect& lhs, const Vector2d& rhs); inline Rect operator+(const Vector2d& lhs, const Rect& rhs) { return rhs + lhs; } -UI_EXPORT Rect IntersectRects(const Rect& a, const Rect& b); -UI_EXPORT Rect UnionRects(const Rect& a, const Rect& b); -UI_EXPORT Rect SubtractRects(const Rect& a, const Rect& b); +GFX_EXPORT Rect IntersectRects(const Rect& a, const Rect& b); +GFX_EXPORT Rect UnionRects(const Rect& a, const Rect& b); +GFX_EXPORT Rect SubtractRects(const Rect& a, const Rect& b); // Constructs a rectangle with |p1| and |p2| as opposite corners. // @@ -106,7 +106,7 @@ UI_EXPORT Rect SubtractRects(const Rect& a, const Rect& b); // points", except that we consider points on the right/bottom edges of the // rect to be outside the rect. So technically one or both points will not be // contained within the rect, because they will appear on one of these edges. -UI_EXPORT Rect BoundingRect(const Point& p1, const Point& p2); +GFX_EXPORT Rect BoundingRect(const Point& p1, const Point& p2); inline Rect ScaleToEnclosingRect(const Rect& rect, float x_scale, diff --git a/ui/gfx/rect_base.h b/ui/gfx/rect_base.h index 30fc1f1..4e7dd85 100644 --- a/ui/gfx/rect_base.h +++ b/ui/gfx/rect_base.h @@ -24,7 +24,7 @@ template<typename Class, typename InsetsClass, typename VectorClass, typename Type> -class UI_EXPORT RectBase { +class GFX_EXPORT RectBase { public: Type x() const { return origin_.x(); } void set_x(Type x) { origin_.set_x(x); } diff --git a/ui/gfx/rect_conversions.h b/ui/gfx/rect_conversions.h index 854fb6e..988f6c7 100644 --- a/ui/gfx/rect_conversions.h +++ b/ui/gfx/rect_conversions.h @@ -11,25 +11,25 @@ namespace gfx { // Returns the smallest Rect that encloses the given RectF. -UI_EXPORT Rect ToEnclosingRect(const RectF& rect); +GFX_EXPORT Rect ToEnclosingRect(const RectF& rect); // Returns the largest Rect that is enclosed by the given RectF. -UI_EXPORT Rect ToEnclosedRect(const RectF& rect); +GFX_EXPORT Rect ToEnclosedRect(const RectF& rect); // Returns the Rect after snapping the corners of the RectF to an integer grid. // This should only be used when the RectF you provide is expected to be an // integer rect with floating point error. If it is an arbitrary RectF, then // you should use a different method. -UI_EXPORT Rect ToNearestRect(const RectF& rect); +GFX_EXPORT Rect ToNearestRect(const RectF& rect); // Returns true if the Rect produced after snapping the corners of the RectF // to an integer grid is withing |distance|. -UI_EXPORT bool IsNearestRectWithinDistance( +GFX_EXPORT bool IsNearestRectWithinDistance( const gfx::RectF& rect, float distance); // Returns a Rect obtained by flooring the values of the given RectF. // Please prefer the previous two functions in new code. -UI_EXPORT Rect ToFlooredRectDeprecated(const RectF& rect); +GFX_EXPORT Rect ToFlooredRectDeprecated(const RectF& rect); } // namespace gfx diff --git a/ui/gfx/rect_f.h b/ui/gfx/rect_f.h index 62bedf2..09de529 100644 --- a/ui/gfx/rect_f.h +++ b/ui/gfx/rect_f.h @@ -17,7 +17,7 @@ namespace gfx { class InsetsF; // A floating version of gfx::Rect. -class UI_EXPORT RectF +class GFX_EXPORT RectF : public RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float> { public: RectF() @@ -83,9 +83,9 @@ inline RectF operator+(const Vector2dF& lhs, const RectF& rhs) { return rhs + lhs; } -UI_EXPORT RectF IntersectRects(const RectF& a, const RectF& b); -UI_EXPORT RectF UnionRects(const RectF& a, const RectF& b); -UI_EXPORT RectF SubtractRects(const RectF& a, const RectF& b); +GFX_EXPORT RectF IntersectRects(const RectF& a, const RectF& b); +GFX_EXPORT RectF UnionRects(const RectF& a, const RectF& b); +GFX_EXPORT RectF SubtractRects(const RectF& a, const RectF& b); inline RectF ScaleRect(const RectF& r, float x_scale, float y_scale) { return RectF(r.x() * x_scale, r.y() * y_scale, @@ -102,7 +102,7 @@ inline RectF ScaleRect(const RectF& r, float scale) { // points", except that we consider points on the right/bottom edges of the // rect to be outside the rect. So technically one or both points will not be // contained within the rect, because they will appear on one of these edges. -UI_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); +GFX_EXPORT RectF BoundingRect(const PointF& p1, const PointF& p2); #if !defined(COMPILER_MSVC) extern template class RectBase<RectF, PointF, SizeF, InsetsF, Vector2dF, float>; diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h index 598f4e1..df23ff3 100644 --- a/ui/gfx/render_text.h +++ b/ui/gfx/render_text.h @@ -151,7 +151,7 @@ struct Line { // visual layout. Support is built in for a cursor, a selection, simple styling, // complex scripts, and bi-directional text. Implementations provide mechanisms // for rendering and translation between logical and visual data. -class UI_EXPORT RenderText { +class GFX_EXPORT RenderText { public: virtual ~RenderText(); diff --git a/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h index 9b0b778..d305576 100644 --- a/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h +++ b/ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h @@ -17,7 +17,7 @@ class NSGraphicsContext; namespace gfx { // A class to save/restore the state of the current context. -class UI_EXPORT ScopedNSGraphicsContextSaveGState { +class GFX_EXPORT ScopedNSGraphicsContextSaveGState { public: ScopedNSGraphicsContextSaveGState(); ~ScopedNSGraphicsContextSaveGState(); diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index a181cc8..1d36d1b5 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -25,7 +25,7 @@ class Rect; // computer -- see the Display class for that. A single Screen object exists on // most operating systems regardless of the number of connected displays. On // Windows 8, two Screens exist: one for Metro UI and another for the desktop. -class UI_EXPORT Screen { +class GFX_EXPORT Screen { public: // Retrieves the Screen that the specified NativeView belongs to. A value of // NULL is treated as |SCREEN_TYPE_NATIVE|. diff --git a/ui/gfx/screen_type_delegate.h b/ui/gfx/screen_type_delegate.h index 12e8d90..4d9f116 100644 --- a/ui/gfx/screen_type_delegate.h +++ b/ui/gfx/screen_type_delegate.h @@ -9,7 +9,7 @@ namespace gfx { -enum UI_EXPORT ScreenType { +enum GFX_EXPORT ScreenType { SCREEN_TYPE_NATIVE = 0, #if defined(OS_CHROMEOS) SCREEN_TYPE_ALTERNATE = SCREEN_TYPE_NATIVE, @@ -19,7 +19,7 @@ enum UI_EXPORT ScreenType { SCREEN_TYPE_LAST = SCREEN_TYPE_ALTERNATE, }; -class UI_EXPORT ScreenTypeDelegate { +class GFX_EXPORT ScreenTypeDelegate { public: virtual ~ScreenTypeDelegate() {} diff --git a/ui/gfx/screen_win.h b/ui/gfx/screen_win.h index a9fb7f5..7b1ea4c 100644 --- a/ui/gfx/screen_win.h +++ b/ui/gfx/screen_win.h @@ -11,7 +11,7 @@ namespace gfx { -class UI_EXPORT ScreenWin : public gfx::Screen { +class GFX_EXPORT ScreenWin : public gfx::Screen { public: ScreenWin(); virtual ~ScreenWin(); diff --git a/ui/gfx/scrollbar_size.h b/ui/gfx/scrollbar_size.h index d11774d..bfea069 100644 --- a/ui/gfx/scrollbar_size.h +++ b/ui/gfx/scrollbar_size.h @@ -12,7 +12,7 @@ namespace gfx { // This should return the thickness, in pixels, of a scrollbar in web content. // This needs to match the values in WebCore's // ScrollbarThemeChromiumXXX.cpp::scrollbarThickness(). -UI_EXPORT int scrollbar_size(); +GFX_EXPORT int scrollbar_size(); } // namespace gfx diff --git a/ui/gfx/selection_model.h b/ui/gfx/selection_model.h index 0b811d1..d509e89 100644 --- a/ui/gfx/selection_model.h +++ b/ui/gfx/selection_model.h @@ -56,7 +56,7 @@ enum LogicalCursorDirection { // is given by a "caret affinity" which is either CURSOR_BACKWARD (indicating // the trailing half of the 'c' in this case) or CURSOR_FORWARD (indicating // the leading half of the 'D'). -class UI_EXPORT SelectionModel { +class GFX_EXPORT SelectionModel { public: // Create a default SelectionModel to be overwritten later. SelectionModel(); diff --git a/ui/gfx/sequential_id_generator.h b/ui/gfx/sequential_id_generator.h index f1b379a..e277a15 100644 --- a/ui/gfx/sequential_id_generator.h +++ b/ui/gfx/sequential_id_generator.h @@ -9,13 +9,13 @@ #include "base/basictypes.h" #include "base/containers/hash_tables.h" -#include "ui/base/ui_export.h" +#include "ui/gfx/gfx_export.h" namespace ui { // This is used to generate a series of sequential ID numbers in a way that a // new ID is always the lowest possible ID in the sequence. -class UI_EXPORT SequentialIDGenerator { +class GFX_EXPORT SequentialIDGenerator { public: // Creates a new generator with the specified lower bound for the IDs. explicit SequentialIDGenerator(uint32 min_id); diff --git a/ui/gfx/shadow_value.h b/ui/gfx/shadow_value.h index 46d84b4..60b601e 100644 --- a/ui/gfx/shadow_value.h +++ b/ui/gfx/shadow_value.h @@ -21,7 +21,7 @@ typedef std::vector<ShadowValue> ShadowValues; // ShadowValue encapsulates parameters needed to define a shadow, including the // shadow's offset, blur amount and color. -class UI_EXPORT ShadowValue { +class GFX_EXPORT ShadowValue { public: ShadowValue(); ShadowValue(const gfx::Point& offset, double blur, SkColor color); diff --git a/ui/gfx/size.h b/ui/gfx/size.h index c2340eb..c96f589 100644 --- a/ui/gfx/size.h +++ b/ui/gfx/size.h @@ -23,7 +23,7 @@ typedef struct tagSIZE SIZE; namespace gfx { // A size has width and height values. -class UI_EXPORT Size : public SizeBase<Size, int> { +class GFX_EXPORT Size : public SizeBase<Size, int> { public: Size() : SizeBase<Size, int>(0, 0) {} Size(int width, int height) : SizeBase<Size, int>(width, height) {} diff --git a/ui/gfx/size_base.h b/ui/gfx/size_base.h index 72d47d2..c8349dc 100644 --- a/ui/gfx/size_base.h +++ b/ui/gfx/size_base.h @@ -11,7 +11,7 @@ namespace gfx { // A size has width and height values. template<typename Class, typename Type> -class UI_EXPORT SizeBase { +class GFX_EXPORT SizeBase { public: Type width() const { return width_; } Type height() const { return height_; } diff --git a/ui/gfx/size_conversions.h b/ui/gfx/size_conversions.h index f642c4c..af68195 100644 --- a/ui/gfx/size_conversions.h +++ b/ui/gfx/size_conversions.h @@ -11,13 +11,13 @@ namespace gfx { // Returns a Size with each component from the input SizeF floored. -UI_EXPORT Size ToFlooredSize(const SizeF& size); +GFX_EXPORT Size ToFlooredSize(const SizeF& size); // Returns a Size with each component from the input SizeF ceiled. -UI_EXPORT Size ToCeiledSize(const SizeF& size); +GFX_EXPORT Size ToCeiledSize(const SizeF& size); // Returns a Size with each component from the input SizeF rounded. -UI_EXPORT Size ToRoundedSize(const SizeF& size); +GFX_EXPORT Size ToRoundedSize(const SizeF& size); } // namespace gfx diff --git a/ui/gfx/size_f.h b/ui/gfx/size_f.h index ee90189..b906527 100644 --- a/ui/gfx/size_f.h +++ b/ui/gfx/size_f.h @@ -14,7 +14,7 @@ namespace gfx { // A floating version of gfx::Size. -class UI_EXPORT SizeF : public SizeBase<SizeF, float> { +class GFX_EXPORT SizeF : public SizeBase<SizeF, float> { public: SizeF() : SizeBase<SizeF, float>(0, 0) {} SizeF(float width, float height) : SizeBase<SizeF, float>(width, height) {} @@ -39,7 +39,7 @@ inline bool operator!=(const SizeF& lhs, const SizeF& rhs) { return !(lhs == rhs); } -UI_EXPORT SizeF ScaleSize(const SizeF& p, float x_scale, float y_scale); +GFX_EXPORT SizeF ScaleSize(const SizeF& p, float x_scale, float y_scale); inline SizeF ScaleSize(const SizeF& p, float scale) { return ScaleSize(p, scale, scale); diff --git a/ui/gfx/skbitmap_operations.h b/ui/gfx/skbitmap_operations.h index 3a0d3c9..fd25d5e 100644 --- a/ui/gfx/skbitmap_operations.h +++ b/ui/gfx/skbitmap_operations.h @@ -17,7 +17,7 @@ class Size; class SkBitmap; -class UI_EXPORT SkBitmapOperations { +class GFX_EXPORT SkBitmapOperations { public: // Enum for use in rotating images (must be in 90 degree increments), // see: Rotate. diff --git a/ui/gfx/skia_util.h b/ui/gfx/skia_util.h index 592ff5f..92c886a 100644 --- a/ui/gfx/skia_util.h +++ b/ui/gfx/skia_util.h @@ -26,14 +26,14 @@ class ShadowValue; class Transform; // Convert between Skia and gfx rect types. -UI_EXPORT SkRect RectToSkRect(const Rect& rect); -UI_EXPORT SkIRect RectToSkIRect(const Rect& rect); -UI_EXPORT Rect SkIRectToRect(const SkIRect& rect); -UI_EXPORT SkRect RectFToSkRect(const RectF& rect); -UI_EXPORT RectF SkRectToRectF(const SkRect& rect); +GFX_EXPORT SkRect RectToSkRect(const Rect& rect); +GFX_EXPORT SkIRect RectToSkIRect(const Rect& rect); +GFX_EXPORT Rect SkIRectToRect(const SkIRect& rect); +GFX_EXPORT SkRect RectFToSkRect(const RectF& rect); +GFX_EXPORT RectF SkRectToRectF(const SkRect& rect); -UI_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, - SkMatrix* flattened); +GFX_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, + SkMatrix* flattened); // Creates a bitmap shader for the image rep with the image rep's scale factor. // Sets the created shader's local matrix such that it displays the image rep at @@ -42,32 +42,32 @@ UI_EXPORT void TransformToFlattenedSkMatrix(const gfx::Transform& transform, // TODO(pkotwicz): Allow shader's local matrix to be changed after the shader // is created. // -UI_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( +GFX_EXPORT skia::RefPtr<SkShader> CreateImageRepShader( const gfx::ImageSkiaRep& image_rep, SkShader::TileMode tile_mode, const SkMatrix& local_matrix); // Creates a vertical gradient shader. The caller owns the shader. // Example usage to avoid leaks: -UI_EXPORT skia::RefPtr<SkShader> CreateGradientShader(int start_point, - int end_point, - SkColor start_color, - SkColor end_color); +GFX_EXPORT skia::RefPtr<SkShader> CreateGradientShader(int start_point, + int end_point, + SkColor start_color, + SkColor end_color); // Creates a draw looper to generate |shadows|. The caller owns the draw looper. // NULL is returned if |shadows| is empty since no draw looper is needed in // this case. -UI_EXPORT skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper( +GFX_EXPORT skia::RefPtr<SkDrawLooper> CreateShadowDrawLooper( const std::vector<ShadowValue>& shadows); // Returns true if the two bitmaps contain the same pixels. -UI_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, - const SkBitmap& bitmap2); +GFX_EXPORT bool BitmapsAreEqual(const SkBitmap& bitmap1, + const SkBitmap& bitmap2); // Converts Skia ARGB format pixels in |skia| to RGBA. -UI_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, - int pixel_width, - unsigned char* rgba); +GFX_EXPORT void ConvertSkiaToRGBA(const unsigned char* skia, + int pixel_width, + unsigned char* rgba); } // namespace gfx diff --git a/ui/gfx/skia_utils_gtk.h b/ui/gfx/skia_utils_gtk.h index abe3977..6b74da2 100644 --- a/ui/gfx/skia_utils_gtk.h +++ b/ui/gfx/skia_utils_gtk.h @@ -13,10 +13,10 @@ typedef struct _GdkColor GdkColor; namespace gfx { // Converts GdkColors to the ARGB layout Skia expects. -UI_EXPORT SkColor GdkColorToSkColor(GdkColor color); +GFX_EXPORT SkColor GdkColorToSkColor(GdkColor color); // Converts ARGB to GdkColor. -UI_EXPORT GdkColor SkColorToGdkColor(SkColor color); +GFX_EXPORT GdkColor SkColorToGdkColor(SkColor color); } // namespace gfx diff --git a/ui/gfx/switches.h b/ui/gfx/switches.h index e3cd9e7..c5629f2 100644 --- a/ui/gfx/switches.h +++ b/ui/gfx/switches.h @@ -9,10 +9,10 @@ namespace switches { -UI_EXPORT extern const char kEnableBrowserTextSubpixelPositioning[]; -UI_EXPORT extern const char kEnableWebkitTextSubpixelPositioning[]; -UI_EXPORT extern const char kForceDeviceScaleFactor[]; -UI_EXPORT extern const char kHighDPISupport[]; +GFX_EXPORT extern const char kEnableBrowserTextSubpixelPositioning[]; +GFX_EXPORT extern const char kEnableWebkitTextSubpixelPositioning[]; +GFX_EXPORT extern const char kForceDeviceScaleFactor[]; +GFX_EXPORT extern const char kHighDPISupport[]; } // namespace switches diff --git a/ui/gfx/sys_color_change_listener.h b/ui/gfx/sys_color_change_listener.h index db3f9df..31afd0c 100644 --- a/ui/gfx/sys_color_change_listener.h +++ b/ui/gfx/sys_color_change_listener.h @@ -15,10 +15,10 @@ namespace gfx { // only true if the system has high-contrast mode enabled and and is using a // light-on-dark color scheme. To be notified when this status changes, use // ScopedSysColorChangeListener, below. -UI_EXPORT bool IsInvertedColorScheme(); +GFX_EXPORT bool IsInvertedColorScheme(); // Interface for classes that want to listen to system color changes. -class UI_EXPORT SysColorChangeListener { +class GFX_EXPORT SysColorChangeListener { public: virtual void OnSysColorChange() = 0; @@ -28,7 +28,7 @@ class UI_EXPORT SysColorChangeListener { // Create an instance of this class in any object that wants to listen // for system color changes. -class UI_EXPORT ScopedSysColorChangeListener { +class GFX_EXPORT ScopedSysColorChangeListener { public: explicit ScopedSysColorChangeListener(SysColorChangeListener* listener); ~ScopedSysColorChangeListener(); diff --git a/ui/gfx/text_elider.h b/ui/gfx/text_elider.h index 008a1cd..ff0cef0 100644 --- a/ui/gfx/text_elider.h +++ b/ui/gfx/text_elider.h @@ -26,8 +26,8 @@ namespace gfx { class Font; class FontList; -UI_EXPORT extern const char kEllipsis[]; -UI_EXPORT extern const char16 kEllipsisUTF16[]; +GFX_EXPORT extern const char kEllipsis[]; +GFX_EXPORT extern const char16 kEllipsisUTF16[]; // Elides a well-formed email address (e.g. username@domain.com) to fit into // |available_pixel_width| using the specified |font_list|. @@ -39,13 +39,13 @@ UI_EXPORT extern const char16 kEllipsisUTF16[]; // equally with the elided username (should the username be short enough that it // doesn't need half the available width: the elided domain will occupy that // extra width). -UI_EXPORT string16 ElideEmail(const string16& email, - const gfx::FontList& font_list, - int available_pixel_width); +GFX_EXPORT string16 ElideEmail(const string16& email, + const gfx::FontList& font_list, + int available_pixel_width); // Obsolete version. Use the above version which takes gfx::FontList. -UI_EXPORT string16 ElideEmail(const string16& email, - const gfx::Font& font, - int available_pixel_width); +GFX_EXPORT string16 ElideEmail(const string16& email, + const gfx::Font& font, + int available_pixel_width); // This function takes a GURL object and elides it. It returns a string // which composed of parts from subdomain, domain, path, filename and query. @@ -61,15 +61,15 @@ UI_EXPORT string16 ElideEmail(const string16& email, // as an LTR string (using base::i18n::WrapStringWithLTRFormatting()) so that it // is displayed properly in an RTL context. Please refer to // http://crbug.com/6487 for more information. -UI_EXPORT string16 ElideUrl(const GURL& url, - const gfx::FontList& font_list, - int available_pixel_width, - const std::string& languages); +GFX_EXPORT string16 ElideUrl(const GURL& url, + const gfx::FontList& font_list, + int available_pixel_width, + const std::string& languages); // Obsolete version. Use the above version which takes gfx::FontList. -UI_EXPORT string16 ElideUrl(const GURL& url, - const gfx::Font& font, - int available_pixel_width, - const std::string& languages); +GFX_EXPORT string16 ElideUrl(const GURL& url, + const gfx::Font& font, + int available_pixel_width, + const std::string& languages); enum ElideBehavior { // Add ellipsis at the end of the string. @@ -82,15 +82,15 @@ enum ElideBehavior { // Elides |text| to fit in |available_pixel_width| according to the specified // |elide_behavior|. -UI_EXPORT string16 ElideText(const string16& text, - const gfx::FontList& font_list, - int available_pixel_width, - ElideBehavior elide_behavior); +GFX_EXPORT string16 ElideText(const string16& text, + const gfx::FontList& font_list, + int available_pixel_width, + ElideBehavior elide_behavior); // Obsolete version. Use the above version which takes gfx::FontList. -UI_EXPORT string16 ElideText(const string16& text, - const gfx::Font& font, - int available_pixel_width, - ElideBehavior elide_behavior); +GFX_EXPORT string16 ElideText(const string16& text, + const gfx::Font& font, + int available_pixel_width, + ElideBehavior elide_behavior); // Elide a filename to fit a given pixel width, with an emphasis on not hiding // the extension unless we have to. If filename contains a path, the path will @@ -98,20 +98,20 @@ UI_EXPORT string16 ElideText(const string16& text, // filename is forced to have LTR directionality, which means that in RTL UI // the elided filename is wrapped with LRE (Left-To-Right Embedding) mark and // PDF (Pop Directional Formatting) mark. -UI_EXPORT string16 ElideFilename(const base::FilePath& filename, - const gfx::FontList& font_list, - int available_pixel_width); +GFX_EXPORT string16 ElideFilename(const base::FilePath& filename, + const gfx::FontList& font_list, + int available_pixel_width); // Obsolete version. Use the above version which takes gfx::FontList. -UI_EXPORT string16 ElideFilename(const base::FilePath& filename, - const gfx::Font& font, - int available_pixel_width); +GFX_EXPORT string16 ElideFilename(const base::FilePath& filename, + const gfx::Font& font, + int available_pixel_width); // SortedDisplayURL maintains a string from a URL suitable for display to the // use. SortedDisplayURL also provides a function used for comparing two // SortedDisplayURLs for use in visually ordering the SortedDisplayURLs. // // SortedDisplayURL is relatively cheap and supports value semantics. -class UI_EXPORT SortedDisplayURL { +class GFX_EXPORT SortedDisplayURL { public: SortedDisplayURL(const GURL& url, const std::string& languages); SortedDisplayURL(); @@ -154,8 +154,8 @@ class UI_EXPORT SortedDisplayURL { // puts "Hell...Tom" in str and returns true. // TODO(tsepez): Doesn't handle UTF-16 surrogate pairs properly. // TODO(tsepez): Doesn't handle bidi properly. -UI_EXPORT bool ElideString(const string16& input, int max_len, - string16* output); +GFX_EXPORT bool ElideString(const string16& input, int max_len, + string16* output); // Reformat |input| into |output| so that it fits into a |max_rows| by // |max_cols| rectangle of characters. Input newlines are respected, but @@ -166,9 +166,9 @@ UI_EXPORT bool ElideString(const string16& input, int max_len, // intra-word (respecting UTF-16 surrogate pairs) as necssary. Truncation // (indicated by an added 3 dots) occurs if the result is still too long. // Returns true if the input had to be truncated (and not just reformatted). -UI_EXPORT bool ElideRectangleString(const string16& input, size_t max_rows, - size_t max_cols, bool strict, - string16* output); +GFX_EXPORT bool ElideRectangleString(const string16& input, size_t max_rows, + size_t max_cols, bool strict, + string16* output); // Specifies the word wrapping behavior of |ElideRectangleText()| when a word // would exceed the available width. @@ -206,26 +206,26 @@ enum ReformattingResultFlags { // param. Returns a combination of |ReformattingResultFlags| that indicate // whether the given rectangle had insufficient space to accommodate |texŧ|, // leading to elision or truncation (and not just reformatting). -UI_EXPORT int ElideRectangleText(const string16& text, - const gfx::FontList& font_list, - int available_pixel_width, - int available_pixel_height, - WordWrapBehavior wrap_behavior, - std::vector<string16>* lines); +GFX_EXPORT int ElideRectangleText(const string16& text, + const gfx::FontList& font_list, + int available_pixel_width, + int available_pixel_height, + WordWrapBehavior wrap_behavior, + std::vector<string16>* lines); // Obsolete version. Use the above version which takes gfx::FontList. -UI_EXPORT int ElideRectangleText(const string16& text, - const gfx::Font& font, - int available_pixel_width, - int available_pixel_height, - WordWrapBehavior wrap_behavior, - std::vector<string16>* lines); +GFX_EXPORT int ElideRectangleText(const string16& text, + const gfx::Font& font, + int available_pixel_width, + int available_pixel_height, + WordWrapBehavior wrap_behavior, + std::vector<string16>* lines); // Truncates the string to length characters. This breaks the string at // the first word break before length, adding the horizontal ellipsis // character (unicode character 0x2026) to render ... // The supplied string is returned if the string has length characters or // less. -UI_EXPORT string16 TruncateString(const string16& string, size_t length); +GFX_EXPORT string16 TruncateString(const string16& string, size_t length); } // namespace gfx diff --git a/ui/gfx/text_utils.h b/ui/gfx/text_utils.h index bd94902..fa5caef 100644 --- a/ui/gfx/text_utils.h +++ b/ui/gfx/text_utils.h @@ -17,15 +17,15 @@ class FontList; // |accelerated_char_pos| and |accelerated_char_span| will be set to the index // and span of the last accelerated character, respectively, or -1 and 0 if // there was none. -UI_EXPORT base::string16 RemoveAcceleratorChar(const base::string16& s, - base::char16 accelerator_char, - int* accelerated_char_pos, - int* accelerated_char_span); +GFX_EXPORT base::string16 RemoveAcceleratorChar(const base::string16& s, + base::char16 accelerator_char, + int* accelerated_char_pos, + int* accelerated_char_span); // Returns the number of horizontal pixels needed to display the specified // |text| with |font_list|. -UI_EXPORT int GetStringWidth(const base::string16& text, - const FontList& font_list); +GFX_EXPORT int GetStringWidth(const base::string16& text, + const FontList& font_list); } // namespace gfx diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h index 0bae588..72a027a 100644 --- a/ui/gfx/transform.h +++ b/ui/gfx/transform.h @@ -21,7 +21,7 @@ class Vector3dF; // 4x4 transformation matrix. Transform is cheap and explicitly allows // copy/assign. -class UI_EXPORT Transform { +class GFX_EXPORT Transform { public: enum SkipInitialization { diff --git a/ui/gfx/transform_util.h b/ui/gfx/transform_util.h index e5a2138..07bf0d5 100644 --- a/ui/gfx/transform_util.h +++ b/ui/gfx/transform_util.h @@ -13,11 +13,11 @@ namespace gfx { class Point; // Returns a scale transform at |anchor| point. -UI_EXPORT Transform GetScaleTransform(const Point& anchor, float scale); +GFX_EXPORT Transform GetScaleTransform(const Point& anchor, float scale); // Contains the components of a factored transform. These components may be // blended and recomposed. -struct UI_EXPORT DecomposedTransform { +struct GFX_EXPORT DecomposedTransform { // The default constructor initializes the components in such a way that // if used with Compose below, will produce the identity transform. DecomposedTransform(); @@ -37,21 +37,21 @@ struct UI_EXPORT DecomposedTransform { // routines described in http://www.w3.org/TR/css3-3d-transform/. // |progress| is in the range [0, 1] (0 leaves |out| unchanged, and 1 // assigns |from| to |out|). -UI_EXPORT bool BlendDecomposedTransforms(DecomposedTransform* out, - const DecomposedTransform& to, - const DecomposedTransform& from, - double progress); +GFX_EXPORT bool BlendDecomposedTransforms(DecomposedTransform* out, + const DecomposedTransform& to, + const DecomposedTransform& from, + double progress); // Decomposes this transform into its translation, scale, skew, perspective, // and rotation components following the routines detailed in this spec: // http://www.w3.org/TR/css3-3d-transforms/. -UI_EXPORT bool DecomposeTransform(DecomposedTransform* out, - const Transform& transform); +GFX_EXPORT bool DecomposeTransform(DecomposedTransform* out, + const Transform& transform); // Composes a transform from the given translation, scale, skew, prespective, // and rotation components following the routines detailed in this spec: // http://www.w3.org/TR/css3-3d-transforms/. -UI_EXPORT Transform ComposeTransform(const DecomposedTransform& decomp); +GFX_EXPORT Transform ComposeTransform(const DecomposedTransform& decomp); } // namespace gfx diff --git a/ui/gfx/utf16_indexing.h b/ui/gfx/utf16_indexing.h index 7f56384..a9eaea2 100644 --- a/ui/gfx/utf16_indexing.h +++ b/ui/gfx/utf16_indexing.h @@ -12,7 +12,7 @@ namespace gfx { // Returns false if s[index-1] is a high surrogate and s[index] is a low // surrogate, true otherwise. -UI_EXPORT bool IsValidCodePointIndex(const string16& s, size_t index); +GFX_EXPORT bool IsValidCodePointIndex(const string16& s, size_t index); // |UTF16IndexToOffset| returns the number of code points between |base| and // |pos| in the given string. |UTF16OffsetToIndex| returns the index that is @@ -37,12 +37,12 @@ UI_EXPORT bool IsValidCodePointIndex(const string16& s, size_t index); // Always, // UTF16IndexToOffset(s, base, UTF16OffsetToIndex(s, base, ofs)) == ofs // UTF16IndexToOffset(s, i, j) == -UTF16IndexToOffset(s, j, i) -UI_EXPORT ptrdiff_t UTF16IndexToOffset(const string16& s, - size_t base, - size_t pos); -UI_EXPORT size_t UTF16OffsetToIndex(const string16& s, - size_t base, - ptrdiff_t offset); +GFX_EXPORT ptrdiff_t UTF16IndexToOffset(const string16& s, + size_t base, + size_t pos); +GFX_EXPORT size_t UTF16OffsetToIndex(const string16& s, + size_t base, + ptrdiff_t offset); } // namespace gfx diff --git a/ui/gfx/vector2d.h b/ui/gfx/vector2d.h index 9494120..8dd7632 100644 --- a/ui/gfx/vector2d.h +++ b/ui/gfx/vector2d.h @@ -18,7 +18,7 @@ namespace gfx { -class UI_EXPORT Vector2d { +class GFX_EXPORT Vector2d { public: Vector2d() : x_(0), y_(0) {} Vector2d(int x, int y) : x_(x), y_(y) {} diff --git a/ui/gfx/vector2d_conversions.h b/ui/gfx/vector2d_conversions.h index 051092e..509a456 100644 --- a/ui/gfx/vector2d_conversions.h +++ b/ui/gfx/vector2d_conversions.h @@ -11,13 +11,13 @@ namespace gfx { // Returns a Vector2d with each component from the input Vector2dF floored. -UI_EXPORT Vector2d ToFlooredVector2d(const Vector2dF& vector2d); +GFX_EXPORT Vector2d ToFlooredVector2d(const Vector2dF& vector2d); // Returns a Vector2d with each component from the input Vector2dF ceiled. -UI_EXPORT Vector2d ToCeiledVector2d(const Vector2dF& vector2d); +GFX_EXPORT Vector2d ToCeiledVector2d(const Vector2dF& vector2d); // Returns a Vector2d with each component from the input Vector2dF rounded. -UI_EXPORT Vector2d ToRoundedVector2d(const Vector2dF& vector2d); +GFX_EXPORT Vector2d ToRoundedVector2d(const Vector2dF& vector2d); } // namespace gfx diff --git a/ui/gfx/vector2d_f.h b/ui/gfx/vector2d_f.h index ebd0b5b..289b9b7 100644 --- a/ui/gfx/vector2d_f.h +++ b/ui/gfx/vector2d_f.h @@ -16,7 +16,7 @@ namespace gfx { -class UI_EXPORT Vector2dF { +class GFX_EXPORT Vector2dF { public: Vector2dF() : x_(0), y_(0) {} Vector2dF(float x, float y) : x_(x), y_(y) {} @@ -91,16 +91,16 @@ inline Vector2dF operator-(const Vector2dF& lhs, const Vector2dF& rhs) { } // Return the cross product of two vectors. -UI_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs); +GFX_EXPORT double CrossProduct(const Vector2dF& lhs, const Vector2dF& rhs); // Return the dot product of two vectors. -UI_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs); +GFX_EXPORT double DotProduct(const Vector2dF& lhs, const Vector2dF& rhs); // Return a vector that is |v| scaled by the given scale factors along each // axis. -UI_EXPORT Vector2dF ScaleVector2d(const Vector2dF& v, - float x_scale, - float y_scale); +GFX_EXPORT Vector2dF ScaleVector2d(const Vector2dF& v, + float x_scale, + float y_scale); // Return a vector that is |v| scaled by the given scale factor. inline Vector2dF ScaleVector2d(const Vector2dF& v, float scale) { diff --git a/ui/gfx/vector3d_f.h b/ui/gfx/vector3d_f.h index aaa415b..0e91a36 100644 --- a/ui/gfx/vector3d_f.h +++ b/ui/gfx/vector3d_f.h @@ -17,7 +17,7 @@ namespace gfx { -class UI_EXPORT Vector3dF { +class GFX_EXPORT Vector3dF { public: Vector3dF(); Vector3dF(float x, float y, float z); @@ -105,14 +105,14 @@ inline Vector3dF CrossProduct(const Vector3dF& lhs, const Vector3dF& rhs) { } // Return the dot product of two vectors. -UI_EXPORT float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs); +GFX_EXPORT float DotProduct(const Vector3dF& lhs, const Vector3dF& rhs); // Return a vector that is |v| scaled by the given scale factors along each // axis. -UI_EXPORT Vector3dF ScaleVector3d(const Vector3dF& v, - float x_scale, - float y_scale, - float z_scale); +GFX_EXPORT Vector3dF ScaleVector3d(const Vector3dF& v, + float x_scale, + float y_scale, + float z_scale); // Return a vector that is |v| scaled by the given scale factor. inline Vector3dF ScaleVector3d(const Vector3dF& v, float scale) { diff --git a/ui/gfx/win/dpi.cc b/ui/gfx/win/dpi.cc index 2d2024f..e685528 100644 --- a/ui/gfx/win/dpi.cc +++ b/ui/gfx/win/dpi.cc @@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/win/scoped_hdc.h" #include "base/win/windows_version.h" -#include "ui/base/layout.h" #include "base/win/registry.h" #include "ui/gfx/display.h" #include "ui/gfx/switches.h" @@ -21,31 +20,6 @@ namespace { int kDefaultDPIX = 96; int kDefaultDPIY = 96; -// Tests to see if the command line flag "--high-dpi-support" is set. -bool IsHighDPIEnabled() { - // Default is disabled. - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kHighDPISupport)) { - return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kHighDPISupport).compare("1") == 0; - } - return false; -} - -// Gets the device scale factor. If support is enabled, this will return the -// best available scale based on the screen's pixel density. This can be -// affected (overridden) by --force-device-scale-factor=x -float GetDeviceScaleFactorImpl() { - if (IsHighDPIEnabled()) { - float scale = gfx::Display::HasForceDeviceScaleFactor() ? - gfx::Display::GetForcedDeviceScaleFactor() : gfx::GetDPIScale(); - // Quantize to nearest supported scale factor. - scale = ui::GetImageScale(ui::GetSupportedScaleFactor(scale)); - return scale; - } - return 1.0f; -} - BOOL IsProcessDPIAwareWrapper() { typedef BOOL(WINAPI *IsProcessDPIAwarePtr)(VOID); IsProcessDPIAwarePtr is_process_dpi_aware_func = @@ -56,10 +30,17 @@ BOOL IsProcessDPIAwareWrapper() { return FALSE; } +float g_device_scale_factor = 0.0f; + } // namespace namespace gfx { +void InitDeviceScaleFactor(float scale) { + DCHECK_NE(0.0f, scale); + g_device_scale_factor = scale; +} + Size GetDPI() { static int dpi_x = 0; static int dpi_y = 0; @@ -85,6 +66,16 @@ float GetDPIScale() { return 1.0; } +bool IsHighDPIEnabled() { + // Default is disabled. + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kHighDPISupport)) { + return CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kHighDPISupport).compare("1") == 0; + } + return false; +} + bool IsInHighDPIMode() { return GetDPIScale() > 1.0; } @@ -104,8 +95,8 @@ void EnableHighDPISupport() { namespace win { float GetDeviceScaleFactor() { - static const float device_scale_factor = GetDeviceScaleFactorImpl(); - return device_scale_factor; + DCHECK_NE(0.0f, g_device_scale_factor); + return g_device_scale_factor; } Point ScreenToDIPPoint(const Point& pixel_point) { diff --git a/ui/gfx/win/dpi.h b/ui/gfx/win/dpi.h index a056f53..0193ac0 100644 --- a/ui/gfx/win/dpi.h +++ b/ui/gfx/win/dpi.h @@ -12,37 +12,47 @@ namespace gfx { -UI_EXPORT Size GetDPI(); +// Initialization of the scale factor that should be applied for rendering +// in this process. Must be called before attempts to call any of the getter +// methods below in this file, e.g. in the early toolkit/resource bundle setup. +// This can be called multiple times during various tests, but subsequent calls +// have no effect. +GFX_EXPORT void InitDeviceScaleFactor(float scale); + +GFX_EXPORT Size GetDPI(); // Gets the scale factor of the display. For example, if the display DPI is // 96 then the scale factor is 1.0. -UI_EXPORT float GetDPIScale(); +GFX_EXPORT float GetDPIScale(); + +// Tests to see if the command line flag "--high-dpi-support" is set. +GFX_EXPORT bool IsHighDPIEnabled(); -UI_EXPORT bool IsInHighDPIMode(); +GFX_EXPORT bool IsInHighDPIMode(); -UI_EXPORT void EnableHighDPISupport(); +GFX_EXPORT void EnableHighDPISupport(); // TODO(kevers|girard): Move above methods into win namespace. namespace win { -UI_EXPORT float GetDeviceScaleFactor(); +GFX_EXPORT float GetDeviceScaleFactor(); -UI_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); +GFX_EXPORT Point ScreenToDIPPoint(const Point& pixel_point); -UI_EXPORT Point DIPToScreenPoint(const Point& dip_point); +GFX_EXPORT Point DIPToScreenPoint(const Point& dip_point); -UI_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); +GFX_EXPORT Rect ScreenToDIPRect(const Rect& pixel_bounds); -UI_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); +GFX_EXPORT Rect DIPToScreenRect(const Rect& dip_bounds); -UI_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); +GFX_EXPORT Size ScreenToDIPSize(const Size& size_in_pixels); -UI_EXPORT Size DIPToScreenSize(const Size& dip_size); +GFX_EXPORT Size DIPToScreenSize(const Size& dip_size); // Win32's GetSystemMetrics uses pixel measures. This function calls // GetSystemMetrics for the given |metric|, then converts the result to DIP. -UI_EXPORT int GetSystemMetricsInDIP(int metric); +GFX_EXPORT int GetSystemMetricsInDIP(int metric); // Sometimes the OS secretly scales apps that are not DPIAware. This is not // visible through standard OS calls like GetWindowPos(), or through @@ -50,12 +60,12 @@ UI_EXPORT int GetSystemMetricsInDIP(int metric); // Returns the scale factor of the display, where 96 DPI is 1.0. // (Avoid this function... use GetDPIScale() instead.) // TODO(girard): Remove this once DPIAware is enabled - http://crbug.com/149881 -UI_EXPORT double GetUndocumentedDPIScale(); +GFX_EXPORT double GetUndocumentedDPIScale(); // Win7 and Win8 send touch events scaled according to the current DPI // scaling. Win8.1 corrects this, and sends touch events in DPI units. // This function returns the appropriate scaling factor for touch events. -UI_EXPORT double GetUndocumentedDPITouchScale(); +GFX_EXPORT double GetUndocumentedDPITouchScale(); } // namespace win } // namespace gfx diff --git a/ui/gfx/win/hwnd_util.h b/ui/gfx/win/hwnd_util.h index 70e5f8f..472dacc 100644 --- a/ui/gfx/win/hwnd_util.h +++ b/ui/gfx/win/hwnd_util.h @@ -16,38 +16,38 @@ class Size; // A version of the GetClassNameW API that returns the class name in an // string16. An empty result indicates a failure to get the class name. -UI_EXPORT string16 GetClassName(HWND hwnd); +GFX_EXPORT string16 GetClassName(HWND hwnd); // Useful for subclassing a HWND. Returns the previous window procedure. -UI_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); +GFX_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) // Returns the previously set value. -UI_EXPORT void* SetWindowUserData(HWND hwnd, void* user_data); -UI_EXPORT void* GetWindowUserData(HWND hwnd); +GFX_EXPORT void* SetWindowUserData(HWND hwnd, void* user_data); +GFX_EXPORT void* GetWindowUserData(HWND hwnd); // Returns true if the specified window is the current active top window or one // of its children. -UI_EXPORT bool DoesWindowBelongToActiveWindow(HWND window); +GFX_EXPORT bool DoesWindowBelongToActiveWindow(HWND window); // Sizes the window to have a window size of |pref|, then centers the window // over |parent|, ensuring the window fits on screen. -UI_EXPORT void CenterAndSizeWindow(HWND parent, - HWND window, - const gfx::Size& pref); +GFX_EXPORT void CenterAndSizeWindow(HWND parent, + HWND window, + const gfx::Size& pref); // If |hwnd| is NULL logs various thing and CHECKs. Invoke right after calling // CreateWindow. -UI_EXPORT void CheckWindowCreated(HWND hwnd); +GFX_EXPORT void CheckWindowCreated(HWND hwnd); // Shows |window|'s system menu (at a specified |point| in screen coordinates). -UI_EXPORT void ShowSystemMenu(HWND window); -UI_EXPORT void ShowSystemMenuAtPoint(HWND window, const gfx::Point& point); +GFX_EXPORT void ShowSystemMenu(HWND window); +GFX_EXPORT void ShowSystemMenuAtPoint(HWND window, const gfx::Point& point); // Returns the window you can use to parent a top level window. // Note that in some cases we create child windows not parented to its final // container so in those cases you should pass true in |get_real_hwnd|. -UI_EXPORT HWND GetWindowToParentTo(bool get_real_hwnd); +GFX_EXPORT HWND GetWindowToParentTo(bool get_real_hwnd); } // namespace gfx diff --git a/ui/gfx/win/window_impl.h b/ui/gfx/win/window_impl.h index 2b0018e..1825c0b 100644 --- a/ui/gfx/win/window_impl.h +++ b/ui/gfx/win/window_impl.h @@ -40,7 +40,7 @@ class MessageMapInterface { // Windows. // /////////////////////////////////////////////////////////////////////////////// -class UI_EXPORT WindowImpl : public MessageMapInterface { +class GFX_EXPORT WindowImpl : public MessageMapInterface { public: WindowImpl(); virtual ~WindowImpl(); @@ -293,7 +293,8 @@ 'base/win/accessibility_misc_utils.cc', 'base/win/accessibility_misc_utils.h', 'base/win/atl_module.h', - 'events/win/events_win.cc', + 'base/win/dpi_setup.cc', + 'base/win/dpi_setup.h', 'base/win/extra_sdk_defines.h', 'base/win/foreground_helper.cc', 'base/win/foreground_helper.h', @@ -369,6 +370,7 @@ 'events/ozone/event_factory_ozone.cc', 'events/ozone/event_factory_ozone.h', 'events/ozone/events_ozone.cc', + 'events/win/events_win.cc', 'events/x/device_data_manager.cc', 'events/x/device_data_manager.h', 'events/x/device_list_cache_x.cc', |