mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #2199 from abarth/rm_filter_idl
Remove IDL for ColorFilter and MaskFilter
This commit is contained in:
commit
610ab574aa
@ -8,6 +8,8 @@
|
||||
#include "sky/engine/bindings/dart_runtime_hooks.h"
|
||||
#include "sky/engine/core/compositing/Scene.h"
|
||||
#include "sky/engine/core/compositing/SceneBuilder.h"
|
||||
#include "sky/engine/core/painting/ColorFilter.h"
|
||||
#include "sky/engine/core/painting/MaskFilter.h"
|
||||
#include "sky/engine/core/painting/DrawLooperLayerInfo.h"
|
||||
#include "sky/engine/core/painting/LayerDrawLooperBuilder.h"
|
||||
#include "sky/engine/core/painting/painting.h"
|
||||
@ -46,6 +48,8 @@ void DartUI::InitForIsolate() {
|
||||
DartRuntimeHooks::RegisterNatives(g_natives);
|
||||
DrawLooperLayerInfo::RegisterNatives(g_natives);
|
||||
LayerDrawLooperBuilder::RegisterNatives(g_natives);
|
||||
ColorFilter::RegisterNatives(g_natives);
|
||||
MaskFilter::RegisterNatives(g_natives);
|
||||
Painting::RegisterNatives(g_natives);
|
||||
Paragraph::RegisterNatives(g_natives);
|
||||
ParagraphBuilder::RegisterNatives(g_natives);
|
||||
|
||||
@ -235,11 +235,9 @@ sky_core_files = [
|
||||
|
||||
core_idl_files = get_path_info([
|
||||
"painting/Canvas.idl",
|
||||
"painting/ColorFilter.idl",
|
||||
"painting/Gradient.idl",
|
||||
"painting/Image.idl",
|
||||
"painting/ImageShader.idl",
|
||||
"painting/MaskFilter.idl",
|
||||
"painting/Path.idl",
|
||||
"painting/Picture.idl",
|
||||
"painting/PictureRecorder.idl",
|
||||
@ -257,11 +255,9 @@ core_dart_files = get_path_info([
|
||||
"dart/text.dart",
|
||||
"dart/window.dart",
|
||||
"painting/Color.dart",
|
||||
"painting/ColorFilter.dart",
|
||||
"painting/FilterQuality.dart",
|
||||
"painting/Gradient.dart",
|
||||
"painting/ImageShader.dart",
|
||||
"painting/MaskFilter.dart",
|
||||
"painting/Offset.dart",
|
||||
"painting/OffsetBase.dart",
|
||||
"painting/Paint.dart",
|
||||
|
||||
@ -50,3 +50,36 @@ class LayerDrawLooperBuilder extends NativeFieldWrapperClass2 {
|
||||
DrawLooper build() native "LayerDrawLooperBuilder_build";
|
||||
void addLayerOnTop(DrawLooperLayerInfo info, Paint paint) native "LayerDrawLooperBuilder_addLayerOnTop";
|
||||
}
|
||||
|
||||
/// Blur styles. These mirror SkBlurStyle and must be kept in sync.
|
||||
enum BlurStyle {
|
||||
normal, /// Fuzzy inside and outside.
|
||||
solid, /// Solid inside, fuzzy outside.
|
||||
outer, /// Nothing inside, fuzzy outside.
|
||||
inner, /// Fuzzy inside, nothing outside.
|
||||
}
|
||||
|
||||
// Convert constructor parameters to the SkBlurMaskFilter::BlurFlags type.
|
||||
int _makeBlurFlags(bool ignoreTransform, bool highQuality) {
|
||||
int flags = 0;
|
||||
if (ignoreTransform)
|
||||
flags |= 0x01;
|
||||
if (highQuality)
|
||||
flags |= 0x02;
|
||||
return flags;
|
||||
}
|
||||
|
||||
class MaskFilter extends NativeFieldWrapperClass2 {
|
||||
void _constructor(int style, double sigma, int flags) native "MaskFilter_constructor";
|
||||
MaskFilter.blur(BlurStyle style, double sigma,
|
||||
{bool ignoreTransform: false, bool highQuality: false}) {
|
||||
_constructor(style.index, sigma, _makeBlurFlags(ignoreTransform, highQuality));
|
||||
}
|
||||
}
|
||||
|
||||
class ColorFilter extends NativeFieldWrapperClass2 {
|
||||
void _constructor(Color color, TransferMode transferMode) native "ColorFilter_constructor";
|
||||
ColorFilter.mode(Color color, TransferMode transferMode) {
|
||||
_constructor(color, transferMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,27 @@
|
||||
|
||||
#include "sky/engine/core/painting/ColorFilter.h"
|
||||
|
||||
#include "sky/engine/tonic/dart_args.h"
|
||||
#include "sky/engine/tonic/dart_binding_macros.h"
|
||||
#include "sky/engine/tonic/dart_converter.h"
|
||||
#include "sky/engine/tonic/dart_library_natives.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
// static
|
||||
PassRefPtr<ColorFilter> ColorFilter::create(SkColor color,
|
||||
SkXfermode::Mode transfer_mode) {
|
||||
static void ColorFilter_constructor(Dart_NativeArguments args) {
|
||||
DartCallConstructor(&ColorFilter::create, args);
|
||||
}
|
||||
|
||||
IMPLEMENT_WRAPPERTYPEINFO(ColorFilter);
|
||||
|
||||
void ColorFilter::RegisterNatives(DartLibraryNatives* natives) {
|
||||
natives->Register({
|
||||
{ "ColorFilter_constructor", ColorFilter_constructor, 3, true },
|
||||
});
|
||||
}
|
||||
|
||||
PassRefPtr<ColorFilter> ColorFilter::create(CanvasColor color,
|
||||
TransferMode transfer_mode) {
|
||||
return adoptRef(new ColorFilter(
|
||||
adoptRef(SkColorFilter::CreateModeFilter(color, transfer_mode))));
|
||||
}
|
||||
|
||||
@ -1,13 +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.
|
||||
|
||||
part of dart_ui;
|
||||
|
||||
/// Extends the generated _ColorFilter interface via the PrivateDart attribute.
|
||||
class ColorFilter extends _ColorFilter {
|
||||
// This is the only ColorFilter type we need, but use a named constructor so
|
||||
// we can add more in the future.
|
||||
ColorFilter.mode(Color color, TransferMode transferMode)
|
||||
: super(color, transferMode);
|
||||
}
|
||||
@ -13,16 +13,19 @@
|
||||
#include "third_party/skia/include/core/SkColorFilter.h"
|
||||
|
||||
namespace blink {
|
||||
class DartLibraryNatives;
|
||||
|
||||
class ColorFilter : public RefCounted<ColorFilter>, public DartWrappable {
|
||||
DEFINE_WRAPPERTYPEINFO();
|
||||
public:
|
||||
~ColorFilter() override;
|
||||
static PassRefPtr<ColorFilter> create(SkColor color,
|
||||
SkXfermode::Mode transfer_mode);
|
||||
static PassRefPtr<ColorFilter> create(CanvasColor color,
|
||||
TransferMode transfer_mode);
|
||||
|
||||
SkColorFilter* filter() { return filter_.get(); }
|
||||
|
||||
static void RegisterNatives(DartLibraryNatives* natives);
|
||||
|
||||
private:
|
||||
ColorFilter(PassRefPtr<SkColorFilter> filter);
|
||||
|
||||
|
||||
@ -1,9 +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.
|
||||
|
||||
[
|
||||
PrivateDart,
|
||||
Constructor(Color color, TransferMode transferMode),
|
||||
] interface ColorFilter {
|
||||
};
|
||||
@ -5,10 +5,25 @@
|
||||
#include "sky/engine/core/painting/MaskFilter.h"
|
||||
|
||||
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
|
||||
#include "sky/engine/tonic/dart_args.h"
|
||||
#include "sky/engine/tonic/dart_binding_macros.h"
|
||||
#include "sky/engine/tonic/dart_converter.h"
|
||||
#include "sky/engine/tonic/dart_library_natives.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
// static
|
||||
static void MaskFilter_constructor(Dart_NativeArguments args) {
|
||||
DartCallConstructor(&MaskFilter::create, args);
|
||||
}
|
||||
|
||||
IMPLEMENT_WRAPPERTYPEINFO(MaskFilter);
|
||||
|
||||
void MaskFilter::RegisterNatives(DartLibraryNatives* natives) {
|
||||
natives->Register({
|
||||
{ "MaskFilter_constructor", MaskFilter_constructor, 4, true },
|
||||
});
|
||||
}
|
||||
|
||||
PassRefPtr<MaskFilter> MaskFilter::create(
|
||||
unsigned style, double sigma, unsigned flags) {
|
||||
return adoptRef(new MaskFilter(adoptRef(SkBlurMaskFilter::Create(
|
||||
|
||||
@ -1,28 +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.
|
||||
|
||||
part of dart_ui;
|
||||
|
||||
/// Blur styles. These mirror SkBlurStyle and must be kept in sync.
|
||||
enum BlurStyle {
|
||||
normal, /// Fuzzy inside and outside.
|
||||
solid, /// Solid inside, fuzzy outside.
|
||||
outer, /// Nothing inside, fuzzy outside.
|
||||
inner, /// Fuzzy inside, nothing outside.
|
||||
}
|
||||
|
||||
// Extends the generated _MaskFilter interface via the PrivateDart attribute.
|
||||
class MaskFilter extends _MaskFilter {
|
||||
MaskFilter.blur(BlurStyle style, double sigma,
|
||||
{bool ignoreTransform: false, bool highQuality: false})
|
||||
: super(style.index, sigma, _makeBlurFlags(ignoreTransform, highQuality));
|
||||
|
||||
// Convert constructor parameters to the SkBlurMaskFilter::BlurFlags type.
|
||||
static int _makeBlurFlags(bool ignoreTransform, bool highQuality) {
|
||||
int flags = 0;
|
||||
if (ignoreTransform) flags |= 0x01;
|
||||
if (highQuality) flags |= 0x02;
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@
|
||||
class SkMaskFilter;
|
||||
|
||||
namespace blink {
|
||||
class DartLibraryNatives;
|
||||
|
||||
class MaskFilter : public RefCounted<MaskFilter>, public DartWrappable {
|
||||
DEFINE_WRAPPERTYPEINFO();
|
||||
@ -22,6 +23,8 @@ class MaskFilter : public RefCounted<MaskFilter>, public DartWrappable {
|
||||
|
||||
SkMaskFilter* filter() { return filter_.get(); }
|
||||
|
||||
static void RegisterNatives(DartLibraryNatives* natives);
|
||||
|
||||
private:
|
||||
MaskFilter(PassRefPtr<SkMaskFilter> filter);
|
||||
|
||||
|
||||
@ -1,9 +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.
|
||||
|
||||
[
|
||||
PrivateDart,
|
||||
Constructor(unsigned long style, double sigma, unsigned long flags)
|
||||
] interface MaskFilter {
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user