| Index: content/common/gpu/image_transport_surface_overlay_mac.mm
|
| diff --git a/content/common/gpu/image_transport_surface_overlay_mac.mm b/content/common/gpu/image_transport_surface_overlay_mac.mm
|
| index 1a18d0b717594da0fb51796777f085c514a35e62..de7643fcd9f72f37162c077e6d7f637abf839a21 100644
|
| --- a/content/common/gpu/image_transport_surface_overlay_mac.mm
|
| +++ b/content/common/gpu/image_transport_surface_overlay_mac.mm
|
| @@ -97,6 +97,15 @@ class ImageTransportSurfaceOverlayMac::OverlayPlane {
|
| dip_frame_rect(dip_frame_rect),
|
| contents_rect(contents_rect),
|
| layer_needs_update(true) {}
|
| +
|
| + OverlayPlane(int z_order,
|
| + const gfx::RectF& dip_frame_rect,
|
| + float red, float green, float blue, float alpha)
|
| + : z_order(z_order),
|
| + solid_color(CGColorCreateGenericRGB(red, green, blue, alpha)),
|
| + dip_frame_rect(dip_frame_rect),
|
| + layer_needs_update(true) {}
|
| +
|
| ~OverlayPlane() { DCHECK(!ca_layer); }
|
|
|
| const int z_order;
|
| @@ -104,6 +113,7 @@ class ImageTransportSurfaceOverlayMac::OverlayPlane {
|
|
|
| // The IOSurface to set the CALayer's contents to.
|
| const base::ScopedCFTypeRef<IOSurfaceRef> io_surface;
|
| + base::ScopedCFTypeRef<CGColorRef> solid_color;
|
| const gfx::RectF dip_frame_rect;
|
| const gfx::RectF contents_rect;
|
|
|
| @@ -123,11 +133,16 @@ class ImageTransportSurfaceOverlayMac::OverlayPlane {
|
| [ca_layer setOpaque:YES];
|
| [ca_layer setFrame:dip_frame_rect.ToCGRect()];
|
| [ca_layer setContentsRect:contents_rect.ToCGRect()];
|
| - id new_contents = static_cast<id>(io_surface.get());
|
| - if ([ca_layer contents] == new_contents && z_order == 0) {
|
| - [ca_layer setContentsChanged];
|
| - } else {
|
| - [ca_layer setContents:new_contents];
|
| + if (io_surface.get()) {
|
| + id new_contents = static_cast<id>(io_surface.get());
|
| + if ([ca_layer contents] == new_contents && z_order == 0) {
|
| + [ca_layer setContentsChanged];
|
| + } else {
|
| + [ca_layer setContents:new_contents];
|
| + }
|
| + }
|
| + if (solid_color.get()) {
|
| + [ca_layer setBackgroundColor:solid_color];
|
| }
|
| }
|
| static bool show_borders =
|
| @@ -645,6 +660,21 @@ bool ImageTransportSurfaceOverlayMac::ScheduleOverlayPlane(
|
| return true;
|
| }
|
|
|
| +bool ImageTransportSurfaceOverlayMac::ScheduleSolidColorOverlayPlane(
|
| + int z_order,
|
| + const gfx::Rect& bounds_rect,
|
| + float red,
|
| + float green,
|
| + float blue,
|
| + float alpha) {
|
| + linked_ptr<OverlayPlane> plane(
|
| + new OverlayPlane(z_order,
|
| + ConvertRectToDIPF(scale_factor_, bounds_rect),
|
| + red, green, blue, alpha));
|
| + pending_overlay_planes_.push_back(plane);
|
| + return true;
|
| +}
|
| +
|
| bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const {
|
| return true;
|
| }
|
|
|