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

Side by Side Diff: components/mus/demo/mus_demo.cc

Issue 2060513002: Tab dragging as implemented as a mus API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Thread move loop source through api. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/mus/demo/mus_demo.h" 5 #include "components/mus/demo/mus_demo.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "components/bitmap_uploader/bitmap_uploader.h" 8 #include "components/bitmap_uploader/bitmap_uploader.h"
9 #include "components/mus/public/cpp/window.h" 9 #include "components/mus/public/cpp/window.h"
10 #include "components/mus/public/cpp/window_tree_client.h" 10 #include "components/mus/public/cpp/window_tree_client.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // Draw initial frame and start the timer to regularly draw frames. 121 // Draw initial frame and start the timer to regularly draw frames.
122 DrawFrame(); 122 DrawFrame();
123 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay), 123 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay),
124 base::Bind(&MusDemo::DrawFrame, base::Unretained(this))); 124 base::Bind(&MusDemo::DrawFrame, base::Unretained(this)));
125 } 125 }
126 126
127 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) { 127 void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) {
128 // Don't care 128 // Don't care
129 } 129 }
130 130
131 void MusDemo::OnWmPerformMoveLoop(::mus::Window* window,
132 ::mus::mojom::MoveLoopSource source,
133 const gfx::Point& cursor_location,
134 const base::Callback<void(bool)>& on_done) {
135 // Don't care
136 }
137
138 void MusDemo::OnWmCancelMoveLoop(::mus::Window* window) {}
139
131 void MusDemo::AllocBitmap() { 140 void MusDemo::AllocBitmap() {
132 const gfx::Rect bounds = window_->GetBoundsInRoot(); 141 const gfx::Rect bounds = window_->GetBoundsInRoot();
133 142
134 // Allocate bitmap the same size as the window for drawing. 143 // Allocate bitmap the same size as the window for drawing.
135 bitmap_.reset(); 144 bitmap_.reset();
136 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), 145 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(),
137 kPremul_SkAlphaType); 146 kPremul_SkAlphaType);
138 bitmap_.allocPixels(image_info); 147 bitmap_.allocPixels(image_info);
139 } 148 }
140 149
(...skipping 27 matching lines...) Expand all
168 std::unique_ptr<std::vector<unsigned char>> data( 177 std::unique_ptr<std::vector<unsigned char>> data(
169 new std::vector<unsigned char>(addr, addr + bytes)); 178 new std::vector<unsigned char>(addr, addr + bytes));
170 bitmap_.unlockPixels(); 179 bitmap_.unlockPixels();
171 180
172 // Send frame to MUS via BitmapUploader. 181 // Send frame to MUS via BitmapUploader.
173 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), 182 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
174 bitmap_uploader::BitmapUploader::BGRA); 183 bitmap_uploader::BitmapUploader::BGRA);
175 } 184 }
176 185
177 } // namespace mus_demo 186 } // namespace mus_demo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698