Commit d442b631 authored by Vasiliy Telezhnikov's avatar Vasiliy Telezhnikov Committed by Commit Bot

Always use RGBA color type for WebView

For WebView the render target is provided by hwui (except when we use
intermediate FBO to support stenil) and we don't know whether it
supports alpha or not. So we assume always RGBA format

Change-Id: Icbc3464961147a172e767d1ebdc8f7b9944479ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2329918Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#793578}
parent 2ab9ecaf
...@@ -36,17 +36,7 @@ SkiaOutputDeviceWebView::SkiaOutputDeviceWebView( ...@@ -36,17 +36,7 @@ SkiaOutputDeviceWebView::SkiaOutputDeviceWebView(
DCHECK(context_state_->gr_context()); DCHECK(context_state_->gr_context());
DCHECK(context_state_->context()); DCHECK(context_state_->context());
// Get alpha bits from the default frame buffer. capabilities_.sk_color_type = kRGBA_8888_SkColorType;
glBindFramebufferEXT(GL_FRAMEBUFFER,
gl_surface_->GetBackingFramebufferObject());
context_state_->gr_context()->resetContext(kRenderTarget_GrGLBackendState);
GLint alpha_bits = 0;
glGetIntegerv(GL_ALPHA_BITS, &alpha_bits);
CHECK_GL_ERROR();
supports_alpha_ = alpha_bits > 0;
capabilities_.sk_color_type =
supports_alpha_ ? kRGBA_8888_SkColorType : kRGB_888x_SkColorType;
capabilities_.gr_backend_format = capabilities_.gr_backend_format =
context_state_->gr_context()->defaultBackendFormat( context_state_->gr_context()->defaultBackendFormat(
capabilities_.sk_color_type, GrRenderable::kYes); capabilities_.sk_color_type, GrRenderable::kYes);
...@@ -109,9 +99,8 @@ void SkiaOutputDeviceWebView::InitSkiaSurface(unsigned int fbo) { ...@@ -109,9 +99,8 @@ void SkiaOutputDeviceWebView::InitSkiaSurface(unsigned int fbo) {
GrGLFramebufferInfo framebuffer_info; GrGLFramebufferInfo framebuffer_info;
framebuffer_info.fFBOID = fbo; framebuffer_info.fFBOID = fbo;
framebuffer_info.fFormat = supports_alpha_ ? GL_RGBA8 : GL_RGB8_OES; framebuffer_info.fFormat = GL_RGBA8;
DCHECK_EQ(capabilities_.gr_backend_format.asGLFormat(), DCHECK_EQ(capabilities_.gr_backend_format.asGLFormat(), GrGLFormat::kRGBA8);
supports_alpha_ ? GrGLFormat::kRGBA8 : GrGLFormat::kRGB8);
SkColorType color_type = capabilities_.sk_color_type; SkColorType color_type = capabilities_.sk_color_type;
GrBackendRenderTarget render_target(size_.width(), size_.height(), GrBackendRenderTarget render_target(size_.width(), size_.height(),
......
...@@ -58,8 +58,6 @@ class SkiaOutputDeviceWebView : public SkiaOutputDevice { ...@@ -58,8 +58,6 @@ class SkiaOutputDeviceWebView : public SkiaOutputDevice {
gfx::ColorSpace color_space_; gfx::ColorSpace color_space_;
unsigned int last_frame_buffer_object_ = -1; unsigned int last_frame_buffer_object_ = -1;
bool supports_alpha_ = false;
base::WeakPtrFactory<SkiaOutputDeviceWebView> weak_ptr_factory_{this}; base::WeakPtrFactory<SkiaOutputDeviceWebView> weak_ptr_factory_{this};
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment