@@ -57,11 +57,17 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
5757 if (dl_image_) {
5858 DlAutoCanvasRestore autoRestore (context.canvas , true );
5959
60- // The incoming texture is vertically flipped, so we flip it
61- // back. OpenGL's coordinate system has Positive Y equivalent to up, while
62- // Skia's coordinate system has Negative Y equvalent to up.
63- context.canvas ->Translate (bounds.x (), bounds.y () + bounds.height ());
64- context.canvas ->Scale (bounds.width (), -bounds.height ());
60+ // The incoming texture is vertically flipped, so we flip it back.
61+ //
62+ // OpenGL's coordinate system has Positive Y equivalent to up, while Skia's
63+ // coordinate system (as well as Impeller's) has Negative Y equvalent to up.
64+ {
65+ // Move (translate) the origin to the bottom-left corner of the image.
66+ context.canvas ->Translate (bounds.x (), bounds.y () + bounds.height ());
67+
68+ // No change in the X axis, but we need to flip the Y axis.
69+ context.canvas ->Scale (1 , -1 );
70+ }
6571
6672 if (!transform_.isIdentity ()) {
6773 DlImageColorSource source (dl_image_, DlTileMode::kClamp ,
@@ -72,7 +78,8 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
7278 paintWithShader = *context.paint ;
7379 }
7480 paintWithShader.setColorSource (&source);
75- context.canvas ->DrawRect (SkRect::MakeWH (1 , 1 ), paintWithShader);
81+ context.canvas ->DrawRect (SkRect::MakeWH (bounds.width (), bounds.height ()),
82+ paintWithShader);
7683 } else {
7784 context.canvas ->DrawImage (dl_image_, {0 , 0 }, sampling, context.paint );
7885 }
0 commit comments