Skip to content

Commit

Permalink
[web] Implement tilemode for gradient shaders. (flutter#22597)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatb authored and chaselatta committed Nov 30, 2020
1 parent 8549d65 commit 844bb15
Show file tree
Hide file tree
Showing 8 changed files with 394 additions and 141 deletions.
2 changes: 1 addition & 1 deletion lib/web_ui/dev/goldens_lock.yaml
@@ -1,2 +1,2 @@
repository: https://github.com/flutter/goldens.git
revision: 67f22ef933be27ba2be8b27df1b71b2c69eb86e5
revision: 06e0333b8371965dce5dc05e140e6dfb454f33fa
4 changes: 2 additions & 2 deletions lib/web_ui/lib/src/engine/canvaskit/shader.dart
Expand Up @@ -66,7 +66,7 @@ class CkGradientLinear extends CkShader implements ui.Gradient {
assert(_offsetIsValid(to)),
assert(colors != null), // ignore: unnecessary_null_comparison
assert(tileMode != null), // ignore: unnecessary_null_comparison
this.matrix4 = matrix == null ? null : _FastMatrix64(matrix) {
this.matrix4 = matrix {
if (assertionsEnabled) {
_validateColorStops(colors, colorStops);
}
Expand All @@ -77,7 +77,7 @@ class CkGradientLinear extends CkShader implements ui.Gradient {
final List<ui.Color> colors;
final List<double>? colorStops;
final ui.TileMode tileMode;
final _FastMatrix64? matrix4;
final Float64List? matrix4;

@override
SkShader createDefault() {
Expand Down
4 changes: 2 additions & 2 deletions lib/web_ui/lib/src/engine/html/render_vertices.dart
Expand Up @@ -126,7 +126,7 @@ class _WebGlRenderer implements _GlRenderer {
final String fragmentShader = _writeVerticesFragmentShader();
_GlContext gl = _GlContextCache.createGlContext(widthInPixels, heightInPixels)!;

_GlProgram glProgram = gl.useAndCacheProgram(vertexShader, fragmentShader)!;
_GlProgram glProgram = gl.useAndCacheProgram(vertexShader, fragmentShader);

Object transformUniform = gl.getUniformLocation(glProgram.program,
'u_ctransform');
Expand Down Expand Up @@ -487,7 +487,7 @@ class _GlContext {
left, top, _widthInPixels, _heightInPixels]);
}

_GlProgram? useAndCacheProgram(
_GlProgram useAndCacheProgram(
String vertexShaderSource, String fragmentShaderSource) {
String cacheKey = '$vertexShaderSource||$fragmentShaderSource';
_GlProgram? cachedProgram = _programCache[cacheKey];
Expand Down

0 comments on commit 844bb15

Please sign in to comment.