OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/output/begin_frame_args.h" | 9 #include "cc/output/begin_frame_args.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 : public cc::SoftwareOutputDevice { | 71 : public cc::SoftwareOutputDevice { |
72 public: | 72 public: |
73 SoftwareDevice(SynchronousCompositorOutputSurface* surface) | 73 SoftwareDevice(SynchronousCompositorOutputSurface* surface) |
74 : surface_(surface), | 74 : surface_(surface), |
75 null_device_(SkBitmap::kARGB_8888_Config, 1, 1), | 75 null_device_(SkBitmap::kARGB_8888_Config, 1, 1), |
76 null_canvas_(&null_device_) { | 76 null_canvas_(&null_device_) { |
77 } | 77 } |
78 virtual void Resize(gfx::Size size) OVERRIDE { | 78 virtual void Resize(gfx::Size size) OVERRIDE { |
79 // Intentional no-op: canvas size is controlled by the embedder. | 79 // Intentional no-op: canvas size is controlled by the embedder. |
80 } | 80 } |
81 virtual SkCanvas* BeginPaint(gfx::Rect damage_rect) OVERRIDE { | 81 virtual SkCanvas* BeginPaint(const gfx::Rect& damage_rect) OVERRIDE { |
82 if (!surface_->current_sw_canvas_) { | 82 if (!surface_->current_sw_canvas_) { |
83 NOTREACHED() << "BeginPaint with no canvas set"; | 83 NOTREACHED() << "BeginPaint with no canvas set"; |
84 return &null_canvas_; | 84 return &null_canvas_; |
85 } | 85 } |
86 LOG_IF(WARNING, surface_->did_swap_buffer_) | 86 LOG_IF(WARNING, surface_->did_swap_buffer_) |
87 << "Mutliple calls to BeginPaint per frame"; | 87 << "Mutliple calls to BeginPaint per frame"; |
88 return surface_->current_sw_canvas_; | 88 return surface_->current_sw_canvas_; |
89 } | 89 } |
90 virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE { | 90 virtual void EndPaint(cc::SoftwareFrameData* frame_data) OVERRIDE { |
91 } | 91 } |
92 virtual void CopyToBitmap(gfx::Rect rect, SkBitmap* output) OVERRIDE { | 92 virtual void CopyToBitmap(const gfx::Rect& rect, SkBitmap* output) OVERRIDE { |
93 NOTIMPLEMENTED(); | 93 NOTIMPLEMENTED(); |
94 } | 94 } |
95 | 95 |
96 private: | 96 private: |
97 SynchronousCompositorOutputSurface* surface_; | 97 SynchronousCompositorOutputSurface* surface_; |
98 SkBitmapDevice null_device_; | 98 SkBitmapDevice null_device_; |
99 SkCanvas null_canvas_; | 99 SkCanvas null_canvas_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); | 101 DISALLOW_COPY_AND_ASSIGN(SoftwareDevice); |
102 }; | 102 }; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 307 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
308 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 308 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
309 } | 309 } |
310 | 310 |
311 SynchronousCompositorOutputSurfaceDelegate* | 311 SynchronousCompositorOutputSurfaceDelegate* |
312 SynchronousCompositorOutputSurface::GetDelegate() { | 312 SynchronousCompositorOutputSurface::GetDelegate() { |
313 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 313 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
314 } | 314 } |
315 | 315 |
316 } // namespace content | 316 } // namespace content |
OLD | NEW |