@@ -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