Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ |
| 7 | 7 |
| 8 #include <IOSurface/IOSurface.h> | |
| 9 | |
| 10 #include "base/mac/scoped_cftyperef.h" | |
| 8 #include "cc/output/software_output_device.h" | 11 #include "cc/output/software_output_device.h" |
| 9 | 12 |
| 10 namespace gfx { | 13 namespace gfx { |
| 11 class Canvas; | 14 class Canvas; |
| 12 } | 15 } |
| 13 | 16 |
| 14 namespace ui { | 17 namespace ui { |
| 15 class Compositor; | 18 class Compositor; |
| 16 } | 19 } |
| 17 | 20 |
| 18 namespace content { | 21 namespace content { |
| 19 | 22 |
| 20 class SoftwareOutputDeviceMac : public cc::SoftwareOutputDevice { | 23 class SoftwareOutputDeviceMac : public cc::SoftwareOutputDevice { |
| 21 public: | 24 public: |
| 22 explicit SoftwareOutputDeviceMac(ui::Compositor* compositor); | 25 explicit SoftwareOutputDeviceMac(ui::Compositor* compositor); |
| 23 ~SoftwareOutputDeviceMac() override; | 26 ~SoftwareOutputDeviceMac() override; |
| 24 | 27 |
| 28 void Resize(const gfx::Size& pixel_size, float scale_factor) override; | |
| 29 SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override; | |
| 25 void EndPaint() override; | 30 void EndPaint() override; |
| 31 void DiscardBackbuffer() override; | |
| 32 void EnsureBackbuffer() override; | |
| 26 | 33 |
| 27 private: | 34 private: |
| 35 // Copy the pixels from the previous buffer to the new buffer. | |
| 36 void CopyPreviousBufferDamage(const gfx::Rect& new_damage_rect); | |
| 37 | |
| 28 ui::Compositor* compositor_; | 38 ui::Compositor* compositor_; |
| 39 gfx::Size pixel_size_; | |
| 40 float scale_factor_; | |
|
tapted
2015/10/26 02:51:41
this shadows a protected: member in cc::SoftwareOu
ccameron
2015/10/26 06:40:33
Agree -- I think that cc::SoftwareOutputDevice nee
| |
| 41 | |
| 42 // This surface is double-buffered. The two buffers are in |io_surfaces_|, | |
| 43 // and the index of the current buffer is |current_buffer_|. | |
| 44 base::ScopedCFTypeRef<IOSurfaceRef> io_surfaces_[2]; | |
| 45 int current_index_; | |
| 46 | |
| 47 // The previous frame's damage rectangle. Used to copy unchanged content | |
| 48 // between buffers in CopyPreviousBufferDamage. | |
| 49 gfx::Rect previous_buffer_damage_rect_; | |
|
tapted
2015/10/26 02:51:41
Could this be an SkRegion? might avoid a few conve
ccameron
2015/10/26 06:40:33
Yes, that simplifies things -- I've changed it (an
| |
| 50 | |
| 51 // The SkCanvas wrapps the mapped current IOSurface. It is valid only between | |
| 52 // BeginPaint and EndPaint. | |
| 53 skia::RefPtr<SkCanvas> canvas_; | |
| 29 | 54 |
| 30 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceMac); | 55 DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceMac); |
| 31 }; | 56 }; |
| 32 | 57 |
| 33 } // namespace content | 58 } // namespace content |
| 34 | 59 |
| 35 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ | 60 #endif // CONTENT_BROWSER_COMPOSITOR_SOFTWARE_OUTPUT_DEVICE_MAC_H_ |
| OLD | NEW |