flutter_flutter/shell/platform/android/android_surface_gl.h
Brian Osman 0a7155d4e1
Disable linear blending, use SkColorSpaceXformCanvas instead (#4355)
This retains gamut correction (adjusting colors for screens with different capabilities), but does all blending and interpolation with sRGB-encoded values. That matches the behavior expected by most users, as well as the behavior of nearly all other systems. It also greatly simplifies the EGL code.

A future Skia change will make this behavior more of a first-class citizen, so some of these implementation details will change again, but the behavior will not. The bulk of this change (elimination of complication from the GL surface code) is permanent - it's just the SkColorSpaceXformCanvas that will be replaced.
2017-11-14 13:33:26 -05:00

61 lines
1.7 KiB
C++

// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_
#define FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_
#include <jni.h>
#include <memory>
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/android/android_context_gl.h"
#include "flutter/shell/platform/android/android_environment_gl.h"
#include "flutter/shell/platform/android/android_surface.h"
#include "lib/fxl/macros.h"
namespace shell {
class AndroidSurfaceGL : public GPUSurfaceGLDelegate, public AndroidSurface {
public:
explicit AndroidSurfaceGL(PlatformView::SurfaceConfig offscreen_config);
~AndroidSurfaceGL() override;
bool IsValid() const override;
bool IsOffscreenContextValid() const;
std::unique_ptr<Surface> CreateGPUSurface() override;
void TeardownOnScreenContext() override;
SkISize OnScreenSurfaceSize() const override;
bool OnScreenSurfaceResize(const SkISize& size) const override;
bool ResourceContextMakeCurrent() override;
bool SetNativeWindow(fxl::RefPtr<AndroidNativeWindow> window,
PlatformView::SurfaceConfig config) override;
bool GLContextMakeCurrent() override;
bool GLContextClearCurrent() override;
bool GLContextPresent() override;
intptr_t GLContextFBO() const override;
private:
fxl::RefPtr<AndroidContextGL> onscreen_context_;
fxl::RefPtr<AndroidContextGL> offscreen_context_;
sk_sp<GrContext> gr_context_;
FXL_DISALLOW_COPY_AND_ASSIGN(AndroidSurfaceGL);
};
} // namespace shell
#endif // FLUTTER_SHELL_PLATFORM_ANDROID_ANDROID_SURFACE_GL_H_