Update external texture image code to specify GL texture format and image color type rather than GrPixelConfig (flutter/engine#4786)

This commit is contained in:
Brian Salomon
2018-03-14 13:29:13 -04:00
committed by Jason Simmons
parent 457de9145f
commit 4064f10e01
2 changed files with 7 additions and 6 deletions

View File

@@ -42,11 +42,11 @@ void AndroidExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds) {
Update();
new_frame_ready_ = false;
}
GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES, texture_name_};
GrBackendTexture backendTexture(1, 1, kRGBA_8888_GrPixelConfig, textureInfo);
GrGLTextureInfo textureInfo = {GL_TEXTURE_EXTERNAL_OES, texture_name_, GL_RGBA8_OES};
GrBackendTexture backendTexture(1, 1, GrMipMapped::kNo, textureInfo);
sk_sp<SkImage> image = SkImage::MakeFromTexture(
canvas.getGrContext(), backendTexture, kTopLeft_GrSurfaceOrigin,
SkAlphaType::kPremul_SkAlphaType, nullptr);
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr);
if (image) {
SkAutoCanvasRestore autoRestore(&canvas, true);
canvas.translate(bounds.x(), bounds.y());

View File

@@ -57,12 +57,13 @@ void IOSExternalTextureGL::Paint(SkCanvas& canvas, const SkRect& bounds) {
return;
}
GrGLTextureInfo textureInfo = {CVOpenGLESTextureGetTarget(texture_ref_),
CVOpenGLESTextureGetName(texture_ref_)};
GrBackendTexture backendTexture(bounds.width(), bounds.height(), kRGBA_8888_GrPixelConfig,
CVOpenGLESTextureGetName(texture_ref_),
GL_RGBA8_OES};
GrBackendTexture backendTexture(bounds.width(), bounds.height(), GrMipMapped::kNo,
textureInfo);
sk_sp<SkImage> image =
SkImage::MakeFromTexture(canvas.getGrContext(), backendTexture, kTopLeft_GrSurfaceOrigin,
SkAlphaType::kPremul_SkAlphaType, nullptr);
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr);
if (image) {
canvas.drawImage(image, bounds.x(), bounds.y());
}