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

Unified Diff: services/ui/ws/frame_generator.cc

Issue 2127383003: mus: Introduce high-contrast mode in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-nit Created 4 years, 5 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 | « services/ui/ws/display.cc ('k') | services/ui/ws/frame_generator_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/frame_generator.cc
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc
index d09b0d7288ec6a725dd308c46025b4c29fbbc4a7..089882901304e4d1991507eb7cde96bfa0fbb578 100644
--- a/services/ui/ws/frame_generator.cc
+++ b/services/ui/ws/frame_generator.cc
@@ -7,6 +7,7 @@
#include "base/containers/adapters.h"
#include "cc/output/compositor_frame.h"
#include "cc/quads/render_pass.h"
+#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/shared_quad_state.h"
#include "cc/quads/surface_draw_quad.h"
#include "services/ui/surfaces/display_compositor.h"
@@ -26,7 +27,9 @@ FrameGenerator::FrameGenerator(FrameGeneratorDelegate* delegate,
gpu_state_(gpu_state),
surfaces_state_(surfaces_state),
draw_timer_(false, false),
- weak_factory_(this) {}
+ weak_factory_(this) {
+ DCHECK(delegate_);
+}
FrameGenerator::~FrameGenerator() {
// Invalidate WeakPtrs now to avoid callbacks back into the
@@ -90,8 +93,10 @@ void FrameGenerator::DidDraw(cc::SurfaceDrawStatus status) {
cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() {
const ViewportMetrics& metrics = delegate_->GetViewportMetrics();
std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
- render_pass->damage_rect = dirty_rect_;
- render_pass->output_rect = gfx::Rect(metrics.size_in_pixels);
+ gfx::Rect output_rect(metrics.size_in_pixels);
+ dirty_rect_.Intersect(output_rect);
+ render_pass->SetNew(cc::RenderPassId(1, 1), output_rect, dirty_rect_,
+ gfx::Transform());
DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(),
1.0f);
@@ -99,6 +104,26 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame() {
std::unique_ptr<cc::DelegatedFrameData> frame_data(
new cc::DelegatedFrameData);
frame_data->render_pass_list.push_back(std::move(render_pass));
+ if (delegate_->IsInHighContrastMode()) {
+ std::unique_ptr<cc::RenderPass> invert_pass = cc::RenderPass::Create();
danakj 2016/07/08 19:59:23 pls call SetNew on the pass, rather than setting a
sadrul 2016/07/08 20:10:27 Done.
+ invert_pass->damage_rect = dirty_rect_;
+ invert_pass->output_rect = gfx::Rect(metrics.size_in_pixels);
+ ServerWindow* root = delegate_->GetRootWindow();
+ cc::SharedQuadState* shared_state =
+ invert_pass->CreateAndAppendSharedQuadState();
+ shared_state->SetAll(gfx::Transform(), root->bounds().size(),
danakj 2016/07/08 19:59:23 Why are you using these root bounds. Are they not
sadrul 2016/07/08 20:10:27 Done.
+ root->bounds(), root->bounds(), false, 1.f,
+ SkXfermode::kSrcOver_Mode, 0);
+ auto* quad = invert_pass->CreateAndAppendDrawQuad<cc::RenderPassDrawQuad>();
+ cc::FilterOperations filters;
+ filters.Append(cc::FilterOperation::CreateInvertFilter(1.0));
+ quad->SetNew(shared_state, root->bounds(), root->bounds(),
+ cc::RenderPassId(1, 1),
+ 0, // mask_resource_id
danakj 2016/07/08 19:59:23 if you use /* */ then it can pack parameters bette
sadrul 2016/07/08 20:10:27 Done.
+ gfx::Vector2dF(), gfx::Size(), filters, gfx::Vector2dF(),
+ cc::FilterOperations());
+ frame_data->render_pass_list.push_back(std::move(invert_pass));
+ }
cc::CompositorFrame frame;
frame.delegated_frame_data = std::move(frame_data);
« no previous file with comments | « services/ui/ws/display.cc ('k') | services/ui/ws/frame_generator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698