diff --git a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc index 317d2ba29f..e74c93bb22 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc +++ b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc @@ -4,18 +4,6 @@ #include "gpu_surface_gl.h" -#if OS_IOS -#include -#include -#elif OS_MACOSX -#include -#elif OS_LINUX -#include -#else -#include -#include -#endif - #include "flutter/glue/trace_event.h" #include "lib/fxl/arraysize.h" #include "lib/fxl/logging.h" @@ -24,6 +12,7 @@ #include "third_party/skia/include/gpu/GrBackendSurface.h" #include "third_party/skia/include/gpu/GrContextOptions.h" #include "third_party/skia/include/gpu/gl/GrGLInterface.h" +#include "third_party/skia/src/gpu/gl/GrGLDefines.h" namespace shell { @@ -87,27 +76,23 @@ bool GPUSurfaceGL::IsValid() { return valid_; } -static SkColorType FirstSupportedColorType(GrContext* context, GLenum* format) { +static SkColorType FirstSupportedColorType(GrContext* context, + GrGLenum* format) { #define RETURN_IF_RENDERABLE(x, y) \ if (context->colorTypeSupportedAsSurface((x))) { \ *format = (y); \ return (x); \ } -#if (OS_MACOSX && !OS_IOS) || OS_LINUX - RETURN_IF_RENDERABLE(kRGBA_8888_SkColorType, GL_RGBA8); -#else - RETURN_IF_RENDERABLE(kRGBA_8888_SkColorType, GL_RGBA8_OES); -#endif - RETURN_IF_RENDERABLE(kARGB_4444_SkColorType, GL_RGBA4); - RETURN_IF_RENDERABLE(kRGB_565_SkColorType, GL_RGB565); + RETURN_IF_RENDERABLE(kRGBA_8888_SkColorType, GR_GL_RGBA8); + RETURN_IF_RENDERABLE(kARGB_4444_SkColorType, GR_GL_RGBA4); + RETURN_IF_RENDERABLE(kRGB_565_SkColorType, GR_GL_RGB565); return kUnknown_SkColorType; } static sk_sp WrapOnscreenSurface(GrContext* context, const SkISize& size, intptr_t fbo) { - - GLenum format; + GrGLenum format; const SkColorType color_type = FirstSupportedColorType(context, &format); const GrGLFramebufferInfo framebuffer_info = { @@ -115,7 +100,6 @@ static sk_sp WrapOnscreenSurface(GrContext* context, .fFormat = format, }; - GrBackendRenderTarget render_target(size.fWidth, // width size.fHeight, // height 0, // sample count @@ -214,11 +198,11 @@ std::unique_ptr GPUSurfaceGL::AcquireFrame(const SkISize& size) { return nullptr; } - SurfaceFrame::SubmitCallback submit_callback = [weak = weak_factory_ - .GetWeakPtr()]( - const SurfaceFrame& surface_frame, SkCanvas* canvas) { - return weak ? weak->PresentSurface(canvas) : false; - }; + SurfaceFrame::SubmitCallback submit_callback = + [weak = weak_factory_.GetWeakPtr()](const SurfaceFrame& surface_frame, + SkCanvas* canvas) { + return weak ? weak->PresentSurface(canvas) : false; + }; return std::make_unique(surface, submit_callback); }