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

Commit bb77c80

Browse files
committed
minor fixes: transform2x3 constants, indentation, paint shader sampling
1 parent c19a937 commit bb77c80

File tree

3 files changed

+31
-23
lines changed

3 files changed

+31
-23
lines changed

flow/display_list_interpreter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ CANVAS_OP_DEFINE_OP(transform2x3,
278278
context.canvas->concat(SkMatrix::MakeAll(
279279
it.GetScalar(), it.GetScalar(), it.GetScalar(),
280280
it.GetScalar(), it.GetScalar(), it.GetScalar(),
281-
0.0, 0.0, 0.1
281+
0.0, 0.0, 1.0
282282
));
283283
)
284284
CANVAS_OP_DEFINE_OP(transform3x3,

lib/ui/painting.dart

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5980,12 +5980,12 @@ class _DisplayListCanvas implements Canvas {
59805980

59815981
@override
59825982
void drawAtlas(Image atlas,
5983-
List<RSTransform> transforms,
5984-
List<Rect> rects,
5985-
List<Color>? colors,
5986-
BlendMode? blendMode,
5987-
Rect? cullRect,
5988-
Paint paint) {
5983+
List<RSTransform> transforms,
5984+
List<Rect> rects,
5985+
List<Color>? colors,
5986+
BlendMode? blendMode,
5987+
Rect? cullRect,
5988+
Paint paint) {
59895989
final int rectCount = rects.length;
59905990
if (transforms.length != rectCount)
59915991
throw ArgumentError('"transforms" and "rects" lengths must match.');
@@ -6032,12 +6032,12 @@ class _DisplayListCanvas implements Canvas {
60326032

60336033
@override
60346034
void drawRawAtlas(Image atlas,
6035-
Float32List rstTransforms,
6036-
Float32List rects,
6037-
Int32List? colors,
6038-
BlendMode? blendMode,
6039-
Rect? cullRect,
6040-
Paint paint) {
6035+
Float32List rstTransforms,
6036+
Float32List rects,
6037+
Int32List? colors,
6038+
BlendMode? blendMode,
6039+
Rect? cullRect,
6040+
Paint paint) {
60416041
final int rectCount = rects.length;
60426042
if (rstTransforms.length != rectCount)
60436043
throw ArgumentError('"rstTransforms" and "rects" lengths must match.');

lib/ui/painting/display_list.cc

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,24 @@ fml::RefPtr<DisplayList> DisplayList::Create(tonic::Uint8List& ops,
9191
std::shared_ptr<std::vector<DisplayListRefHolder>> ref_vector =
9292
std::make_shared<std::vector<DisplayListRefHolder>>();
9393
int obj_index = 0;
94-
const DisplayListRefHolder empty_holder;
94+
SkSamplingOptions sampling = DisplayListInterpreter::NearestSampling;
9595
for (uint8_t op : *ops_vector) {
96+
switch (op) {
97+
// All of the following op types have no arguments so they can
98+
// use continue instead of break for efficiency.
99+
case CanvasOp::cops_setFilterQualityNearest:
100+
sampling = DisplayListInterpreter::NearestSampling;
101+
continue;
102+
case CanvasOp::cops_setFilterQualityLinear:
103+
sampling = DisplayListInterpreter::LinearSampling;
104+
continue;
105+
case CanvasOp::cops_setFilterQualityMipmap:
106+
sampling = DisplayListInterpreter::MipmapSampling;
107+
continue;
108+
case CanvasOp::cops_setFilterQualityCubic:
109+
sampling = DisplayListInterpreter::CubicSampling;
110+
continue;
111+
}
96112
for (uint32_t args = DisplayListInterpreter::opArguments[op];
97113
args != 0;
98114
args >>= CANVAS_OP_ARG_SHIFT) {
@@ -123,15 +139,7 @@ fml::RefPtr<DisplayList> DisplayList::Create(tonic::Uint8List& ops,
123139
}
124140
case shader: {
125141
DisplayListRefHolder holder;
126-
// TODO(flar) we should eventually be baking the filterquality into the Shader
127-
// The existing Shader::shader(FQ) API is meant to be called in context from
128-
// the SkiaCanvas paint method. We could parse the stream to determine the
129-
// filter quality that would be in effect when we reach this op, but that is
130-
// overhead to consider another time.
131-
// (The dart DisplayListCanvas code could also encode the current FQ into the
132-
// op code - but soon we should be able to encode it into the shader itself
133-
// and this issue will be moot...)
134-
holder.shader = tonic::DartConverter<Shader*>::FromDart(objects[obj_index++])->shader(SkFilterQuality::kLow_SkFilterQuality);
142+
holder.shader = tonic::DartConverter<Shader*>::FromDart(objects[obj_index++])->shader(sampling);
135143
ref_vector->emplace_back(holder);
136144
break;
137145
}

0 commit comments

Comments
 (0)