diff options
author | Mattias Nissler <mnissler@chromium.org> | 2015-07-09 11:33:44 +0200 |
---|---|---|
committer | Mattias Nissler <mnissler@chromium.org> | 2015-07-09 09:34:56 +0000 |
commit | 17399fb2b0a5fcba7c2dcb76ab2c597e6cf7c0db (patch) | |
tree | cce3efd92751a740290200be1185f5b501e8e5a8 /ui/gfx | |
parent | 53e230a8e16c732966545622bd0b46b619e59ca4 (diff) | |
download | chromium_src-17399fb2b0a5fcba7c2dcb76ab2c597e6cf7c0db.zip chromium_src-17399fb2b0a5fcba7c2dcb76ab2c597e6cf7c0db.tar.gz chromium_src-17399fb2b0a5fcba7c2dcb76ab2c597e6cf7c0db.tar.bz2 |
Revert vector icon CLs.
This reverts the following commits:
ac1592c73bdd24eca2ea3e591e8f7b199627e6e7: "mandoline: Fix aura build for android."
5490bafef2f11416bed41ad8017a6db500c67345: "Split vector icon commands into separate files aggregated at build time."
33b823af3e63287dbe850c253ae97593411d4f43: "Introduce some util code for drawing vector assets."
Reason for revert is 33b823af3e63287dbe850c253ae97593411d4f43, which
is one of the suspects for having broken browser_tests on Mac builders:
http://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/8232
http://build.chromium.org/p/chromium.mac/builders/Mac10.9%20Tests/builds/4313
Log output:
NativeAppWindowCocoaBrowserTestInstance/NativeAppWindowCocoaBrowserTest.FrameColor/0 (run #1):
[ RUN ] NativeAppWindowCocoaBrowserTestInstance/NativeAppWindowCocoaBrowserTest.FrameColor/0
[7393:1287:0708/150523:WARNING:vt_video_decode_accelerator.cc(206)] Failed to create hardware VideoToolbox session. Hardware accelerated video decoding will be disabled.
[7390:45827:0708/150524:WARNING:data_reduction_proxy_config.cc(630)] SPDY proxy OFF at startup
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:645: Failure
Value of: [color redComponent]
Actual: 0.952941
Expected: 0
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:646: Failure
Value of: [color greenComponent]
Actual: 0.952941
Expected: 0
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:647: Failure
Value of: [color blueComponent]
Actual: 0.952941
Expected: 1
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:654: Failure
Value of: [color redComponent]
Actual: 0.952941
Expected: 1
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:655: Failure
Value of: [color greenComponent]
Actual: 0.952941
Expected: 0
../../chrome/browser/ui/cocoa/apps/native_app_window_cocoa_browsertest.mm:656: Failure
Value of: [color blueComponent]
Actual: 0.952941
Expected: 0
[ FAILED ] NativeAppWindowCocoaBrowserTestInstance/NativeAppWindowCocoaBrowserTest.FrameColor/0, where GetParam() = false (1817 ms)
BUG=508389
TBR=estade@chromium.org
Review URL: https://codereview.chromium.org/1228923002 .
Cr-Commit-Position: refs/heads/master@{#338004}
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/BUILD.gn | 33 | ||||
-rw-r--r-- | ui/gfx/gfx.gyp | 38 | ||||
-rw-r--r-- | ui/gfx/paint_vector_icon.cc | 121 | ||||
-rw-r--r-- | ui/gfx/paint_vector_icon.h | 27 | ||||
-rw-r--r-- | ui/gfx/vector_icons.h | 53 | ||||
-rw-r--r-- | ui/gfx/vector_icons/aggregate_vector_icons.py | 75 | ||||
-rw-r--r-- | ui/gfx/vector_icons/check_circle.icon | 9 | ||||
-rw-r--r-- | ui/gfx/vector_icons/photo_camera.icon | 17 | ||||
-rw-r--r-- | ui/gfx/vector_icons/vector_icons.cc.template | 34 | ||||
-rw-r--r-- | ui/gfx/vector_icons/vector_icons_public.h.template | 20 |
10 files changed, 1 insertions, 426 deletions
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn index 10bea84..9f1490f 100644 --- a/ui/gfx/BUILD.gn +++ b/ui/gfx/BUILD.gn @@ -20,9 +20,6 @@ source_set("gfx_export") { ] } -vector_icons_cc_file = "$target_gen_dir/vector_icons.cc" -vector_icons_public_h_file = "$target_gen_dir/vector_icons_public.h" - component("gfx") { sources = [ "android/device_display_info.cc", @@ -324,18 +321,6 @@ component("gfx") { sources -= [ "canvas_notimplemented.cc" ] } - # Desktop only. - if (use_aura || (!is_ios && !is_android)) { - sources += [ - "paint_vector_icon.cc", - "paint_vector_icon.h", - "vector_icons.h", - vector_icons_cc_file, - vector_icons_public_h_file, - ] - deps += [ ":aggregate_vector_icons" ] - } - # Windows. if (is_win) { cflags = [ "/wd4324" ] # Structure was padded due to __declspec(align()), which is @@ -388,24 +373,6 @@ component("gfx") { } } -# GYP version: ui/gfx/gfx.gyp:aggregate_vector_icons -action("aggregate_vector_icons") { - script = "vector_icons/aggregate_vector_icons.py" - sources = [ - "vector_icons", - ] - outputs = [ - vector_icons_cc_file, - vector_icons_public_h_file, - ] - - args = [ - "--working_directory=" + rebase_path("vector_icons/"), - "--output_cc=" + rebase_path(vector_icons_cc_file, root_build_dir), - "--output_h=" + rebase_path(vector_icons_public_h_file, root_build_dir), - ] -} - # Looking for gfx_geometry? It's //ui/gfx/geometry:geometry source_set("test_support") { diff --git a/ui/gfx/gfx.gyp b/ui/gfx/gfx.gyp index 8dc8c76..11c1ba6 100644 --- a/ui/gfx/gfx.gyp +++ b/ui/gfx/gfx.gyp @@ -94,7 +94,7 @@ 'GFX_IMPLEMENTATION', ], 'include_dirs': [ - '<(DEPTH)/third_party/icu/source/common', + '<(DEPTH)/third_party/icu/source/common' ], 'sources': [ 'android/device_display_info.cc', @@ -405,42 +405,6 @@ 'render_text_harfbuzz.h', 'text_utils_skia.cc', ], - }, { # desktop platforms - 'variables': { - 'vector_icons_cc_file': '<(INTERMEDIATE_DIR)/ui/gfx/vector_icons.cc', - 'vector_icons_public_h_file': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/vector_icons_public.h', - }, - 'include_dirs': [ - '<(SHARED_INTERMEDIATE_DIR)>', - ], - 'sources': [ - '<(vector_icons_cc_file)', - '<(vector_icons_public_h_file)', - - 'paint_vector_icon.cc', - 'paint_vector_icon.h', - 'vector_icons.h', - ], - 'actions': [ - { - # GN version: //ui/gfx:aggregate_vector_icons - 'action_name': 'aggregate_vector_icons', - 'inputs': [ - 'vector_icons/', - ], - 'outputs': [ - '<(vector_icons_cc_file)', - '<(vector_icons_public_h_file)', - ], - 'action': [ 'python', - 'vector_icons/aggregate_vector_icons.py', - '--working_directory=vector_icons/', - '--output_cc=<(vector_icons_cc_file)', - '--output_h=<(vector_icons_public_h_file)', - ], - 'message': 'Aggregating vector resources.', - }, - ], }], ['use_x11==1', { 'dependencies': [ diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc deleted file mode 100644 index 5260d90..0000000 --- a/ui/gfx/paint_vector_icon.cc +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2015 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/gfx/paint_vector_icon.h" - -#include "ui/gfx/canvas.h" -#include "ui/gfx/vector_icons.h" -#include "ui/gfx/vector_icons_public.h" - -namespace gfx { - -void PaintVectorIcon(Canvas* canvas, - VectorIconId id, - size_t dip_size, - SkColor color) { - DCHECK(VectorIconId::VECTOR_ICON_NONE != id); - const PathElement* path_elements = GetPathForVectorIcon(id); - SkPath path; - path.setFillType(SkPath::kEvenOdd_FillType); - if (dip_size != kReferenceSizeDip) { - SkScalar scale = SkIntToScalar(dip_size) / SkIntToScalar(kReferenceSizeDip); - canvas->sk_canvas()->scale(scale, scale); - } - - for (size_t i = 0; path_elements[i].type != END;) { - switch (path_elements[i++].type) { - case MOVE_TO: { - SkScalar x = path_elements[i++].arg; - SkScalar y = path_elements[i++].arg; - path.moveTo(x, y); - break; - } - - case R_MOVE_TO: { - SkScalar x = path_elements[i++].arg; - SkScalar y = path_elements[i++].arg; - path.rMoveTo(x, y); - break; - } - - case LINE_TO: { - SkScalar x = path_elements[i++].arg; - SkScalar y = path_elements[i++].arg; - path.lineTo(x, y); - break; - } - - case R_LINE_TO: { - SkScalar x = path_elements[i++].arg; - SkScalar y = path_elements[i++].arg; - path.rLineTo(x, y); - break; - } - - case H_LINE_TO: { - SkPoint last_point; - path.getLastPt(&last_point); - SkScalar x = path_elements[i++].arg; - path.lineTo(x, last_point.fY); - break; - } - - case R_H_LINE_TO: { - SkScalar x = path_elements[i++].arg; - path.rLineTo(x, 0); - break; - } - - case V_LINE_TO: { - SkPoint last_point; - path.getLastPt(&last_point); - SkScalar y = path_elements[i++].arg; - path.lineTo(last_point.fX, y); - break; - } - - case R_V_LINE_TO: { - SkScalar y = path_elements[i++].arg; - path.rLineTo(0, y); - break; - } - - case R_CUBIC_TO: { - SkScalar x1 = path_elements[i++].arg; - SkScalar y1 = path_elements[i++].arg; - SkScalar x2 = path_elements[i++].arg; - SkScalar y2 = path_elements[i++].arg; - SkScalar x3 = path_elements[i++].arg; - SkScalar y3 = path_elements[i++].arg; - path.rCubicTo(x1, y1, x2, y2, x3, y3); - break; - } - - case CLOSE: { - path.close(); - break; - } - - case CIRCLE: { - SkScalar x = path_elements[i++].arg; - SkScalar y = path_elements[i++].arg; - SkScalar r = path_elements[i++].arg; - path.addCircle(x, y, r); - break; - } - - case END: - NOTREACHED(); - break; - } - } - - SkPaint paint; - paint.setStyle(SkPaint::kFill_Style); - paint.setAntiAlias(true); - paint.setColor(color); - canvas->DrawPath(path, paint); -} - -} // namespace gfx diff --git a/ui/gfx/paint_vector_icon.h b/ui/gfx/paint_vector_icon.h deleted file mode 100644 index de2fb22..0000000 --- a/ui/gfx/paint_vector_icon.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 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_GFX_PAINT_VECTOR_ICON_H_ -#define UI_GFX_PAINT_VECTOR_ICON_H_ - -#include "base/basictypes.h" -#include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/gfx_export.h" - -namespace gfx { - -class Canvas; -enum class VectorIconId; - -// Draws a vector icon identified by |id| onto |canvas| at (0, 0). |dip_size| -// is the length of a single edge of the square icon, in device independent -// pixels. |color| is used as the fill. -GFX_EXPORT void PaintVectorIcon(Canvas* canvas, - VectorIconId id, - size_t dip_size, - SkColor color); - -} // namespace gfx - -#endif // UI_GFX_PAINT_VECTOR_ICON_H_ diff --git a/ui/gfx/vector_icons.h b/ui/gfx/vector_icons.h deleted file mode 100644 index 1af6e8e..0000000 --- a/ui/gfx/vector_icons.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 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. - -// This file provides defines needed by PaintVectorIcon and is implemented -// by the generated file vector_icons.cc. - -#ifndef UI_GFX_VECTOR_ICONS_H_ -#define UI_GFX_VECTOR_ICONS_H_ - -#include "third_party/skia/include/core/SkScalar.h" - -namespace gfx { - -enum class VectorIconId; - -// The size of a single side of the square canvas to which path coordinates -// are relative, in device independent pixels. -const int kReferenceSizeDip = 48; - -// A path command; each correlates to an SVG path command. -enum CommandType { - MOVE_TO, - R_MOVE_TO, - LINE_TO, - R_LINE_TO, - H_LINE_TO, - R_H_LINE_TO, - V_LINE_TO, - R_V_LINE_TO, - R_CUBIC_TO, - CIRCLE, - CLOSE, - END -}; - -// A POD that describes either a path command or an argument for it. -struct PathElement { - PathElement(CommandType value) : type(value) {} - PathElement(SkScalar value) : arg(value) {} - - union { - CommandType type; - SkScalar arg; - }; -}; - -// Returns an array of path commands and arguments, terminated by END. -const PathElement* GetPathForVectorIcon(VectorIconId id); - -} // namespace gfx - -#endif // UI_GFX_VECTOR_ICONS_H_ diff --git a/ui/gfx/vector_icons/aggregate_vector_icons.py b/ui/gfx/vector_icons/aggregate_vector_icons.py deleted file mode 100644 index 43a63bb..0000000 --- a/ui/gfx/vector_icons/aggregate_vector_icons.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import fileinput -import glob -import optparse -import os -import textwrap - - -def AggregateVectorIcons(working_directory, output_cc, output_h): - """Compiles all .icon files in a directory into two C++ files. - - Args: - working_directory: The path to the directory that holds the .icon files - and C++ templates. - output_cc: The path that should be used to write the .cc file. - output_h: The path that should be used to write the .h file. - """ - - icon_list = glob.glob(working_directory + "*.icon") - - input_header_template = open(os.path.join(working_directory, - "vector_icons_public.h.template")) - header_template_contents = input_header_template.readlines() - input_header_template.close() - output_header = open(output_h, "w") - for line in header_template_contents: - if not "TEMPLATE_PLACEHOLDER" in line: - output_header.write(line) - else: - for icon_path in icon_list: - (icon_name, extension) = os.path.splitext(os.path.basename(icon_path)) - output_header.write(" {},\n".format(icon_name.upper())) - output_header.close() - - input_cc_template = open( - os.path.join(working_directory, "vector_icons.cc.template")) - cc_template_contents = input_cc_template.readlines() - input_cc_template.close() - output_cc = open(output_cc, "w") - for line in cc_template_contents: - if not "TEMPLATE_PLACEHOLDER" in line: - output_cc.write(line) - else: - for icon_path in icon_list: - (icon_name, extension) = os.path.splitext(os.path.basename(icon_path)) - icon_file = open(icon_path) - vector_commands = "".join(icon_file.readlines()) - icon_file.close() - output_cc.write("ICON_TEMPLATE({}, {})\n".format(icon_name.upper(), - vector_commands)) - output_cc.close() - - -def main(): - parser = optparse.OptionParser() - parser.add_option("--working_directory", - help="The directory to look for template C++ as well as " - "icon files.") - parser.add_option("--output_cc", - help="The path to output the CC file to.") - parser.add_option("--output_h", - help="The path to output the header file to.") - - (options, args) = parser.parse_args() - - AggregateVectorIcons(options.working_directory, - options.output_cc, - options.output_h) - - -if __name__ == "__main__": - main() diff --git a/ui/gfx/vector_icons/check_circle.icon b/ui/gfx/vector_icons/check_circle.icon deleted file mode 100644 index 3b1ed2c..0000000 --- a/ui/gfx/vector_icons/check_circle.icon +++ /dev/null @@ -1,9 +0,0 @@ -CIRCLE, 24, 24, 20, -MOVE_TO, 20, 34, -LINE_TO, 10, 24, -R_LINE_TO, 2.83f, -2.83f, -LINE_TO, 20, 28.34f, -R_LINE_TO, 15.17f, -15.17f, -LINE_TO, 38, 16, -LINE_TO, 20, 34, -END diff --git a/ui/gfx/vector_icons/photo_camera.icon b/ui/gfx/vector_icons/photo_camera.icon deleted file mode 100644 index d08bfd9..0000000 --- a/ui/gfx/vector_icons/photo_camera.icon +++ /dev/null @@ -1,17 +0,0 @@ -CIRCLE, 24, 24, 6.4f, -MOVE_TO, 18, 4, -R_LINE_TO, -3.66f, 4, -H_LINE_TO, 8, -R_CUBIC_TO, -2.21f, 0, -4, 1.79f, -4, 4, -R_V_LINE_TO, 24, -R_CUBIC_TO, 0, 2.21f, 1.79f, 4, 4, 4, -R_H_LINE_TO, 32, -R_CUBIC_TO, 2.21f, 0, 4, -1.79f, 4, -4, -V_LINE_TO, 12, -R_CUBIC_TO, 0, -2.21f, -1.79f, -4, -4, -4, -R_H_LINE_TO, -6.34f, -LINE_TO, 30, 4, -H_LINE_TO, 18, -CLOSE, -CIRCLE, 24, 24, 10, -END diff --git a/ui/gfx/vector_icons/vector_icons.cc.template b/ui/gfx/vector_icons/vector_icons.cc.template deleted file mode 100644 index 9c8d3e2..0000000 --- a/ui/gfx/vector_icons/vector_icons.cc.template +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 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. - -// vector_icons.cc.template is used to generate vector_icons.cc. Edit the former -// rather than the latter. - -#include "ui/gfx/vector_icons.h" - -#include "base/logging.h" -#include "ui/gfx/vector_icons_public.h" - -#define ICON_TEMPLATE(icon_name, ...) \ - case VectorIconId::icon_name: {\ - static PathElement path[] = {__VA_ARGS__};\ - return path;\ - } - -namespace gfx { - -const PathElement* GetPathForVectorIcon(VectorIconId id) { - switch (id) { - case VectorIconId::VECTOR_ICON_NONE: - NOTREACHED(); - return nullptr; - -TEMPLATE_PLACEHOLDER - } - - NOTREACHED(); - return nullptr; -} - -} // namespace gfx diff --git a/ui/gfx/vector_icons/vector_icons_public.h.template b/ui/gfx/vector_icons/vector_icons_public.h.template deleted file mode 100644 index 9d51aee..0000000 --- a/ui/gfx/vector_icons/vector_icons_public.h.template +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2015 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. - -// vector_icons.h.template is used to generate vector_icons.h. Edit the former -// rather than the latter. - -#ifndef UI_GFX_VECTOR_ICONS_PUBLIC_H_ -#define UI_GFX_VECTOR_ICONS_PUBLIC_H_ - -namespace gfx { - -enum class VectorIconId { - VECTOR_ICON_NONE, -TEMPLATE_PLACEHOLDER -}; - -} // namespace gfx - -#endif // UI_GFX_VECTOR_ICONS_PUBLIC_H_ |