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

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: General patch cleanup. 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(uint32_t change_id,
132 uint32_t window_id,
133 const gfx::Point& cursor_location) {
134 // Don't care
135 }
136
137 void MusDemo::OnWmCancelMoveLoop(uint32_t window_id) {}
138
131 void MusDemo::AllocBitmap() { 139 void MusDemo::AllocBitmap() {
132 const gfx::Rect bounds = window_->GetBoundsInRoot(); 140 const gfx::Rect bounds = window_->GetBoundsInRoot();
133 141
134 // Allocate bitmap the same size as the window for drawing. 142 // Allocate bitmap the same size as the window for drawing.
135 bitmap_.reset(); 143 bitmap_.reset();
136 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), 144 SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(),
137 kPremul_SkAlphaType); 145 kPremul_SkAlphaType);
138 bitmap_.allocPixels(image_info); 146 bitmap_.allocPixels(image_info);
139 } 147 }
140 148
(...skipping 27 matching lines...) Expand all
168 std::unique_ptr<std::vector<unsigned char>> data( 176 std::unique_ptr<std::vector<unsigned char>> data(
169 new std::vector<unsigned char>(addr, addr + bytes)); 177 new std::vector<unsigned char>(addr, addr + bytes));
170 bitmap_.unlockPixels(); 178 bitmap_.unlockPixels();
171 179
172 // Send frame to MUS via BitmapUploader. 180 // Send frame to MUS via BitmapUploader.
173 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data), 181 uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
174 bitmap_uploader::BitmapUploader::BGRA); 182 bitmap_uploader::BitmapUploader::BGRA);
175 } 183 }
176 184
177 } // namespace mus_demo 185 } // namespace mus_demo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698