| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include <QuartzCore/QuartzCore.h> | 7 #include <QuartzCore/QuartzCore.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2616 if (!paintRect.IsEmpty()) { | 2616 if (!paintRect.IsEmpty()) { |
| 2617 // if we have a CGLayer, draw that into the window | 2617 // if we have a CGLayer, draw that into the window |
| 2618 if (backingStore->cg_layer()) { | 2618 if (backingStore->cg_layer()) { |
| 2619 // TODO: add clipping to dirtyRect if it improves drawing performance. | 2619 // TODO: add clipping to dirtyRect if it improves drawing performance. |
| 2620 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset), | 2620 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset), |
| 2621 backingStore->cg_layer()); | 2621 backingStore->cg_layer()); |
| 2622 } else { | 2622 } else { |
| 2623 // if we haven't created a layer yet, draw the cached bitmap into | 2623 // if we haven't created a layer yet, draw the cached bitmap into |
| 2624 // the window. The CGLayer will be created the next time the renderer | 2624 // the window. The CGLayer will be created the next time the renderer |
| 2625 // paints. | 2625 // paints. |
| 2626 base::mac::ScopedCFTypeRef<CGImageRef> image( | 2626 base::ScopedCFTypeRef<CGImageRef> image( |
| 2627 CGBitmapContextCreateImage(backingStore->cg_bitmap())); | 2627 CGBitmapContextCreateImage(backingStore->cg_bitmap())); |
| 2628 CGRect imageRect = bitmapRect.ToCGRect(); | 2628 CGRect imageRect = bitmapRect.ToCGRect(); |
| 2629 imageRect.origin.y = yOffset; | 2629 imageRect.origin.y = yOffset; |
| 2630 CGContextDrawImage(context, imageRect, image); | 2630 CGContextDrawImage(context, imageRect, image); |
| 2631 } | 2631 } |
| 2632 } | 2632 } |
| 2633 | 2633 |
| 2634 renderWidgetHostView_->FrameSwapped(); | 2634 renderWidgetHostView_->FrameSwapped(); |
| 2635 | 2635 |
| 2636 // Fill the remaining portion of the damagedRect with white | 2636 // Fill the remaining portion of the damagedRect with white |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3717 return YES; | 3717 return YES; |
| 3718 } | 3718 } |
| 3719 | 3719 |
| 3720 - (BOOL)isOpaque { | 3720 - (BOOL)isOpaque { |
| 3721 if (renderWidgetHostView_->use_core_animation_) | 3721 if (renderWidgetHostView_->use_core_animation_) |
| 3722 return YES; | 3722 return YES; |
| 3723 return [super isOpaque]; | 3723 return [super isOpaque]; |
| 3724 } | 3724 } |
| 3725 | 3725 |
| 3726 @end | 3726 @end |
| OLD | NEW |