OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/demo/bitmap_uploader.h" | 5 #include "services/ui/demo/bitmap_uploader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/threading/thread_task_runner_handle.h" | 12 #include "base/threading/thread_task_runner_handle.h" |
13 #include "cc/ipc/compositor_frame.mojom.h" | 13 #include "cc/ipc/compositor_frame.mojom.h" |
14 #include "cc/quads/render_pass.h" | 14 #include "cc/quads/render_pass.h" |
15 #include "cc/quads/solid_color_draw_quad.h" | 15 #include "cc/quads/solid_color_draw_quad.h" |
16 #include "cc/quads/texture_draw_quad.h" | 16 #include "cc/quads/texture_draw_quad.h" |
17 #include "services/ui/public/cpp/context_provider.h" | 17 #include "services/ui/public/cpp/context_provider.h" |
18 #include "services/ui/public/cpp/gles2_context.h" | 18 #include "services/ui/public/cpp/gles2_context.h" |
19 #include "services/ui/public/cpp/gpu_service.h" | 19 #include "services/ui/public/cpp/gpu_service.h" |
20 #include "services/ui/public/cpp/window.h" | 20 #include "services/ui/public/cpp/window.h" |
21 #include "services/ui/public/cpp/window_surface.h" | |
22 | 21 |
23 namespace ui { | 22 namespace ui { |
24 namespace { | 23 namespace { |
25 | 24 |
26 const uint32_t g_transparent_color = 0x00000000; | 25 const uint32_t g_transparent_color = 0x00000000; |
27 | 26 |
28 } // namespace | 27 } // namespace |
29 | 28 |
30 const char kBitmapUploaderForAcceleratedWidget[] = | 29 const char kBitmapUploaderForAcceleratedWidget[] = |
31 "__BITMAP_UPLOADER_ACCELERATED_WIDGET__"; | 30 "__BITMAP_UPLOADER_ACCELERATED_WIDGET__"; |
32 | 31 |
33 BitmapUploader::BitmapUploader(Window* window) | 32 BitmapUploader::BitmapUploader(Window* window) |
34 : window_(window), | 33 : window_(window), |
35 color_(g_transparent_color), | 34 color_(g_transparent_color), |
36 width_(0), | 35 width_(0), |
37 height_(0), | 36 height_(0), |
38 format_(BGRA), | 37 format_(BGRA), |
39 next_resource_id_(1u) { | 38 next_resource_id_(1u) { |
40 } | 39 } |
41 | 40 |
42 void BitmapUploader::Init(ui::GpuService* gpu_service) { | 41 void BitmapUploader::Init(ui::GpuService* gpu_service) { |
43 compositor_frame_sink_ = window_->RequestCompositorFrameSink( | 42 compositor_frame_sink_ = window_->RequestCompositorFrameSink( |
44 mojom::SurfaceType::DEFAULT, | 43 mojom::CompositorFrameSinkType::DEFAULT, |
45 new ContextProvider(gpu_service->EstablishGpuChannelSync())); | 44 new ContextProvider(gpu_service->EstablishGpuChannelSync())); |
46 compositor_frame_sink_->BindToClient(this); | 45 compositor_frame_sink_->BindToClient(this); |
47 } | 46 } |
48 | 47 |
49 BitmapUploader::~BitmapUploader() { | 48 BitmapUploader::~BitmapUploader() { |
50 compositor_frame_sink_->DetachFromClient(); | 49 compositor_frame_sink_->DetachFromClient(); |
51 } | 50 } |
52 | 51 |
53 // Sets the color which is RGBA. | 52 // Sets the color which is RGBA. |
54 void BitmapUploader::SetColor(uint32_t color) { | 53 void BitmapUploader::SetColor(uint32_t color) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 const gfx::Rect& viewport, | 215 const gfx::Rect& viewport, |
217 bool resourceless_software_draw) {} | 216 bool resourceless_software_draw) {} |
218 | 217 |
219 void BitmapUploader::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) {} | 218 void BitmapUploader::SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) {} |
220 | 219 |
221 void BitmapUploader::SetExternalTilePriorityConstraints( | 220 void BitmapUploader::SetExternalTilePriorityConstraints( |
222 const gfx::Rect& viewport_rect, | 221 const gfx::Rect& viewport_rect, |
223 const gfx::Transform& transform) {} | 222 const gfx::Transform& transform) {} |
224 | 223 |
225 } // namespace ui | 224 } // namespace ui |
OLD | NEW |