Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 2822743003: Preserve alpha channel of 1.0 when emulating RGB back buffer.
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 7a26d0f0102499c20e5b3afe6f6e882fb03cdeeb..c41262a7c84d208adb2f66613bf496d4255bb80c 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -232,6 +232,10 @@ bool DrawingBuffer::DefaultBufferRequiresAlphaChannelToBePreserved() {
return !want_alpha_channel_ && rgb_emulation;
}
+void DrawingBuffer::MarkBlitFramebufferUsedThisFrame() {
+ blit_framebuffer_used_this_frame_ = true;
+}
+
std::unique_ptr<cc::SharedBitmap> DrawingBuffer::CreateOrRecycleBitmap() {
auto it = std::remove_if(
recycled_bitmaps_.begin(), recycled_bitmaps_.end(),
@@ -413,6 +417,7 @@ bool DrawingBuffer::FinishPrepareTextureMailboxGpu(
front_color_buffer_ = color_buffer_for_mailbox;
contents_changed_ = false;
+ blit_framebuffer_used_this_frame_ = false;
SetBufferClearNeeded(true);
return true;
}
@@ -1019,6 +1024,27 @@ void DrawingBuffer::ResolveMultisampleFramebufferInternal() {
void DrawingBuffer::ResolveIfNeeded() {
if (anti_aliasing_mode_ != kNone)
ResolveMultisampleFramebufferInternal();
+
+ // If the user performed a manual BlitFramebuffer to the default
+ // back buffer, they may have populated the alpha channel with
+ // values not equal to 1.0. Must undo this.
+ if (DefaultBufferRequiresAlphaChannelToBePreserved() &&
+ blit_framebuffer_used_this_frame_) {
+ // Avoid repeating this work if it's already been done.
+ if (anti_aliasing_mode_ != kNone &&
+ ContextProvider()
+ ->GetCapabilities()
+ .disable_multisampling_color_mask_usage) {
+ // Do nothing.
+ } else {
+ DCHECK(state_restorer_);
+ state_restorer_->SetClearStateDirty();
+ gl_->ClearColor(0, 0, 0, 1);
+ gl_->ColorMask(false, false, false, true);
+ gl_->Clear(GL_COLOR_BUFFER_BIT);
+ }
+ }
+
contents_change_resolved_ = true;
}
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698