From 42d77d61599e01e80ed925af9b8f0f9a91b874b9 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 10 Feb 2017 16:01:36 -0800 Subject: [PATCH] Revert ShadowMaskFilter use and roll Skia to 246a3c269d8dc91a47ff27f7b71508bf9e74edf5. (flutter/engine#3409) --- DEPS | 2 +- engine/src/flutter/flow/bitmap_image.cc | 5 +- engine/src/flutter/flow/layers/layer.h | 1 - .../src/flutter/flow/texture_image_gles2.cc | 2 +- engine/src/flutter/lib/ui/painting.dart | 44 +----- .../flutter/lib/ui/painting/mask_filter.cc | 29 +--- .../src/flutter/lib/ui/painting/mask_filter.h | 10 +- .../common/diagnostic/diagnostic_server.cc | 2 +- .../flutter/sky/packages/sky_engine/LICENSE | 141 +++++++++++++++--- 9 files changed, 132 insertions(+), 104 deletions(-) diff --git a/DEPS b/DEPS index d9caf44ddc..f5bc8f440e 100644 --- a/DEPS +++ b/DEPS @@ -23,7 +23,7 @@ vars = { 'skia_git': 'https://skia.googlesource.com', 'github_git': 'https://github.com', 'base_revision': 'b2412302ed4e45bfb47d7b5c0c3418077009e1ce', - 'skia_revision': '130a118cc68f8f9973e9572356011de378463fea', + 'skia_revision': '246a3c269d8dc91a47ff27f7b71508bf9e74edf5', # Note: When updating the Dart revision, ensure that all entries that are # dependencies of dart are also updated diff --git a/engine/src/flutter/flow/bitmap_image.cc b/engine/src/flutter/flow/bitmap_image.cc index 69e58d0ac4..b689a23e2f 100644 --- a/engine/src/flutter/flow/bitmap_image.cc +++ b/engine/src/flutter/flow/bitmap_image.cc @@ -7,10 +7,7 @@ namespace flow { sk_sp BitmapImageCreate(SkImageGenerator& generator) { - SkBitmap bitmap; - if (generator.tryGenerateBitmap(&bitmap)) - return SkImage::MakeFromBitmap(bitmap); - return nullptr; + return SkImage::MakeFromGenerator(&generator); } } // namespace flow diff --git a/engine/src/flutter/flow/layers/layer.h b/engine/src/flutter/flow/layers/layer.h index c7db218f12..1d24f48038 100644 --- a/engine/src/flutter/flow/layers/layer.h +++ b/engine/src/flutter/flow/layers/layer.h @@ -23,7 +23,6 @@ #include "third_party/skia/include/core/SkPicture.h" #include "third_party/skia/include/core/SkRRect.h" #include "third_party/skia/include/core/SkRect.h" -#include "third_party/skia/include/core/SkXfermode.h" namespace flow { class ContainerLayer; diff --git a/engine/src/flutter/flow/texture_image_gles2.cc b/engine/src/flutter/flow/texture_image_gles2.cc index ac5e36a096..44bb79650a 100644 --- a/engine/src/flutter/flow/texture_image_gles2.cc +++ b/engine/src/flutter/flow/texture_image_gles2.cc @@ -221,7 +221,7 @@ sk_sp TextureImageCreate(GrContext* context, { TRACE_EVENT0("flutter", "DecodeRecommended"); // Try the guessed config. - if (generator.tryGenerateBitmap(&bitmap)) { + if (generator.tryGenerateBitmap(&bitmap, generator.getInfo(), nullptr)) { return TextureImageCreate(context, bitmap); } } diff --git a/engine/src/flutter/lib/ui/painting.dart b/engine/src/flutter/lib/ui/painting.dart index 9f859981a1..0347e57b63 100644 --- a/engine/src/flutter/lib/ui/painting.dart +++ b/engine/src/flutter/lib/ui/painting.dart @@ -861,49 +861,9 @@ class MaskFilter extends NativeFieldWrapperClass2 { /// /// A blur is an expensive operation and should therefore be used sparingly. MaskFilter.blur(BlurStyle style, double sigma) { - _constructorBlur(style.index, sigma); + _constructor(style.index, sigma); } - void _constructorBlur(int style, double sigma) native "MaskFilter_constructorBlur"; - - /// Creates a mask filter that implements a pair of shadows for an occluding - /// object - one representing ambient occlusion, and one representing a - /// displaced shadow from a point light. - /// - /// `occluderHeight`: Height of occluding object off of ground plane. - /// - /// `lightPos`: Position of the light applied to this object. - /// - /// `lightRadius`: Radius of the light (light is assumed to be spherical). - /// - /// `ambientAlpha`: Base opacity of the ambient occlusion shadow. - /// - /// `spotAlpha`: Base opacity of the displaced spot shadow. - MaskFilter.shadow({ - double occluderHeight: 0.0, - double lightPosX: 0.0, - double lightPosY: 0.0, - double lightPosZ: 0.0, - double lightRadius: 0.0, - double ambientAlpha: 0.0, - double spotAlpha: 0.0, - }) { - if (!(occluderHeight > 0.0 && - lightPosZ > occluderHeight && - lightRadius > 0.0 && - ambientAlpha >= 0.0 && - spotAlpha >= 0.0)) - throw new ArgumentError("Invalid shadow mask filter parameters"); - - _constructorShadow(occluderHeight, lightPosX, lightPosY, lightPosZ, - lightRadius, ambientAlpha, spotAlpha); - } - void _constructorShadow(double occluderHeight, - double lightPosX, - double lightPosY, - double lightPosZ, - double lightRadius, - double ambientAlpha, - double spotAlpha) native "MaskFilter_constructorShadow"; + void _constructor(int style, double sigma) native "MaskFilter_constructor"; } /// A description of a color filter to apply when drawing a shape or compositing diff --git a/engine/src/flutter/lib/ui/painting/mask_filter.cc b/engine/src/flutter/lib/ui/painting/mask_filter.cc index 26a7fc62ff..0e6866ae44 100644 --- a/engine/src/flutter/lib/ui/painting/mask_filter.cc +++ b/engine/src/flutter/lib/ui/painting/mask_filter.cc @@ -11,47 +11,26 @@ #include "lib/tonic/converter/dart_converter.h" #include "lib/tonic/dart_library_natives.h" #include "third_party/skia/include/effects/SkBlurMaskFilter.h" -#include "third_party/skia/include/effects/SkShadowMaskFilter.h" namespace blink { -static void MaskFilter_constructorBlur(Dart_NativeArguments args) { - DartCallConstructor(&MaskFilter::CreateBlur, args); -} - -static void MaskFilter_constructorShadow(Dart_NativeArguments args) { - DartCallConstructor(&MaskFilter::CreateShadow, args); +static void MaskFilter_constructor(Dart_NativeArguments args) { + DartCallConstructor(&MaskFilter::Create, args); } IMPLEMENT_WRAPPERTYPEINFO(ui, MaskFilter); void MaskFilter::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({ - {"MaskFilter_constructorBlur", MaskFilter_constructorBlur, 3, true}, - {"MaskFilter_constructorShadow", MaskFilter_constructorShadow, 8, true}, + {"MaskFilter_constructor", MaskFilter_constructor, 3, true}, }); } -ftl::RefPtr MaskFilter::CreateBlur(unsigned style, double sigma) { +ftl::RefPtr MaskFilter::Create(unsigned style, double sigma) { return ftl::MakeRefCounted( SkBlurMaskFilter::Make(static_cast(style), sigma)); } -ftl::RefPtr MaskFilter::CreateShadow(double occluderHeight, - double lightPosX, - double lightPosY, - double lightPosZ, - double lightRadius, - double ambientAlpha, - double spotAlpha) { - return ftl::MakeRefCounted( - SkShadowMaskFilter::Make(occluderHeight, - SkPoint3::Make(lightPosX, lightPosY, lightPosZ), - lightRadius, - ambientAlpha, - spotAlpha)); -} - MaskFilter::MaskFilter(sk_sp filter) : filter_(std::move(filter)) {} diff --git a/engine/src/flutter/lib/ui/painting/mask_filter.h b/engine/src/flutter/lib/ui/painting/mask_filter.h index 410217691f..902be41c83 100644 --- a/engine/src/flutter/lib/ui/painting/mask_filter.h +++ b/engine/src/flutter/lib/ui/painting/mask_filter.h @@ -23,15 +23,7 @@ class MaskFilter : public ftl::RefCountedThreadSafe, public: ~MaskFilter() override; - static ftl::RefPtr CreateBlur(unsigned style, double sigma); - - static ftl::RefPtr CreateShadow(double occluderHeight, - double lightPosX, - double lightPosY, - double lightPosZ, - double lightRadius, - double ambientAlpha, - double spotAlpha); + static ftl::RefPtr Create(unsigned style, double sigma); const sk_sp& filter() { return filter_; } diff --git a/engine/src/flutter/shell/common/diagnostic/diagnostic_server.cc b/engine/src/flutter/shell/common/diagnostic/diagnostic_server.cc index a7a3f02224..fb0483999a 100644 --- a/engine/src/flutter/shell/common/diagnostic/diagnostic_server.cc +++ b/engine/src/flutter/shell/common/diagnostic/diagnostic_server.cc @@ -136,7 +136,7 @@ void DiagnosticServer::SkiaPictureTask(Dart_Port port_id) { SkDynamicMemoryWStream stream; PngPixelSerializer serializer; picture->serialize(&stream, &serializer); - sk_sp picture_data(stream.snapshotAsData()); + sk_sp picture_data(stream.detachAsData()); Dart_CObject c_object; c_object.type = Dart_CObject_kTypedData; diff --git a/engine/src/flutter/sky/packages/sky_engine/LICENSE b/engine/src/flutter/sky/packages/sky_engine/LICENSE index 1782dfe2f7..38433b55d9 100644 --- a/engine/src/flutter/sky/packages/sky_engine/LICENSE +++ b/engine/src/flutter/sky/packages/sky_engine/LICENSE @@ -16457,26 +16457,6 @@ Copyright (C) 2016, D. R. Commander Modifications are under the same license as the original code (see above) -------------------------------------------------------------------------------- libsdl - -Copyright (C) 1997-2015 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. --------------------------------------------------------------------------------- -libsdl skia Copyright 2016 Google Inc. @@ -21182,6 +21162,36 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2009 Motorola + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + Copyright 2009 The Android Open Source Project Redistribution and use in source and binary forms, with or without @@ -21603,6 +21613,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2014 Google Inc. +Copyright 2017 ARM Ltd. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + Copyright 2014 Google, Inc Redistribution and use in source and binary forms, with or without @@ -21783,6 +21824,66 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- skia +Copyright 2017 ARM Ltd. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2017 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + NEON optimized code (C) COPYRIGHT 2009 Motorola Redistribution and use in source and binary forms, with or without