diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-14 11:38:45 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-14 17:16:47 +0000 |
commit | 3a97ca8dd9b96b599ae2d33e40df0dd2f7ea5859 (patch) | |
tree | 43cc572ba067417c7341db81f71ae7cc6e0fcc3e /chromium/skia | |
parent | f61ab1ac7f855cd281809255c0aedbb1895e1823 (diff) | |
download | qtwebengine-chromium-3a97ca8dd9b96b599ae2d33e40df0dd2f7ea5859.tar.gz |
BASELINE: Update chromium to 45.0.2454.40
Change-Id: Id2121d9f11a8fc633677236c65a3e41feef589e4
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/skia')
26 files changed, 574 insertions, 362 deletions
diff --git a/chromium/skia/BUILD.gn b/chromium/skia/BUILD.gn index 30a04533316..76fc8613f44 100644 --- a/chromium/skia/BUILD.gn +++ b/chromium/skia/BUILD.gn @@ -177,6 +177,7 @@ config("skia_library_config") { # exported to dependents. It's not clear if this is on purpose, but this # matches the GYP build. include_dirs = [ + "//third_party/skia/include/private", "//third_party/skia/src/core", "//third_party/skia/src/image", "//third_party/skia/src/opts", @@ -202,8 +203,7 @@ config("skia_library_config") { if (current_cpu == "arm") { if (arm_use_neon) { defines += [ "SK_ARM_HAS_NEON" ] - } - if (arm_optionally_use_neon) { + } else if (arm_optionally_use_neon) { defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ] } } @@ -277,48 +277,35 @@ config("skia_library_config") { component("skia") { sources = [ # Chrome sources. - "config/SkUserConfig.h", "ext/SkDiscardableMemory_chrome.cc", - "ext/SkDiscardableMemory_chrome.h", "ext/SkMemory_new_handler.cpp", "ext/analysis_canvas.cc", - "ext/analysis_canvas.h", "ext/benchmarking_canvas.cc", - "ext/benchmarking_canvas.h", - "ext/bitmap_platform_device.h", "ext/convolver.cc", - "ext/convolver.h", "ext/event_tracer_impl.cc", - "ext/event_tracer_impl.h", "ext/fontmgr_default_win.cc", - "ext/fontmgr_default_win.h", "ext/google_logging.cc", "ext/image_operations.cc", - "ext/image_operations.h", - "ext/opacity_draw_filter.cc", - "ext/opacity_draw_filter.h", + "ext/opacity_filter_canvas.cc", "ext/pixel_ref_utils.cc", - "ext/pixel_ref_utils.h", "ext/platform_canvas.cc", - "ext/platform_canvas.h", "ext/platform_device.cc", - "ext/platform_device.h", "ext/platform_device_linux.cc", "ext/platform_device_mac.cc", "ext/platform_device_win.cc", "ext/recursive_gaussian_convolution.cc", - "ext/recursive_gaussian_convolution.h", - "ext/refptr.h", "ext/skia_utils_base.cc", - "ext/skia_utils_base.h", - "ext/skia_utils_ios.h", "ext/skia_utils_ios.mm", - "ext/skia_utils_mac.h", "ext/skia_utils_mac.mm", "ext/skia_utils_win.cc", - "ext/skia_utils_win.h", ] + if (current_cpu == "x86" || current_cpu == "x64") { + sources += [ "ext/convolver_SSE2.cc" ] + } else if (current_cpu == "mipsel" && mips_dsp_rev >= 2) { + sources += [ "ext/convolver_mips_dspr2.cc" ] + } + # The skia gypi values are relative to the skia_dir, so we need to rebase. sources += gypi_skia_core.sources sources += gypi_skia_effects.sources @@ -329,10 +316,7 @@ component("skia") { allow_circular_includes_from = [ ":skia_opts" ] if (current_cpu == "arm") { - sources += [ - "//third_party/skia/src/core/SkUtilsArm.cpp", - "//third_party/skia/src/core/SkUtilsArm.h", - ] + sources += [ "//third_party/skia/src/core/SkUtilsArm.cpp" ] } # GPU @@ -343,44 +327,21 @@ component("skia") { # Remove unused util files include in utils.gypi sources -= [ - "//third_party/skia/include/utils/SkBoundaryPatch.h", - "//third_party/skia/include/utils/SkCamera.h", - "//third_party/skia/include/utils/SkCanvasStateUtils.h", - "//third_party/skia/include/utils/SkCubicInterval.h", - "//third_party/skia/include/utils/SkCullPoints.h", - "//third_party/skia/include/utils/SkDebugUtils.h", - "//third_party/skia/include/utils/SkDumpCanvas.h", - "//third_party/skia/include/utils/SkEventTracer.h", - "//third_party/skia/include/utils/SkFrontBufferedStream.h", - "//third_party/skia/include/utils/SkInterpolator.h", - "//third_party/skia/include/utils/SkLayer.h", - "//third_party/skia/include/utils/SkMeshUtils.h", - "//third_party/skia/include/utils/SkNinePatch.h", - "//third_party/skia/include/utils/SkParsePaint.h", - "//third_party/skia/include/utils/SkParsePath.h", - "//third_party/skia/include/utils/SkRandom.h", "//third_party/skia/src/utils/SkBitmapHasher.cpp", - "//third_party/skia/src/utils/SkBitmapHasher.h", "//third_party/skia/src/utils/SkBoundaryPatch.cpp", "//third_party/skia/src/utils/SkCamera.cpp", - "//third_party/skia/src/utils/SkCanvasStack.h", "//third_party/skia/src/utils/SkCubicInterval.cpp", "//third_party/skia/src/utils/SkCullPoints.cpp", "//third_party/skia/src/utils/SkDumpCanvas.cpp", - "//third_party/skia/src/utils/SkFloatUtils.h", "//third_party/skia/src/utils/SkFrontBufferedStream.cpp", "//third_party/skia/src/utils/SkInterpolator.cpp", "//third_party/skia/src/utils/SkLayer.cpp", "//third_party/skia/src/utils/SkMD5.cpp", - "//third_party/skia/src/utils/SkMD5.h", "//third_party/skia/src/utils/SkMeshUtils.cpp", "//third_party/skia/src/utils/SkNinePatch.cpp", "//third_party/skia/src/utils/SkOSFile.cpp", "//third_party/skia/src/utils/SkParsePath.cpp", "//third_party/skia/src/utils/SkSHA1.cpp", - "//third_party/skia/src/utils/SkSHA1.h", - "//third_party/skia/src/utils/SkTFitsIn.h", - "//third_party/skia/src/utils/SkTLogic.h", # We don't currently need to change thread affinity, so leave out this complexity for now. "//third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp", @@ -388,7 +349,6 @@ component("skia") { #testing "//third_party/skia/src/fonts/SkGScalerContext.cpp", - "//third_party/skia/src/fonts/SkGScalerContext.h", ] if (is_win) { @@ -409,10 +369,6 @@ component("skia") { if (is_win) { sources -= [ #windows - "//third_party/skia/include/utils/win/SkAutoCoInitialize.h", - "//third_party/skia/include/utils/win/SkHRESULT.h", - "//third_party/skia/include/utils/win/SkIStream.h", - "//third_party/skia/include/utils/win/SkTScopedComPtr.h", "//third_party/skia/src/utils/win/SkAutoCoInitialize.cpp", "//third_party/skia/src/utils/win/SkIStream.cpp", "//third_party/skia/src/utils/win/SkWGL_win.cpp", @@ -437,16 +393,15 @@ component("skia") { "//third_party/skia/src/ports/SkOSFile_win.cpp", "//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp", "//third_party/skia/src/ports/SkScalerContext_win_dw.cpp", - "//third_party/skia/src/ports/SkScalerContext_win_dw.h", "//third_party/skia/src/ports/SkTLS_win.cpp", "//third_party/skia/src/ports/SkTypeface_win_dw.cpp", - "//third_party/skia/src/ports/SkTypeface_win_dw.h", ] } if (!is_android) { sources -= [ - "//third_party/skia/src/ports/SkFontConfigParser_android.cpp", "//third_party/skia/src/ports/SkFontMgr_android.cpp", + "//third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + "//third_party/skia/src/ports/SkFontMgr_android_parser.cpp", ] } if (!is_mac) { @@ -470,25 +425,13 @@ component("skia") { # Select the right BitmapPlatformDevice. if (is_win) { - sources += [ - "ext/bitmap_platform_device_win.cc", - "ext/bitmap_platform_device_win.h", - ] + sources += [ "ext/bitmap_platform_device_win.cc" ] } else if (is_mac) { - sources += [ - "ext/bitmap_platform_device_mac.cc", - "ext/bitmap_platform_device_mac.h", - ] + sources += [ "ext/bitmap_platform_device_mac.cc" ] } else if (use_cairo) { - sources += [ - "ext/bitmap_platform_device_cairo.cc", - "ext/bitmap_platform_device_cairo.h", - ] + sources += [ "ext/bitmap_platform_device_cairo.cc" ] } else { - sources += [ - "ext/bitmap_platform_device_skia.cc", - "ext/bitmap_platform_device_skia.h", - ] + sources += [ "ext/bitmap_platform_device_skia.cc" ] } if (is_clang) { @@ -529,7 +472,7 @@ component("skia") { set_sources_assignment_filter(sources_assignment_filter) deps += [ "//third_party/expat", - "//third_party/freetype", + "//third_party/freetype-android:freetype", "//third_party/android_tools:cpu_features", ] } @@ -546,24 +489,54 @@ component("skia") { } # Separated out so it can be compiled with different flags for SSE. +if (current_cpu == "x86" || current_cpu == "x64") { + source_set("skia_opts_sse3") { + sources = gypi_skia_opts.ssse3_sources + if (!is_win || is_clang) { + cflags = [ "-mssse3" ] + } + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=31" ] + } + visibility = [ ":skia_opts" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ + ":skia_config", + ":skia_library_config", + "//build/config/compiler:no_chromium_code", + ] + } + source_set("skia_opts_sse4") { + sources = gypi_skia_opts.sse41_sources + if (!is_win || is_clang) { + cflags = [ "-msse4.1" ] + } + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=41" ] + } + visibility = [ ":skia_opts" ] + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ + ":skia_config", + ":skia_library_config", + "//build/config/compiler:no_chromium_code", + ] + } +} source_set("skia_opts") { cflags = [] defines = [] + deps = [ + "//base", + ] + if (current_cpu == "x86" || current_cpu == "x64") { - sources = gypi_skia_opts.sse2_sources + gypi_skia_opts.ssse3_sources + - gypi_skia_opts.sse41_sources + - [ - # Chrome-specific. - "ext/convolver_SSE2.cc", - "ext/convolver_SSE2.h", - ] - - if (is_linux || is_mac) { - cflags += [ "-msse4.1" ] - } else if (is_win) { - defines += [ "SK_CPU_SSE_LEVEL=41" ] - } + sources = gypi_skia_opts.sse2_sources + deps += [ + ":skia_opts_sse3", + ":skia_opts_sse4", + ] } else if (current_cpu == "arm") { # The assembly uses the frame pointer register (r7 in Thumb/r11 in # ARM), the compiler doesn't like that. @@ -589,13 +562,6 @@ source_set("skia_opts") { if (mips_dsp_rev >= 1) { sources = gypi_skia_opts.mips_dsp_sources - if (mips_dsp_rev >= 2) { - sources += [ - # Chrome-specific. - "ext/convolver_mips_dspr2.cc", - "ext/convolver_mips_dspr2.h", - ] - } } else { sources = gypi_skia_opts.none_sources } @@ -615,10 +581,6 @@ source_set("skia_opts") { "//build/config/compiler:no_chromium_code", ] - deps = [ - "//base", - ] - visibility = [ ":skia" ] } diff --git a/chromium/skia/config/SkUserConfig.h b/chromium/skia/config/SkUserConfig.h index 06c49e735c8..165a17a5d83 100644 --- a/chromium/skia/config/SkUserConfig.h +++ b/chromium/skia/config/SkUserConfig.h @@ -245,44 +245,32 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, # define SK_SUPPORT_LEGACY_GETTOPDEVICE #endif -#ifndef SK_SUPPORT_LEGACY_IMAGEFILTER_CTM -# define SK_SUPPORT_LEGACY_IMAGEFILTER_CTM -#endif - -#ifndef SK_LEGACY_DRAWPICTURECALLBACK -# define SK_LEGACY_DRAWPICTURECALLBACK -#endif - #ifndef SK_SUPPORT_LEGACY_GETDEVICE # define SK_SUPPORT_LEGACY_GETDEVICE #endif -#ifndef SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS -# define SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS -#endif - #ifndef SK_IGNORE_ETC1_SUPPORT # define SK_IGNORE_ETC1_SUPPORT #endif -#ifndef SK_SUPPORT_LEGACY_IMAGEFILTER_TRANSFORM_SCRATCH_LAYTER -# define SK_SUPPORT_LEGACY_IMAGEFILTER_TRANSFORM_SCRATCH_LAYTER +#ifndef SK_SUPPORT_LEGACY_ONDRAWIMAGERECT +# define SK_SUPPORT_LEGACY_ONDRAWIMAGERECT #endif #ifndef SK_IGNORE_GPU_DITHER # define SK_IGNORE_GPU_DITHER #endif -#ifndef SK_SUPPORT_LEGACY_INT_COLORMATRIX -# define SK_SUPPORT_LEGACY_INT_COLORMATRIX +#ifndef SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT +# define SK_SUPPORT_LEGACY_UNBALANCED_PIXELREF_LOCKCOUNT #endif -#ifndef SK_LEGACY_STROKE_CURVES -# define SK_LEGACY_STROKE_CURVES +#ifndef SK_SUPPORT_LEGACY_XFERMODES +# define SK_SUPPORT_LEGACY_XFERMODES #endif -#ifndef SK_PREFER_LEGACY_FLOAT_XFERMODES -# define SK_PREFER_LEGACY_FLOAT_XFERMODES +#ifndef SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS +# define SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS #endif ///////////////////////// Imported from BUILD.gn and skia_common.gypi diff --git a/chromium/skia/ext/SkMemory_new_handler.cpp b/chromium/skia/ext/SkMemory_new_handler.cpp index 7400c71809b..d4080a13447 100644 --- a/chromium/skia/ext/SkMemory_new_handler.cpp +++ b/chromium/skia/ext/SkMemory_new_handler.cpp @@ -2,21 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdio.h> #include <stdlib.h> -#include <new> #include "base/process/memory.h" #include "third_party/skia/include/core/SkTypes.h" -#include "third_party/skia/include/core/SkThread.h" -// This implementation of sk_malloc_flags() and friends is identical to -// SkMemory_malloc.cpp, except that it disables the CRT's new_handler during -// malloc() and calloc() when SK_MALLOC_THROW is not set (because our normal -// new_handler itself will crash on failure when using tcmalloc). - -SK_DECLARE_STATIC_MUTEX(gSkNewHandlerMutex); +// This implementation of sk_malloc_flags() and friends is similar to +// SkMemory_malloc.cpp, except it uses base::UncheckedMalloc and friends +// for non-SK_MALLOC_THROW calls. +// +// The name of this file is historic: a previous implementation tried to +// use std::set_new_handler() for the same effect, but it didn't actually work. static inline void* throw_on_failure(size_t size, void* p) { if (size > 0 && p == NULL) { @@ -46,21 +43,35 @@ void sk_free(void* p) { } } +// We get lots of bugs filed on us that amount to overcommiting bitmap memory, +// then some time later failing to back that VM with physical memory. +// They're hard to track down, so in Debug mode we touch all memory right up front. +// +// For malloc, fill is an arbitrary byte and ideally not 0. For calloc, it's got to be 0. +static void* prevent_overcommit(int fill, size_t size, void* p) { + // We probably only need to touch one byte per page, but memset makes things easy. + SkDEBUGCODE(memset(p, fill, size)); + return p; +} + void* sk_malloc_throw(size_t size) { - return throw_on_failure(size, malloc(size)); + return prevent_overcommit(0x42, size, throw_on_failure(size, malloc(size))); } static void* sk_malloc_nothrow(size_t size) { // TODO(b.kelemen): we should always use UncheckedMalloc but currently it // doesn't work as intended everywhere. + void* result; #if defined(OS_IOS) - return malloc(size); + result = malloc(size); #else - void* result; // It's the responsibility of the caller to check the return value. ignore_result(base::UncheckedMalloc(size, &result)); - return result; #endif + if (result) { + prevent_overcommit(0x47, size, result); + } + return result; } void* sk_malloc_flags(size_t size, unsigned flags) { @@ -71,18 +82,21 @@ void* sk_malloc_flags(size_t size, unsigned flags) { } void* sk_calloc_throw(size_t size) { - return throw_on_failure(size, calloc(size, 1)); + return prevent_overcommit(0, size, throw_on_failure(size, calloc(size, 1))); } void* sk_calloc(size_t size) { // TODO(b.kelemen): we should always use UncheckedCalloc but currently it // doesn't work as intended everywhere. + void* result; #if defined(OS_IOS) - return calloc(1, size); + result = calloc(1, size); #else - void* result; // It's the responsibility of the caller to check the return value. ignore_result(base::UncheckedCalloc(size, 1, &result)); - return result; #endif + if (result) { + prevent_overcommit(0, size, result); + } + return result; } diff --git a/chromium/skia/ext/analysis_canvas.cc b/chromium/skia/ext/analysis_canvas.cc index 1b8694a1ccc..102c63e1601 100644 --- a/chromium/skia/ext/analysis_canvas.cc +++ b/chromium/skia/ext/analysis_canvas.cc @@ -351,7 +351,7 @@ bool AnalysisCanvas::GetColorIfSolid(SkColor* color) const { return false; } -bool AnalysisCanvas::abortDrawing() { +bool AnalysisCanvas::abort() { // Early out as soon as we have more than one draw op. // TODO(vmpstr): Investigate if 1 is the correct metric here. We need to // balance the amount of time we spend analyzing vs how many tiles would be diff --git a/chromium/skia/ext/analysis_canvas.h b/chromium/skia/ext/analysis_canvas.h index 1ae2a2d1194..5a596475dfd 100644 --- a/chromium/skia/ext/analysis_canvas.h +++ b/chromium/skia/ext/analysis_canvas.h @@ -7,7 +7,7 @@ #include "base/compiler_specific.h" #include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkDrawPictureCallback.h" +#include "third_party/skia/include/core/SkPicture.h" namespace skia { @@ -15,7 +15,7 @@ namespace skia { // (specified as a clip rectangle) of an SkPicture as the picture is // played back through it. // To use: play a picture into the canvas, and then check result. -class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback { +class SK_API AnalysisCanvas : public SkCanvas, public SkPicture::AbortCallback { public: AnalysisCanvas(int width, int height); ~AnalysisCanvas() override; @@ -26,8 +26,8 @@ class SK_API AnalysisCanvas : public SkCanvas, public SkDrawPictureCallback { void SetForceNotSolid(bool flag); void SetForceNotTransparent(bool flag); - // SkDrawPictureCallback override. - bool abortDrawing() override; + // SkPicture::AbortCallback override. + bool abort() override; // SkCanvas overrides. void onDrawPaint(const SkPaint& paint) override; diff --git a/chromium/skia/ext/analysis_canvas_unittest.cc b/chromium/skia/ext/analysis_canvas_unittest.cc index db8e7a2512f..5436b8130c9 100644 --- a/chromium/skia/ext/analysis_canvas_unittest.cc +++ b/chromium/skia/ext/analysis_canvas_unittest.cc @@ -358,7 +358,7 @@ TEST(AnalysisCanvasTest, EarlyOutNotSolid) { EXPECT_FALSE(canvas.GetColorIfSolid(&output_color)); // Verify that we aborted drawing. - EXPECT_TRUE(canvas.abortDrawing()); + EXPECT_TRUE(canvas.abort()); } TEST(AnalysisCanvasTest, ClipComplexRegion) { diff --git a/chromium/skia/ext/opacity_draw_filter.cc b/chromium/skia/ext/opacity_draw_filter.cc deleted file mode 100644 index 10ed9e8f6c1..00000000000 --- a/chromium/skia/ext/opacity_draw_filter.cc +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 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 "skia/ext/opacity_draw_filter.h" -#include "third_party/skia/include/core/SkPaint.h" - -namespace skia { - -OpacityDrawFilter::OpacityDrawFilter(float opacity, - bool disable_image_filtering) - : alpha_(SkScalarRoundToInt(opacity * 255)), - disable_image_filtering_(disable_image_filtering) {} - -OpacityDrawFilter::~OpacityDrawFilter() {} - -bool OpacityDrawFilter::filter(SkPaint* paint, Type type) { - if (alpha_ < 255) - paint->setAlpha(alpha_); - if (disable_image_filtering_) - paint->setFilterQuality(kNone_SkFilterQuality); - return true; -} - -} // namespace skia - - diff --git a/chromium/skia/ext/opacity_draw_filter.h b/chromium/skia/ext/opacity_draw_filter.h deleted file mode 100644 index 7d11d689e16..00000000000 --- a/chromium/skia/ext/opacity_draw_filter.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 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 SKIA_EXT_OPACITY_DRAW_FILTER_H -#define SKIA_EXT_OPACITY_DRAW_FILTER_H - -#include "base/values.h" -#include "third_party/skia/include/core/SkDrawFilter.h" - -class SkPaint; - -namespace skia { - -// This filter allows setting an opacity on every draw call to a canvas, and to -// disable image filtering. Note that the opacity setting is only correct in -// very limited conditions: when there is only zero or one opaque, nonlayer -// draw for every pixel in the surface. -class SK_API OpacityDrawFilter : public SkDrawFilter { - public: - OpacityDrawFilter(float opacity, bool disable_image_filtering); - ~OpacityDrawFilter() override; - bool filter(SkPaint* paint, SkDrawFilter::Type type) override; - - private: - int alpha_; - bool disable_image_filtering_; -}; - -} // namespace skia - -#endif // SKIA_EXT_OPACITY_DRAW_FILTER_H - diff --git a/chromium/skia/ext/opacity_filter_canvas.cc b/chromium/skia/ext/opacity_filter_canvas.cc new file mode 100644 index 00000000000..11c8135d0e1 --- /dev/null +++ b/chromium/skia/ext/opacity_filter_canvas.cc @@ -0,0 +1,40 @@ +// 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 "skia/ext/opacity_filter_canvas.h" +#include "third_party/skia/include/core/SkPaint.h" +#include "third_party/skia/include/core/SkTLazy.h" + +namespace skia { + +OpacityFilterCanvas::OpacityFilterCanvas(SkCanvas* canvas, + float opacity, + bool disable_image_filtering) + : INHERITED(canvas->imageInfo().width(), canvas->imageInfo().height()), + alpha_(SkScalarRoundToInt(opacity * 255)), + disable_image_filtering_(disable_image_filtering) { + this->addCanvas(canvas); +} + +void OpacityFilterCanvas::onFilterPaint(SkPaint* paint, Type) const { + if (alpha_ < 255) + paint->setAlpha(alpha_); + + if (disable_image_filtering_) + paint->setFilterQuality(kNone_SkFilterQuality); +} + +void OpacityFilterCanvas::onDrawPicture(const SkPicture* picture, + const SkMatrix* matrix, + const SkPaint* paint) { + SkTLazy<SkPaint> filteredPaint; + if (paint) { + this->onFilterPaint(filteredPaint.set(*paint), kPicture_Type); + } + + // Unfurl pictures in order to filter nested paints. + this->SkCanvas::onDrawPicture(picture, matrix, filteredPaint.getMaybeNull()); +} + +} // namespace skia diff --git a/chromium/skia/ext/opacity_filter_canvas.h b/chromium/skia/ext/opacity_filter_canvas.h new file mode 100644 index 00000000000..ee3eca6e1d6 --- /dev/null +++ b/chromium/skia/ext/opacity_filter_canvas.h @@ -0,0 +1,38 @@ +// 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 SKIA_EXT_OPACITY_FILTER_CANVAS_H +#define SKIA_EXT_OPACITY_FILTER_CANVAS_H + +#include "third_party/skia/include/utils/SkPaintFilterCanvas.h" + +namespace skia { + +// This filter canvas allows setting an opacity on every draw call to a canvas, +// and to disable image filtering. Note that the opacity setting is only +// correct in very limited conditions: when there is only zero or one opaque, +// nonlayer draw for every pixel in the surface. +class SK_API OpacityFilterCanvas : public SkPaintFilterCanvas { + public: + OpacityFilterCanvas(SkCanvas* canvas, + float opacity, + bool disable_image_filtering); + + protected: + void onFilterPaint(SkPaint* paint, Type type) const override; + + void onDrawPicture(const SkPicture* picture, + const SkMatrix* matrix, + const SkPaint* paint) override; + + private: + typedef SkPaintFilterCanvas INHERITED; + + int alpha_; + bool disable_image_filtering_; +}; + +} // namespace skia + +#endif // SKIA_EXT_OPACITY_FILTER_CANVAS_H diff --git a/chromium/skia/ext/pixel_ref_utils_unittest.cc b/chromium/skia/ext/pixel_ref_utils_unittest.cc index 6ab2f62902e..2e1fa245050 100644 --- a/chromium/skia/ext/pixel_ref_utils_unittest.cc +++ b/chromium/skia/ext/pixel_ref_utils_unittest.cc @@ -52,7 +52,6 @@ class TestDiscardableShader : public SkShader { // leap yet. private: static SkFlattenable* CreateProc(SkReadBuffer&); - friend class SkPrivateEffectInitializer; public: Factory getFactory() const override { return CreateProc; } diff --git a/chromium/skia/ext/skia_utils_base.cc b/chromium/skia/ext/skia_utils_base.cc index 56ca9930810..af6957dfdde 100644 --- a/chromium/skia/ext/skia_utils_base.cc +++ b/chromium/skia/ext/skia_utils_base.cc @@ -6,7 +6,7 @@ namespace skia { -bool ReadSkString(PickleIterator* iter, SkString* str) { +bool ReadSkString(base::PickleIterator* iter, SkString* str) { int reply_length; const char* reply_text; @@ -18,7 +18,7 @@ bool ReadSkString(PickleIterator* iter, SkString* str) { return true; } -bool ReadSkFontIdentity(PickleIterator* iter, +bool ReadSkFontIdentity(base::PickleIterator* iter, SkFontConfigInterface::FontIdentity* identity) { uint32_t reply_id; uint32_t reply_ttcIndex; @@ -38,16 +38,40 @@ bool ReadSkFontIdentity(PickleIterator* iter, return true; } -bool WriteSkString(Pickle* pickle, const SkString& str) { +bool WriteSkString(base::Pickle* pickle, const SkString& str) { return pickle->WriteData(str.c_str(), str.size()); } -bool WriteSkFontIdentity(Pickle* pickle, +bool WriteSkFontIdentity(base::Pickle* pickle, const SkFontConfigInterface::FontIdentity& identity) { return pickle->WriteUInt32(identity.fID) && pickle->WriteUInt32(identity.fTTCIndex) && WriteSkString(pickle, identity.fString); } +SkPixelGeometry ComputeDefaultPixelGeometry() { + SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder(); + if (SkFontHost::kNONE_LCDOrder == order) { + return kUnknown_SkPixelGeometry; + } else { + // Bit0 is RGB(0), BGR(1) + // Bit1 is H(0), V(1) + const SkPixelGeometry gGeo[] = { + kRGB_H_SkPixelGeometry, + kBGR_H_SkPixelGeometry, + kRGB_V_SkPixelGeometry, + kBGR_V_SkPixelGeometry, + }; + int index = 0; + if (SkFontHost::kBGR_LCDOrder == order) { + index |= 1; + } + if (SkFontHost::kVertical_LCDOrientation == SkFontHost::GetSubpixelOrientation()){ + index |= 2; + } + return gGeo[index]; + } +} + } // namespace skia diff --git a/chromium/skia/ext/skia_utils_base.h b/chromium/skia/ext/skia_utils_base.h index 01cf8edd11f..77a9490bf61 100644 --- a/chromium/skia/ext/skia_utils_base.h +++ b/chromium/skia/ext/skia_utils_base.h @@ -7,26 +7,31 @@ #include "base/pickle.h" #include "third_party/skia/include/ports/SkFontConfigInterface.h" +#include "third_party/skia/include/core/SkFontHost.h" +#include "third_party/skia/include/core/SkSurfaceProps.h" namespace skia { // Return true if the pickle/iterator contains a string. If so, and if str // is not null, copy that string into str. -SK_API bool ReadSkString(PickleIterator* iter, SkString* str); +SK_API bool ReadSkString(base::PickleIterator* iter, SkString* str); // Return true if the pickle/iterator contains a FontIdentity. If so, and if // identity is not null, copy it into identity. -SK_API bool ReadSkFontIdentity(PickleIterator* iter, +SK_API bool ReadSkFontIdentity(base::PickleIterator* iter, SkFontConfigInterface::FontIdentity* identity); // Return true if str can be written into the request pickle. -SK_API bool WriteSkString(Pickle* pickle, const SkString& str); +SK_API bool WriteSkString(base::Pickle* pickle, const SkString& str); // Return true if identity can be written into the request pickle. SK_API bool WriteSkFontIdentity( - Pickle* pickle, + base::Pickle* pickle, const SkFontConfigInterface::FontIdentity& identity); +// Determine the default pixel geometry (for LCD) by querying the font host +SK_API SkPixelGeometry ComputeDefaultPixelGeometry(); + } // namespace skia #endif // SKIA_EXT_SKIA_UTILS_BASE_H_ diff --git a/chromium/skia/public/BUILD.gn b/chromium/skia/public/BUILD.gn new file mode 100644 index 00000000000..ce407dfacf0 --- /dev/null +++ b/chromium/skia/public/BUILD.gn @@ -0,0 +1,20 @@ +# 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. + +source_set("public") { + sources = [ + "type_converters.cc", + "type_converters.h", + ] + + public_deps = [ + "//skia/public/interfaces", + ] + + deps = [ + "//base", + "//skia", + "//third_party/mojo/src/mojo/public/cpp/bindings", + ] +} diff --git a/chromium/skia/public/interfaces/BUILD.gn b/chromium/skia/public/interfaces/BUILD.gn new file mode 100644 index 00000000000..ea57c5032c6 --- /dev/null +++ b/chromium/skia/public/interfaces/BUILD.gn @@ -0,0 +1,11 @@ +# 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("//third_party/mojo/src/mojo/public/tools/bindings/mojom.gni") + +mojom("interfaces") { + sources = [ + "bitmap.mojom", + ] +} diff --git a/chromium/skia/public/interfaces/bitmap.mojom b/chromium/skia/public/interfaces/bitmap.mojom new file mode 100644 index 00000000000..fd3412013fd --- /dev/null +++ b/chromium/skia/public/interfaces/bitmap.mojom @@ -0,0 +1,43 @@ +// 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 contains structures used to represent SkBitmaps in Mojo. +module skia; + +// Mirror of SkColorType. +enum ColorType { + UNKNOWN, + ALPHA_8, + RGB_565, + ARGB_4444, + RGBA_8888, + BGRA_8888, + INDEX_8, + GRAY_8, +}; + +// Mirror of SkAlphaType. +enum AlphaType { + UNKNOWN, + OPAQUE, + PREMUL, + UNPREMUL, +}; + +// Mirror of SkColorProfileType. +enum ColorProfileType { + LINEAR, + SRGB, +}; + +struct Bitmap { + ColorType color_type; + AlphaType alpha_type; + ColorProfileType profile_type; + + uint32 width; + uint32 height; + + array<uint8> pixel_data; +}; diff --git a/chromium/skia/public/type_converters.cc b/chromium/skia/public/type_converters.cc new file mode 100644 index 00000000000..143710b6cc9 --- /dev/null +++ b/chromium/skia/public/type_converters.cc @@ -0,0 +1,139 @@ +// 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 "skia/public/type_converters.h" + +#include <string.h> + +#include "base/logging.h" +#include "third_party/skia/include/core/SkBitmap.h" + +namespace mojo { + +namespace { + +SkColorType MojoColorTypeToSk(skia::ColorType type) { + switch (type) { + case skia::COLOR_TYPE_UNKNOWN: + return kUnknown_SkColorType; + case skia::COLOR_TYPE_ALPHA_8: + return kAlpha_8_SkColorType; + case skia::COLOR_TYPE_RGB_565: + return kRGB_565_SkColorType; + case skia::COLOR_TYPE_ARGB_4444: + return kARGB_4444_SkColorType; + case skia::COLOR_TYPE_RGBA_8888: + return kRGBA_8888_SkColorType; + case skia::COLOR_TYPE_BGRA_8888: + return kBGRA_8888_SkColorType; + case skia::COLOR_TYPE_INDEX_8: + return kIndex_8_SkColorType; + case skia::COLOR_TYPE_GRAY_8: + return kGray_8_SkColorType; + default: + NOTREACHED(); + } + return kUnknown_SkColorType; +} + +SkAlphaType MojoAlphaTypeToSk(skia::AlphaType type) { + switch (type) { + case skia::ALPHA_TYPE_UNKNOWN: + return kUnknown_SkAlphaType; + case skia::ALPHA_TYPE_OPAQUE: + return kOpaque_SkAlphaType; + case skia::ALPHA_TYPE_PREMUL: + return kPremul_SkAlphaType; + case skia::ALPHA_TYPE_UNPREMUL: + return kUnpremul_SkAlphaType; + default: + NOTREACHED(); + } + return kUnknown_SkAlphaType; +} + +skia::ColorType SkColorTypeToMojo(SkColorType type) { + switch (type) { + case kUnknown_SkColorType: + return skia::COLOR_TYPE_UNKNOWN; + case kAlpha_8_SkColorType: + return skia::COLOR_TYPE_ALPHA_8; + case kRGB_565_SkColorType: + return skia::COLOR_TYPE_RGB_565; + case kARGB_4444_SkColorType: + return skia::COLOR_TYPE_ARGB_4444; + case kRGBA_8888_SkColorType: + return skia::COLOR_TYPE_RGBA_8888; + case kBGRA_8888_SkColorType: + return skia::COLOR_TYPE_BGRA_8888; + case kIndex_8_SkColorType: + return skia::COLOR_TYPE_INDEX_8; + case kGray_8_SkColorType: + return skia::COLOR_TYPE_GRAY_8; + default: + NOTREACHED(); + } + return skia::COLOR_TYPE_UNKNOWN; +} + +skia::AlphaType SkAlphaTypeToMojo(SkAlphaType type) { + switch (type) { + case kUnknown_SkAlphaType: + return skia::ALPHA_TYPE_UNKNOWN; + case kOpaque_SkAlphaType: + return skia::ALPHA_TYPE_OPAQUE; + case kPremul_SkAlphaType: + return skia::ALPHA_TYPE_PREMUL; + case kUnpremul_SkAlphaType: + return skia::ALPHA_TYPE_UNPREMUL; + default: + NOTREACHED(); + } + return skia::ALPHA_TYPE_UNKNOWN; +} + +} // namespace + +SkBitmap TypeConverter<SkBitmap, skia::BitmapPtr>::Convert( + const skia::BitmapPtr& image) { + SkBitmap bitmap; + if (image.is_null()) + return bitmap; + if (!bitmap.tryAllocPixels(SkImageInfo::Make( + image->width, image->height, MojoColorTypeToSk(image->color_type), + MojoAlphaTypeToSk(image->alpha_type)))) { + return SkBitmap(); + } + if (bitmap.getSize() != image->pixel_data.size() || !bitmap.getPixels()) { + return SkBitmap(); + } + + memcpy(bitmap.getPixels(), &image->pixel_data[0], bitmap.getSize()); + return bitmap; +} + +skia::BitmapPtr TypeConverter<skia::BitmapPtr, SkBitmap>::Convert( + const SkBitmap& bitmap) { + if (bitmap.isNull()) + return nullptr; + + // NOTE: This code doesn't correctly serialize Index8 bitmaps. + const SkImageInfo& info = bitmap.info(); + DCHECK_NE(info.colorType(), kIndex_8_SkColorType); + if (info.colorType() == kIndex_8_SkColorType) + return nullptr; + skia::BitmapPtr result = skia::Bitmap::New(); + result->color_type = SkColorTypeToMojo(info.colorType()); + result->alpha_type = SkAlphaTypeToMojo(info.alphaType()); + result->width = info.width(); + result->height = info.height(); + size_t size = bitmap.getSize(); + size_t row_bytes = bitmap.rowBytes(); + result->pixel_data = mojo::Array<uint8_t>::New(size); + if (!bitmap.readPixels(info, &result->pixel_data[0], row_bytes, 0, 0)) + return nullptr; + return result.Pass(); +} + +} // namespace mojo diff --git a/chromium/skia/public/type_converters.h b/chromium/skia/public/type_converters.h new file mode 100644 index 00000000000..341fc69ecc1 --- /dev/null +++ b/chromium/skia/public/type_converters.h @@ -0,0 +1,26 @@ +// 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 SKIA_PUBLIC_TYPE_CONVERTERS_H_ +#define SKIA_PUBLIC_TYPE_CONVERTERS_H_ + +#include "skia/public/interfaces/bitmap.mojom.h" + +class SkBitmap; + +namespace mojo { + +template <> +struct TypeConverter<SkBitmap, skia::BitmapPtr> { + static SkBitmap Convert(const skia::BitmapPtr& image); +}; + +template <> +struct TypeConverter<skia::BitmapPtr, SkBitmap> { + static skia::BitmapPtr Convert(const SkBitmap& bitmap); +}; + +} // namespace mojo + +#endif // SKIA_PUBLIC_TYPE_CONVERTERS_H_ diff --git a/chromium/skia/skia.gyp b/chromium/skia/skia.gyp index 0f13b69bafd..ca063d13be3 100644 --- a/chromium/skia/skia.gyp +++ b/chromium/skia/skia.gyp @@ -14,8 +14,8 @@ 'target_name': 'skia_library', 'type': 'static_library', 'includes': [ - 'skia_library.gypi', 'skia_common.gypi', + 'skia_library.gypi', '../build/android/increase_size_for_speed.gypi', # Disable LTO due to compiler error # in mems_in_disjoint_alias_sets_p, at alias.c:393 @@ -56,9 +56,12 @@ 'target_name': 'skia', 'type': 'shared_library', 'includes': [ - 'skia_library.gypi', - 'skia_chrome.gypi', + # Include skia_common.gypi first since it contains filename + # exclusion rules. This allows the following includes to override + # the exclusion rules. 'skia_common.gypi', + 'skia_chrome.gypi', + 'skia_library.gypi', '../build/android/increase_size_for_speed.gypi', ], 'defines': [ @@ -88,37 +91,6 @@ # targets that are not dependent upon the component type 'targets': [ { - 'target_name': 'skia_chrome_opts', - 'type': 'static_library', - 'include_dirs': [ - '..', - 'config', - '../third_party/skia/include/core', - ], - 'conditions': [ - [ 'os_posix == 1 and OS != "mac" and OS != "android" and \ - target_arch != "arm" and target_arch != "mipsel" and \ - target_arch != "arm64" and target_arch != "mips64el"', { - 'cflags': [ - '-msse2', - ], - }], - [ 'target_arch != "arm" and target_arch != "mipsel" and \ - target_arch != "arm64" and target_arch != "mips64el"', { - 'sources': [ - 'ext/convolver_SSE2.cc', - 'ext/convolver_SSE2.h', - ], - }], - [ 'target_arch == "mipsel" and mips_dsp_rev >= 2',{ - 'sources': [ - 'ext/convolver_mips_dspr2.cc', - 'ext/convolver_mips_dspr2.h', - ], - }], - ], - }, - { 'target_name': 'image_operations_bench', 'type': 'executable', 'dependencies': [ @@ -147,5 +119,21 @@ '../build/android/increase_size_for_speed.gypi', ], }, + { + 'target_name': 'skia_mojo', + 'type': 'static_library', + 'dependencies': [ + 'skia', + '../base/base.gyp:base', + ], + 'includes': [ + '../third_party/mojo/mojom_bindings_generator.gypi', + ], + 'sources': [ + # Note: file list duplicated in GN build. + 'public/interfaces/bitmap.mojom', + 'public/type_converters.cc', + ], + }, ], } diff --git a/chromium/skia/skia_chrome.gypi b/chromium/skia/skia_chrome.gypi index d689a9215bd..f9f92ebfb56 100644 --- a/chromium/skia/skia_chrome.gypi +++ b/chromium/skia/skia_chrome.gypi @@ -9,7 +9,6 @@ { 'dependencies': [ 'skia_library', - 'skia_chrome_opts', '../base/base.gyp:base', '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', ], @@ -27,56 +26,32 @@ ], }, 'sources': [ - 'config/SkUserConfig.h', - # Note: file list duplicated in GN build. 'ext/analysis_canvas.cc', - 'ext/analysis_canvas.h', 'ext/benchmarking_canvas.cc', - 'ext/benchmarking_canvas.h', - 'ext/bitmap_platform_device.h', 'ext/bitmap_platform_device_cairo.cc', - 'ext/bitmap_platform_device_cairo.h', 'ext/bitmap_platform_device_mac.cc', - 'ext/bitmap_platform_device_mac.h', 'ext/bitmap_platform_device_skia.cc', - 'ext/bitmap_platform_device_skia.h', 'ext/bitmap_platform_device_win.cc', - 'ext/bitmap_platform_device_win.h', 'ext/convolver.cc', - 'ext/convolver.h', 'ext/event_tracer_impl.cc', - 'ext/event_tracer_impl.h', 'ext/fontmgr_default_win.cc', - 'ext/fontmgr_default_win.h', 'ext/google_logging.cc', 'ext/image_operations.cc', - 'ext/image_operations.h', - 'ext/opacity_draw_filter.cc', - 'ext/opacity_draw_filter.h', + 'ext/opacity_filter_canvas.cc', 'ext/pixel_ref_utils.cc', - 'ext/pixel_ref_utils.h', 'ext/platform_canvas.cc', - 'ext/platform_canvas.h', 'ext/platform_device.cc', - 'ext/platform_device.h', 'ext/platform_device_linux.cc', 'ext/platform_device_mac.cc', 'ext/platform_device_win.cc', 'ext/recursive_gaussian_convolution.cc', - 'ext/recursive_gaussian_convolution.h', - 'ext/refptr.h', - 'ext/SkDiscardableMemory_chrome.h', 'ext/SkDiscardableMemory_chrome.cc', 'ext/SkMemory_new_handler.cpp', 'ext/skia_utils_base.cc', - 'ext/skia_utils_base.h', 'ext/skia_utils_ios.mm', - 'ext/skia_utils_ios.h', 'ext/skia_utils_mac.mm', - 'ext/skia_utils_mac.h', 'ext/skia_utils_win.cc', - 'ext/skia_utils_win.h', ], 'conditions': [ [ 'OS == "android" and ' @@ -85,16 +60,22 @@ 'ext/skia_utils_base.cc', ], }], - ['OS == "ios"', { - 'dependencies!': [ - 'skia_chrome_opts', - ], - }], [ 'OS != "android" and (OS != "linux" or use_cairo==1)', { 'sources!': [ 'ext/bitmap_platform_device_skia.cc', ], }], + [ 'OS != "ios" and target_arch != "arm" and target_arch != "mipsel" and \ + target_arch != "arm64" and target_arch != "mips64el"', { + 'sources': [ + 'ext/convolver_SSE2.cc', + ], + }], + [ 'target_arch == "mipsel" and mips_dsp_rev >= 2',{ + 'sources': [ + 'ext/convolver_mips_dspr2.cc', + ], + }], ], 'target_conditions': [ diff --git a/chromium/skia/skia_common.gypi b/chromium/skia/skia_common.gypi index c0c0f7303ae..4da47f6a762 100644 --- a/chromium/skia/skia_common.gypi +++ b/chromium/skia/skia_common.gypi @@ -99,7 +99,7 @@ 'SK_ARM_HAS_NEON', ], }], - [ 'target_arch == "arm" and arm_version >= 7 and arm_neon_optional == 1', { + [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 0 and arm_neon_optional == 1', { 'defines': [ 'SK_ARM_HAS_OPTIONAL_NEON', ], diff --git a/chromium/skia/skia_gn_files.gypi b/chromium/skia/skia_gn_files.gypi index ae99261e659..e00e729556e 100644 --- a/chromium/skia/skia_gn_files.gypi +++ b/chromium/skia/skia_gn_files.gypi @@ -7,23 +7,19 @@ '<(skia_src_path)/ports/SkImageGenerator_none.cpp', - '<(skia_include_path)/images/SkMovie.h', - '<(skia_include_path)/images/SkPageFlipper.h', - '<(skia_include_path)/ports/SkTypeface_win.h', '<(skia_src_path)/fonts/SkFontMgr_fontconfig.cpp', '<(skia_src_path)/fonts/SkFontMgr_indirect.cpp', '<(skia_src_path)/fonts/SkRemotableFontMgr.cpp', '<(skia_src_path)/images/SkScaledBitmapSampler.cpp', - '<(skia_src_path)/images/SkScaledBitmapSampler.h', '<(skia_src_path)/ports/SkFontConfigInterface_direct.cpp', - '<(skia_src_path)/ports/SkFontConfigParser_android.cpp', '<(skia_src_path)/ports/SkFontHost_fontconfig.cpp', '<(skia_src_path)/ports/SkFontHost_FreeType_common.cpp', - '<(skia_src_path)/ports/SkFontHost_FreeType_common.h', '<(skia_src_path)/ports/SkFontHost_FreeType.cpp', '<(skia_src_path)/ports/SkFontHost_mac.cpp', '<(skia_src_path)/ports/SkFontHost_win.cpp', '<(skia_src_path)/ports/SkFontMgr_android.cpp', + '<(skia_src_path)/ports/SkFontMgr_android_factory.cpp', + '<(skia_src_path)/ports/SkFontMgr_android_parser.cpp', '<(skia_src_path)/ports/SkFontMgr_win_dw.cpp', '<(skia_src_path)/ports/SkGlobalInitialization_chromium.cpp', '<(skia_src_path)/ports/SkImageDecoder_empty.cpp', @@ -32,16 +28,12 @@ '<(skia_src_path)/ports/SkOSFile_stdio.cpp', '<(skia_src_path)/ports/SkOSFile_win.cpp', '<(skia_src_path)/ports/SkScalerContext_win_dw.cpp', - '<(skia_src_path)/ports/SkScalerContext_win_dw.h', '<(skia_src_path)/ports/SkTime_Unix.cpp', '<(skia_src_path)/ports/SkTLS_pthread.cpp', '<(skia_src_path)/ports/SkTLS_win.cpp', '<(skia_src_path)/ports/SkTypeface_win_dw.cpp', - '<(skia_src_path)/ports/SkTypeface_win_dw.h', '<(skia_src_path)/sfnt/SkOTTable_name.cpp', - '<(skia_src_path)/sfnt/SkOTTable_name.h', '<(skia_src_path)/sfnt/SkOTUtils.cpp', - '<(skia_src_path)/sfnt/SkOTUtils.h', #mac '<(skia_src_path)/utils/mac/SkStream_mac.cpp', @@ -50,6 +42,5 @@ #testing '<(skia_src_path)/fonts/SkGScalerContext.cpp', - '<(skia_src_path)/fonts/SkGScalerContext.h', ], } diff --git a/chromium/skia/skia_library.gypi b/chromium/skia/skia_library.gypi index 5537ef80c23..741cba8a306 100644 --- a/chromium/skia/skia_library.gypi +++ b/chromium/skia/skia_library.gypi @@ -30,7 +30,6 @@ '../third_party/skia/src/ports/SkImageDecoder_empty.cpp', '../third_party/skia/src/images/SkScaledBitmapSampler.cpp', - '../third_party/skia/src/images/SkScaledBitmapSampler.h', '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp', @@ -45,99 +44,55 @@ '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp', - '../third_party/skia/src/ports/SkFontHost_FreeType_common.h', - '../third_party/skia/src/ports/SkFontConfigParser_android.cpp', '../third_party/skia/src/ports/SkFontHost_mac.cpp', '../third_party/skia/src/ports/SkFontHost_win.cpp', "../third_party/skia/src/ports/SkFontMgr_android.cpp", + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', '../third_party/skia/src/ports/SkGlobalInitialization_chromium.cpp', '../third_party/skia/src/ports/SkOSFile_posix.cpp', '../third_party/skia/src/ports/SkOSFile_stdio.cpp', '../third_party/skia/src/ports/SkOSFile_win.cpp', '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', - '../third_party/skia/src/ports/SkScalerContext_win_dw.h', '../third_party/skia/src/ports/SkTime_Unix.cpp', '../third_party/skia/src/ports/SkTLS_pthread.cpp', '../third_party/skia/src/ports/SkTLS_win.cpp', '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', - '../third_party/skia/src/ports/SkTypeface_win_dw.h', '../third_party/skia/src/sfnt/SkOTTable_name.cpp', - '../third_party/skia/src/sfnt/SkOTTable_name.h', '../third_party/skia/src/sfnt/SkOTUtils.cpp', - '../third_party/skia/src/sfnt/SkOTUtils.h', - - '../third_party/skia/include/core/SkFontStyle.h', - - '../third_party/skia/include/images/SkMovie.h', - '../third_party/skia/include/images/SkPageFlipper.h', - - '../third_party/skia/include/ports/SkFontConfigInterface.h', - '../third_party/skia/include/ports/SkFontMgr.h', - '../third_party/skia/include/ports/SkFontMgr_indirect.h', - '../third_party/skia/include/ports/SkRemotableFontMgr.h', - '../third_party/skia/include/ports/SkTypeface_win.h', ], # Exclude all unused files in skia utils.gypi file 'sources!': [ - '../third_party/skia/include/utils/SkBoundaryPatch.h', - '../third_party/skia/include/utils/SkFrontBufferedStream.h', - '../third_party/skia/include/utils/SkCamera.h', - '../third_party/skia/include/utils/SkCanvasStateUtils.h', - '../third_party/skia/include/utils/SkCubicInterval.h', - '../third_party/skia/include/utils/SkCullPoints.h', - '../third_party/skia/include/utils/SkDebugUtils.h', - '../third_party/skia/include/utils/SkDumpCanvas.h', - '../third_party/skia/include/utils/SkEventTracer.h', - '../third_party/skia/include/utils/SkInterpolator.h', - '../third_party/skia/include/utils/SkLayer.h', - '../third_party/skia/include/utils/SkMeshUtils.h', - '../third_party/skia/include/utils/SkNinePatch.h', - '../third_party/skia/include/utils/SkParsePaint.h', - '../third_party/skia/include/utils/SkParsePath.h', - '../third_party/skia/include/utils/SkRandom.h', - '../third_party/skia/src/utils/SkBitmapHasher.cpp', - '../third_party/skia/src/utils/SkBitmapHasher.h', '../third_party/skia/src/utils/SkBoundaryPatch.cpp', '../third_party/skia/src/utils/SkFrontBufferedStream.cpp', '../third_party/skia/src/utils/SkCamera.cpp', - '../third_party/skia/src/utils/SkCanvasStack.h', '../third_party/skia/src/utils/SkCubicInterval.cpp', '../third_party/skia/src/utils/SkCullPoints.cpp', '../third_party/skia/src/utils/SkDumpCanvas.cpp', - '../third_party/skia/src/utils/SkFloatUtils.h', '../third_party/skia/src/utils/SkInterpolator.cpp', '../third_party/skia/src/utils/SkLayer.cpp', '../third_party/skia/src/utils/SkMD5.cpp', - '../third_party/skia/src/utils/SkMD5.h', '../third_party/skia/src/utils/SkMeshUtils.cpp', '../third_party/skia/src/utils/SkNinePatch.cpp', '../third_party/skia/src/utils/SkOSFile.cpp', '../third_party/skia/src/utils/SkParsePath.cpp', '../third_party/skia/src/utils/SkSHA1.cpp', - '../third_party/skia/src/utils/SkSHA1.h', - '../third_party/skia/src/utils/SkTFitsIn.h', - '../third_party/skia/src/utils/SkTLogic.h', # We don't currently need to change thread affinity, so leave out this complexity for now. "../third_party/skia/src/utils/SkThreadUtils_pthread_mach.cpp", "../third_party/skia/src/utils/SkThreadUtils_pthread_linux.cpp", #windows - '../third_party/skia/include/utils/win/SkAutoCoInitialize.h', - '../third_party/skia/include/utils/win/SkHRESULT.h', - '../third_party/skia/include/utils/win/SkIStream.h', - '../third_party/skia/include/utils/win/SkTScopedComPtr.h', '../third_party/skia/src/utils/win/SkAutoCoInitialize.cpp', '../third_party/skia/src/utils/win/SkIStream.cpp', '../third_party/skia/src/utils/win/SkWGL_win.cpp', #testing '../third_party/skia/src/fonts/SkGScalerContext.cpp', - '../third_party/skia/src/fonts/SkGScalerContext.h', ], 'include_dirs': [ @@ -150,7 +105,7 @@ '../third_party/skia/include/pdf', '../third_party/skia/include/pipe', '../third_party/skia/include/ports', - '../third_party/skia/include/record', + '../third_party/skia/include/private', '../third_party/skia/include/utils', '../third_party/skia/src/core', '../third_party/skia/src/opts', @@ -246,7 +201,7 @@ [ 'OS == "android"', { 'dependencies': [ '../third_party/expat/expat.gyp:expat', - '../third_party/freetype/freetype.gyp:ft2', + '../third_party/freetype-android/freetype.gyp:ft2', ], # This exports a hard dependency because it needs to run its # symlink action in order to expose the skia header files. @@ -254,6 +209,11 @@ 'include_dirs': [ '../third_party/expat/files/lib', ], + },{ # not 'OS == "android"' + 'sources!': [ + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', + ], }], [ 'OS == "ios"', { 'include_dirs': [ @@ -317,16 +277,11 @@ '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', '../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp', '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', - '../third_party/skia/src/ports/SkScalerContext_win_dw.h', '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', - '../third_party/skia/src/ports/SkTypeface_win_dw.h', - '../third_party/skia/src/utils/win/SkDWrite.h', '../third_party/skia/src/utils/win/SkDWrite.cpp', '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp', - '../third_party/skia/src/utils/win/SkDWriteFontFileStream.h', '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp', - '../third_party/skia/src/utils/win/SkDWriteGeometrySink.h', '../third_party/skia/src/utils/win/SkHRESULT.cpp', ], }], diff --git a/chromium/skia/skia_library_opts.gyp b/chromium/skia/skia_library_opts.gyp index 58f036f0161..545ef17e4b2 100644 --- a/chromium/skia/skia_library_opts.gyp +++ b/chromium/skia/skia_library_opts.gyp @@ -18,22 +18,10 @@ }, 'targets': [ - # Due to an unfortunate intersection of lameness between gcc and gyp, - # we have to build the *_SSE2.cpp files in a separate target. The - # gcc lameness is that, in order to compile SSE2 intrinsics code, it - # must be passed the -msse2 flag. However, with this flag, it may - # emit SSE2 instructions even for scalar code, such as the CPUID - # test used to test for the presence of SSE2. So that, and all other - # code must be compiled *without* -msse2. The gyp lameness is that it - # does not allow file-specific CFLAGS, so we must create this extra - # target for those files to be compiled with -msse2. - # - # This is actually only a problem on 32-bit Linux (all Intel Macs have - # SSE2, Linux x86_64 has SSE2 by definition, and MSC will happily emit - # SSE2 from instrinsics, which generating plain ol' 386 for everything - # else). However, to keep the .gyp file simple and avoid platform-specific - # build breakage, we do this on all platforms. - + # SSE files have to be built in a separate target, because gcc needs + # different -msse flags for different SSE levels which enable use of SSE + # intrinsics but also allow emission of SSE2 instructions for scalar code. + # gyp does not allow per-file compiler flags. # For about the same reason, we need to compile the ARM opts files # separately as well. { @@ -49,13 +37,12 @@ ], 'include_dirs': [ '<@(include_dirs)' ], 'conditions': [ - [ 'os_posix == 1 and OS != "mac" and OS != "android" and \ - target_arch != "arm" and target_arch != "arm64" and \ - target_arch != "mipsel" and target_arch != "mips64el"', { - 'cflags': [ '-msse2' ], - }], [ 'target_arch != "arm" and target_arch != "mipsel" and \ target_arch != "arm64" and target_arch != "mips64el"', { + # Chrome builds with -msse2 locally, so sse2_sources could in theory + # be in the regular skia target. But we need skia_opts for arm + # anyway, so putting sse2_sources here is simpler than making this + # conditionally a type none target on x86. 'sources': [ '<@(sse2_sources)' ], 'dependencies': [ 'skia_opts_ssse3', diff --git a/chromium/skia/skia_tests.gyp b/chromium/skia/skia_tests.gyp index 698493d3065..015065c8080 100644 --- a/chromium/skia/skia_tests.gyp +++ b/chromium/skia/skia_tests.gyp @@ -60,5 +60,22 @@ }, ], }], + ['test_isolation_mode != "noop"', { + 'targets': [ + { + 'target_name': 'skia_unittests_run', + 'type': 'none', + 'dependencies': [ + 'skia_unittests', + ], + 'includes': [ + '../build/isolate.gypi', + ], + 'sources': [ + 'skia_unittests.isolate', + ], + }, + ], + }], ], } diff --git a/chromium/skia/skia_unittests.isolate b/chromium/skia/skia_unittests.isolate new file mode 100644 index 00000000000..f88e5a80176 --- /dev/null +++ b/chromium/skia/skia_unittests.isolate @@ -0,0 +1,44 @@ +# 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. +{ + 'variables': { + 'command': [ + '../testing/test_env.py', + '<(PRODUCT_DIR)/skia_unittests<(EXECUTABLE_SUFFIX)', + '--brave-new-test-launcher', + '--test-launcher-bot-mode', + '--asan=<(asan)', + '--msan=<(msan)', + '--tsan=<(tsan)', + ], + }, + 'conditions': [ + ['OS=="linux" or OS=="mac" or OS=="win"', { + 'variables': { + 'files': [ + '../testing/test_env.py', + '<(PRODUCT_DIR)/skia_unittests<(EXECUTABLE_SUFFIX)', + ], + 'read_only': 1, + }, + }], + ['OS=="mac" and asan==1 and fastbuild==0', { + 'variables': { + 'files': [ + '<(PRODUCT_DIR)/skia_unittests.dSYM/', + ], + }, + }], + ['OS=="win" and (fastbuild==0 or fastbuild==1)', { + 'variables': { + 'files': [ + '<(PRODUCT_DIR)/skia_unittests.exe.pdb', + ], + }, + }], + ], + 'includes': [ + '../base/base.isolate', + ], +} |