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

Commit 5584a78

Browse files
authored
Revert: "Change how OpenGL textures are flipped in the Android embedder" (#50158)
Reverts #49938. This broke `packages/packages/camera/camera/example`, and unfortunately there is no test (in engine, framework, or packages) that would have caught this. We also suspect (but are not sure) that this is related to an internal customer reported bug as well (b/322750489). --- Here is the output _pre_-revert: ![image](https://github.com/flutter/engine/assets/168174/0691feec-67a9-45b1-aa8e-1c692d09430b) Here is the output _post_-revert: ![image](https://github.com/flutter/engine/assets/168174/016dc79a-1e44-48cf-9ba0-a61397f8e637)
1 parent e49d9da commit 5584a78

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

shell/platform/android/surface_texture_external_texture.cc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,11 @@ 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 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-
}
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());
7165

7266
if (!transform_.isIdentity()) {
7367
DlImageColorSource source(dl_image_, DlTileMode::kClamp,
@@ -78,8 +72,7 @@ void SurfaceTextureExternalTexture::Paint(PaintContext& context,
7872
paintWithShader = *context.paint;
7973
}
8074
paintWithShader.setColorSource(&source);
81-
context.canvas->DrawRect(SkRect::MakeWH(bounds.width(), bounds.height()),
82-
paintWithShader);
75+
context.canvas->DrawRect(SkRect::MakeWH(1, 1), paintWithShader);
8376
} else {
8477
context.canvas->DrawImage(dl_image_, {0, 0}, sampling, context.paint);
8578
}

shell/platform/android/surface_texture_external_texture_gl.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@ void SurfaceTextureExternalTextureGL::ProcessFrame(PaintContext& context,
4848
// Create a
4949
GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES, texture_name_,
5050
GL_RGBA8_OES};
51-
auto backendTexture = GrBackendTextures::MakeGL(
52-
/*width=*/bounds.width(),
53-
/*height=*/bounds.height(),
54-
/*Mipmapped=*/skgpu::Mipmapped::kNo,
55-
/*glInfo=*/textureInfo);
51+
auto backendTexture =
52+
GrBackendTextures::MakeGL(1, 1, skgpu::Mipmapped::kNo, textureInfo);
5653
dl_image_ = DlImage::Make(SkImages::BorrowTextureFrom(
5754
context.gr_context, backendTexture, kTopLeft_GrSurfaceOrigin,
5855
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr));

0 commit comments

Comments
 (0)