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

Unified Diff: services/ui/public/cpp/software_output_device.cc

Issue 2232793002: services/ui: Move cc::SoftwareOutputDevice implementation into the client lib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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
Index: services/ui/public/cpp/software_output_device.cc
diff --git a/content/browser/compositor/software_output_device_mus.cc b/services/ui/public/cpp/software_output_device.cc
similarity index 43%
rename from content/browser/compositor/software_output_device_mus.cc
rename to services/ui/public/cpp/software_output_device.cc
index c98153ac9e126d19884492aaa4a4ce67442ba653..642367eda7ecf40425c5bcdffa801e62aa2099c2 100644
--- a/content/browser/compositor/software_output_device_mus.cc
+++ b/services/ui/public/cpp/software_output_device.cc
@@ -2,32 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/compositor/software_output_device_mus.h"
+#include "services/ui/public/cpp/software_output_device.h"
#include <stddef.h>
#include <utility>
#include "services/ui/public/cpp/bitmap_uploader.h"
#include "third_party/skia/include/core/SkImageInfo.h"
-#include "ui/base/view_prop.h"
-#include "ui/compositor/compositor.h"
-#include "ui/gfx/skia_util.h"
-#if !defined(OFFICIAL_BUILD)
-#include "base/threading/thread_restrictions.h"
-#endif
+namespace ui {
-namespace content {
-
-SoftwareOutputDeviceMus::SoftwareOutputDeviceMus(ui::Compositor* compositor)
- : compositor_(compositor) {}
+SoftwareOutputDevice::SoftwareOutputDevice(Window* window)
+ : uploader_(new BitmapUploader(window)) {
+ uploader_->Init();
+}
-void SoftwareOutputDeviceMus::EndPaint() {
- SoftwareOutputDevice::EndPaint();
-#if !defined(OFFICIAL_BUILD)
- base::ThreadRestrictions::ScopedAllowWait wait;
-#endif
+SoftwareOutputDevice::~SoftwareOutputDevice() {}
+void SoftwareOutputDevice::EndPaint() {
if (!surface_)
return;
@@ -36,32 +28,26 @@ void SoftwareOutputDeviceMus::EndPaint() {
if (rect.IsEmpty())
return;
- gfx::AcceleratedWidget widget = compositor_->widget();
- ui::BitmapUploader* uploader =
- reinterpret_cast<ui::BitmapUploader*>(ui::ViewProp::GetValue(
- widget, ui::kBitmapUploaderForAcceleratedWidget));
- DCHECK(uploader);
-
SkPixmap pixmap;
surface_->peekPixels(&pixmap);
if (!pixmap.addr()) {
- LOG(WARNING) << "SoftwareOutputDeviceMus: skia surface did not provide us "
+ LOG(WARNING) << "SoftwareOutputDevice: skia surface did not provide us "
"with pixels";
return;
}
- const unsigned char* pixels = static_cast<const unsigned char*>(
- pixmap.addr());
+ const unsigned char* pixels =
+ static_cast<const unsigned char*>(pixmap.addr());
// TODO(rjkroege): This makes an additional copy. Improve the
// bitmap_uploader API to remove.
std::unique_ptr<std::vector<unsigned char>> data(
new std::vector<unsigned char>(
pixels, pixels + pixmap.rowBytes() * viewport_pixel_size_.height()));
- uploader->SetBitmap(viewport_pixel_size_.width(),
- viewport_pixel_size_.height(), std::move(data),
- ui::BitmapUploader::BGRA);
+ uploader_->SetBitmap(viewport_pixel_size_.width(),
+ viewport_pixel_size_.height(), std::move(data),
+ ui::BitmapUploader::BGRA);
}
-} // namespace content
+} // namespace ui
« services/ui/public/cpp/BUILD.gn ('K') | « services/ui/public/cpp/software_output_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698