Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9604e80

Browse files
authored
Merge pull request #1 from flutter/main
update from origin
2 parents 1d6f588 + e535969 commit 9604e80

35 files changed

Lines changed: 585 additions & 218 deletions

DEPS

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ vars = {
2727
'skia_git': 'https://skia.googlesource.com',
2828
# OCMock is for testing only so there is no google clone
2929
'ocmock_git': 'https://github.com/erikdoe/ocmock.git',
30-
'skia_revision': 'b3275e1fd64cbbf57a1e9a2ecb2db0812cfba4dc',
30+
'skia_revision': 'c71ae5140090290ad16b73bdb0aa6f4543c64a78',
3131

3232
# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
3333
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
@@ -116,7 +116,7 @@ deps = {
116116
'src': 'https://github.com/flutter/buildroot.git' + '@' + '8cbf38af7d48cc298ae86e614533b4b2d0dc6758',
117117

118118
'src/flutter/impeller':
119-
Var('github_git') + '/flutter/impeller' + '@' + '144d29b12def5058b34c910b5f0343f5355a968d',
119+
Var('github_git') + '/flutter/impeller' + '@' + '114e92d2d046b3496f2b9422946295efaae676dd',
120120

121121
# Fuchsia compatibility
122122
#
@@ -618,7 +618,7 @@ deps = {
618618
'packages': [
619619
{
620620
'package': 'fuchsia/sdk/core/mac-amd64',
621-
'version': 'XGk8f98vkWo3LGch7wRT3bjpTDEnC1BPjJy1zAGiDqEC'
621+
'version': '5VwmuFnNNvR_3XAVU9Fo51Q0nLkRzeSZHYIOW_omotwC'
622622
}
623623
],
624624
'condition': 'host_os == "mac" and not download_fuchsia_sdk',
@@ -628,7 +628,7 @@ deps = {
628628
'packages': [
629629
{
630630
'package': 'fuchsia/sdk/core/linux-amd64',
631-
'version': 'bltm6P1RVx6jzhhgmH8-BkzYE4v9iICn_QQ0IUMifCMC'
631+
'version': '-T9kCGaceQI0js1gCuXCStBjE0cnE4kWHe-HCPhuzLQC'
632632
}
633633
],
634634
'condition': 'host_os == "linux" and not download_fuchsia_sdk',
@@ -661,6 +661,12 @@ deps = {
661661
}
662662

663663
hooks = [
664+
{
665+
# Generate the Dart SDK's .dart_tool/package_confg.json file.
666+
'name': 'Generate .dart_tool/package_confg.json',
667+
'pattern': '.',
668+
'action': ['python3', 'src/third_party/dart/tools/generate_package_config.py'],
669+
},
664670
{
665671
# Update the Windows toolchain if necessary.
666672
'name': 'win_toolchain',

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ FILE: ../../../flutter/display_list/display_list_benchmarks_metal.cc
4747
FILE: ../../../flutter/display_list/display_list_benchmarks_metal.h
4848
FILE: ../../../flutter/display_list/display_list_benchmarks_software.cc
4949
FILE: ../../../flutter/display_list/display_list_benchmarks_software.h
50+
FILE: ../../../flutter/display_list/display_list_blend_mode.cc
51+
FILE: ../../../flutter/display_list/display_list_blend_mode.h
5052
FILE: ../../../flutter/display_list/display_list_builder.cc
5153
FILE: ../../../flutter/display_list/display_list_builder.h
5254
FILE: ../../../flutter/display_list/display_list_canvas_dispatcher.cc

ci/licenses_golden/licenses_fuchsia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 1619b0f17059554286b4f006025815a0
1+
Signature: 8d1b2cec132d08723316cc285e616cf7
22

33
UNUSED LICENSES:
44

ci/licenses_golden/licenses_skia

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: c7fac558647a8e390ec8aa2b48044b1b
1+
Signature: bf29309505065797ffef77b5ad71374d
22

33
UNUSED LICENSES:
44

@@ -6097,6 +6097,8 @@ FILE: ../../../third_party/skia/experimental/graphite/src/render/MiddleOutFanRen
60976097
FILE: ../../../third_party/skia/experimental/graphite/src/render/StencilAndCoverDSS.h
60986098
FILE: ../../../third_party/skia/experimental/graphite/src/render/TessellateCurvesRenderStep.cpp
60996099
FILE: ../../../third_party/skia/experimental/graphite/src/render/TessellateCurvesRenderStep.h
6100+
FILE: ../../../third_party/skia/experimental/graphite/src/render/TessellateWedgesRenderStep.cpp
6101+
FILE: ../../../third_party/skia/experimental/graphite/src/render/TessellateWedgesRenderStep.h
61006102
FILE: ../../../third_party/skia/gm/bug12866.cpp
61016103
FILE: ../../../third_party/skia/include/core/SkAlphaType.h
61026104
FILE: ../../../third_party/skia/include/core/SkColorType.h
@@ -7773,13 +7775,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
77737775

77747776
====================================================================================================
77757777
LIBRARY: skia
7776-
ORIGIN: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp + ../../../third_party/skia/LICENSE
7778+
ORIGIN: ../../../third_party/skia/src/gpu/tessellate/MidpointContourParser.h + ../../../third_party/skia/LICENSE
77777779
TYPE: LicenseType.bsd
7778-
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp
7779-
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.h
7780-
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp
7780+
FILE: ../../../third_party/skia/src/gpu/tessellate/MidpointContourParser.h
7781+
FILE: ../../../third_party/skia/src/sksl/SkSLPosition.cpp
77817782
----------------------------------------------------------------------------------------------------
7782-
Copyright 2009-2015 Google Inc.
7783+
Copyright 2022 Google LLC.
77837784

77847785
Redistribution and use in source and binary forms, with or without
77857786
modification, are permitted provided that the following conditions are
@@ -7812,13 +7813,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78127813

78137814
====================================================================================================
78147815
LIBRARY: skia
7815-
ORIGIN: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp + ../../../third_party/skia/LICENSE
7816+
ORIGIN: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp + ../../../third_party/skia/LICENSE
78167817
TYPE: LicenseType.bsd
7817-
FILE: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp
7818-
FILE: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.h
7818+
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp
7819+
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct.h
7820+
FILE: ../../../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp
78197821
----------------------------------------------------------------------------------------------------
7820-
Copyright 2006-2012 The Android Open Source Project
7821-
Copyright 2012 Mozilla Foundation
7822+
Copyright 2009-2015 Google Inc.
78227823

78237824
Redistribution and use in source and binary forms, with or without
78247825
modification, are permitted provided that the following conditions are
@@ -7851,11 +7852,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78517852

78527853
====================================================================================================
78537854
LIBRARY: skia
7854-
ORIGIN: ../../../third_party/skia/src/ports/SkMemory_mozalloc.cpp + ../../../third_party/skia/LICENSE
7855+
ORIGIN: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp + ../../../third_party/skia/LICENSE
78557856
TYPE: LicenseType.bsd
7856-
FILE: ../../../third_party/skia/src/ports/SkMemory_mozalloc.cpp
7857+
FILE: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp
7858+
FILE: ../../../third_party/skia/src/ports/SkFontHost_FreeType_common.h
78577859
----------------------------------------------------------------------------------------------------
7858-
Copyright 2011 Google Inc.
7860+
Copyright 2006-2012 The Android Open Source Project
78597861
Copyright 2012 Mozilla Foundation
78607862

78617863
Redistribution and use in source and binary forms, with or without
@@ -7889,31 +7891,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78897891

78907892
====================================================================================================
78917893
LIBRARY: skia
7892-
ORIGIN: ../../../third_party/skia/src/sksl/GLSL.std.450.h
7893-
TYPE: LicenseType.unknown
7894-
FILE: ../../../third_party/skia/src/sksl/GLSL.std.450.h
7895-
FILE: ../../../third_party/skia/src/sksl/spirv.h
7896-
----------------------------------------------------------------------------------------------------
7897-
Copyright (c) 2014-2016 The Khronos Group Inc.
7898-
7899-
Permission is hereby granted, free of charge, to any person obtaining a copy
7900-
of this software and/or associated documentation files (the "Materials"),
7901-
to deal in the Materials without restriction, including without limitation
7902-
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7903-
and/or sell copies of the Materials, and to permit persons to whom the
7904-
Materials are furnished to do so, subject to the following conditions:
7905-
7906-
The above copyright notice and this permission notice shall be included in
7907-
all copies or substantial portions of the Materials.
7908-
====================================================================================================
7909-
7910-
====================================================================================================
7911-
LIBRARY: skia
7912-
ORIGIN: ../../../third_party/skia/src/sksl/SkSLPosition.cpp + ../../../third_party/skia/LICENSE
7894+
ORIGIN: ../../../third_party/skia/src/ports/SkMemory_mozalloc.cpp + ../../../third_party/skia/LICENSE
79137895
TYPE: LicenseType.bsd
7914-
FILE: ../../../third_party/skia/src/sksl/SkSLPosition.cpp
7896+
FILE: ../../../third_party/skia/src/ports/SkMemory_mozalloc.cpp
79157897
----------------------------------------------------------------------------------------------------
7916-
Copyright 2022 Google LLC.
7898+
Copyright 2011 Google Inc.
7899+
Copyright 2012 Mozilla Foundation
79177900

79187901
Redistribution and use in source and binary forms, with or without
79197902
modification, are permitted provided that the following conditions are
@@ -7944,6 +7927,26 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
79447927
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
79457928
====================================================================================================
79467929

7930+
====================================================================================================
7931+
LIBRARY: skia
7932+
ORIGIN: ../../../third_party/skia/src/sksl/GLSL.std.450.h
7933+
TYPE: LicenseType.unknown
7934+
FILE: ../../../third_party/skia/src/sksl/GLSL.std.450.h
7935+
FILE: ../../../third_party/skia/src/sksl/spirv.h
7936+
----------------------------------------------------------------------------------------------------
7937+
Copyright (c) 2014-2016 The Khronos Group Inc.
7938+
7939+
Permission is hereby granted, free of charge, to any person obtaining a copy
7940+
of this software and/or associated documentation files (the "Materials"),
7941+
to deal in the Materials without restriction, including without limitation
7942+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7943+
and/or sell copies of the Materials, and to permit persons to whom the
7944+
Materials are furnished to do so, subject to the following conditions:
7945+
7946+
The above copyright notice and this permission notice shall be included in
7947+
all copies or substantial portions of the Materials.
7948+
====================================================================================================
7949+
79477950
====================================================================================================
79487951
LIBRARY: vulkanmemoryallocator
79497952
ORIGIN: ../../../third_party/skia/third_party/vulkanmemoryallocator/include/vk_mem_alloc.h

display_list/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ source_set("display_list") {
99
"display_list.cc",
1010
"display_list.h",
1111
"display_list_attributes.h",
12+
"display_list_blend_mode.cc",
13+
"display_list_blend_mode.h",
1214
"display_list_builder.cc",
1315
"display_list_builder.h",
1416
"display_list_canvas_dispatcher.cc",

display_list/display_list_benchmarks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ void BM_DrawVertices(benchmark::State& state,
802802
sk_sp<SkVertices> vertices =
803803
GetTestVertices(p, radius, 50, mode, vertex_count);
804804
total_vertex_count += vertex_count;
805-
builder.drawVertices(vertices, SkBlendMode::kSrc);
805+
builder.drawVertices(vertices, DlBlendMode::kSrc);
806806
}
807807

808808
state.counters["VertexCount"] = total_vertex_count;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "flutter/display_list/display_list_blend_mode.h"
6+
7+
namespace flutter {} // namespace flutter
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#ifndef FLUTTER_DISPLAY_LIST_DISPLAY_LIST_BLEND_MODE_H_
6+
#define FLUTTER_DISPLAY_LIST_DISPLAY_LIST_BLEND_MODE_H_
7+
8+
#include "include/core/SkBlender.h"
9+
10+
namespace flutter {
11+
12+
/// A enum define the blend mode.
13+
/// Blends are operators that take in two colors (source, destination) and
14+
/// return a new color. Blends are operators that take in two colors (source,
15+
/// destination) and return a new color. Many of these operate the same on all 4
16+
/// components: red, green, blue, alpha. For these, we just document what
17+
/// happens to one component, rather than naming each one separately. Different
18+
/// SkColorTypes have different representations for color components:
19+
/// 8-bit: 0..255
20+
/// 6-bit: 0..63
21+
/// 5-bit: 0..31
22+
/// 4-bit: 0..15
23+
/// floats: 0...1
24+
/// The documentation is expressed as if the component values are always 0..1
25+
/// (floats). For brevity, the documentation uses the following abbreviations s
26+
/// : source d : destination sa : source alpha da : destination alpha Results
27+
/// are abbreviated r : if all 4 components are computed in the same manner ra
28+
/// : result alpha component rc : result "color": red, green, blue components
29+
enum class DlBlendMode {
30+
kClear, //!< r = 0
31+
kSrc, //!< r = s
32+
kDst, //!< r = d
33+
kSrcOver, //!< r = s + (1-sa)*d
34+
kDstOver, //!< r = d + (1-da)*s
35+
kSrcIn, //!< r = s * da
36+
kDstIn, //!< r = d * sa
37+
kSrcOut, //!< r = s * (1-da)
38+
kDstOut, //!< r = d * (1-sa)
39+
kSrcATop, //!< r = s*da + d*(1-sa)
40+
kDstATop, //!< r = d*sa + s*(1-da)
41+
kXor, //!< r = s*(1-da) + d*(1-sa)
42+
kPlus, //!< r = min(s + d, 1)
43+
kModulate, //!< r = s*d
44+
kScreen, //!< r = s + d - s*d
45+
46+
kOverlay, //!< multiply or screen, depending on destination
47+
kDarken, //!< rc = s + d - max(s*da, d*sa), ra = kSrcOver
48+
kLighten, //!< rc = s + d - min(s*da, d*sa), ra = kSrcOver
49+
kColorDodge, //!< brighten destination to reflect source
50+
kColorBurn, //!< darken destination to reflect source
51+
kHardLight, //!< multiply or screen, depending on source
52+
kSoftLight, //!< lighten or darken, depending on source
53+
kDifference, //!< rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver
54+
kExclusion, //!< rc = s + d - two(s*d), ra = kSrcOver
55+
kMultiply, //!< r = s*(1-da) + d*(1-sa) + s*d
56+
57+
kHue, //!< hue of source with saturation and luminosity of destination
58+
kSaturation, //!< saturation of source with hue and luminosity of destination
59+
kColor, //!< hue and saturation of source with luminosity of destination
60+
kLuminosity, //!< luminosity of source with hue and saturation of destination
61+
62+
kLastCoeffMode = kScreen, //!< last porter duff blend mode
63+
kLastSeparableMode =
64+
kMultiply, //!< last blend mode operating separately on components
65+
kLastMode = kLuminosity, //!< last valid value
66+
};
67+
68+
inline DlBlendMode ToDl(SkBlendMode mode) {
69+
return static_cast<DlBlendMode>(mode);
70+
}
71+
72+
inline SkBlendMode ToSk(DlBlendMode mode) {
73+
return static_cast<SkBlendMode>(mode);
74+
}
75+
76+
} // namespace flutter
77+
78+
#endif // FLUTTER_DISPLAY_LIST_DISPLAY_LIST_BLEND_MODE_H_

display_list/display_list_builder.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "flutter/display_list/display_list_builder.h"
66

7+
#include "flutter/display_list/display_list_blend_mode.h"
78
#include "flutter/display_list/display_list_ops.h"
89

910
namespace flutter {
@@ -103,7 +104,7 @@ void DisplayListBuilder::onSetStrokeMiter(SkScalar limit) {
103104
void DisplayListBuilder::onSetColor(SkColor color) {
104105
Push<SetColorOp>(0, 0, current_color_ = color);
105106
}
106-
void DisplayListBuilder::onSetBlendMode(SkBlendMode mode) {
107+
void DisplayListBuilder::onSetBlendMode(DlBlendMode mode) {
107108
current_blender_ = nullptr;
108109
Push<SetBlendModeOp>(0, 0, current_blend_mode_ = mode);
109110
UpdateCurrentOpacityCompatibility();
@@ -115,7 +116,7 @@ void DisplayListBuilder::onSetBlender(sk_sp<SkBlender> blender) {
115116
SkPaint p;
116117
p.setBlender(blender);
117118
if (p.asBlendMode()) {
118-
setBlendMode(p.asBlendMode().value());
119+
setBlendMode(ToDl(p.asBlendMode().value()));
119120
} else {
120121
// |current_blender_| supersedes any value of |current_blend_mode_|
121122
(current_blender_ = blender) //
@@ -263,7 +264,7 @@ void DisplayListBuilder::setAttributesFromPaint(
263264
if (flags.applies_blend()) {
264265
std::optional<SkBlendMode> mode_optional = paint.asBlendMode();
265266
if (mode_optional) {
266-
setBlendMode(mode_optional.value());
267+
setBlendMode(ToDl(mode_optional.value()));
267268
} else {
268269
setBlender(sk_ref_sp(paint.getBlender()));
269270
}
@@ -479,7 +480,7 @@ void DisplayListBuilder::drawPaint() {
479480
Push<DrawPaintOp>(0, 1);
480481
CheckLayerOpacityCompatibility();
481482
}
482-
void DisplayListBuilder::drawColor(SkColor color, SkBlendMode mode) {
483+
void DisplayListBuilder::drawColor(SkColor color, DlBlendMode mode) {
483484
Push<DrawColorOp>(0, 1, color, mode);
484485
CheckLayerOpacityCompatibility(mode);
485486
}
@@ -559,7 +560,7 @@ void DisplayListBuilder::drawPoints(SkCanvas::PointMode mode,
559560
UpdateLayerOpacityCompatibility(false);
560561
}
561562
void DisplayListBuilder::drawVertices(const sk_sp<SkVertices> vertices,
562-
SkBlendMode mode) {
563+
DlBlendMode mode) {
563564
Push<DrawVerticesOp>(0, 1, std::move(vertices), mode);
564565
// DrawVertices applies its colors to the paint so we have no way
565566
// of controlling opacity using the current paint attributes.
@@ -625,7 +626,7 @@ void DisplayListBuilder::drawAtlas(const sk_sp<SkImage> atlas,
625626
const SkRect tex[],
626627
const SkColor colors[],
627628
int count,
628-
SkBlendMode mode,
629+
DlBlendMode mode,
629630
const SkSamplingOptions& sampling,
630631
const SkRect* cull_rect,
631632
bool render_with_attributes) {

0 commit comments

Comments
 (0)