OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <QuartzCore/QuartzCore.h> | 5 #include <QuartzCore/QuartzCore.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 7 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
8 | 8 |
9 #include "app/app_switches.h" | 9 #include "app/app_switches.h" |
10 #include "app/surface/io_surface_support_mac.h" | 10 #include "app/surface/io_surface_support_mac.h" |
11 #import "base/chrome_application_mac.h" | 11 #import "base/chrome_application_mac.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/mac/scoped_cftyperef.h" |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #import "base/scoped_nsautorelease_pool.h" | 16 #import "base/scoped_nsautorelease_pool.h" |
16 #import "base/scoped_nsobject.h" | 17 #import "base/scoped_nsobject.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
19 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
20 #include "chrome/browser/browser_thread.h" | 21 #include "chrome/browser/browser_thread.h" |
21 #include "chrome/browser/browser_trial.h" | 22 #include "chrome/browser/browser_trial.h" |
22 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" | 23 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" |
23 #import "chrome/browser/cocoa/view_id_util.h" | 24 #import "chrome/browser/cocoa/view_id_util.h" |
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 | 1678 |
1678 // TODO: add clipping to dirtyRect if it improves drawing performance. | 1679 // TODO: add clipping to dirtyRect if it improves drawing performance. |
1679 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset), | 1680 CGContextDrawLayerAtPoint(context, CGPointMake(0.0, yOffset), |
1680 backingStore->cg_layer()); | 1681 backingStore->cg_layer()); |
1681 } else { | 1682 } else { |
1682 // if we haven't created a layer yet, draw the cached bitmap into | 1683 // if we haven't created a layer yet, draw the cached bitmap into |
1683 // the window. The CGLayer will be created the next time the renderer | 1684 // the window. The CGLayer will be created the next time the renderer |
1684 // paints. | 1685 // paints. |
1685 CGContextRef context = static_cast<CGContextRef>( | 1686 CGContextRef context = static_cast<CGContextRef>( |
1686 [[NSGraphicsContext currentContext] graphicsPort]); | 1687 [[NSGraphicsContext currentContext] graphicsPort]); |
1687 scoped_cftyperef<CGImageRef> image( | 1688 base::mac::ScopedCFTypeRef<CGImageRef> image( |
1688 CGBitmapContextCreateImage(backingStore->cg_bitmap())); | 1689 CGBitmapContextCreateImage(backingStore->cg_bitmap())); |
1689 CGRect imageRect = bitmapRect.ToCGRect(); | 1690 CGRect imageRect = bitmapRect.ToCGRect(); |
1690 imageRect.origin.y = yOffset; | 1691 imageRect.origin.y = yOffset; |
1691 CGContextDrawImage(context, imageRect, image); | 1692 CGContextDrawImage(context, imageRect, image); |
1692 } | 1693 } |
1693 } | 1694 } |
1694 | 1695 |
1695 // Fill the remaining portion of the damagedRect with white | 1696 // Fill the remaining portion of the damagedRect with white |
1696 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect]; | 1697 [self fillBottomRightRemainderOfRect:bitmapRect dirtyRect:damagedRect]; |
1697 | 1698 |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2594 if (!string) return NO; | 2595 if (!string) return NO; |
2595 | 2596 |
2596 // If the user is currently using an IME, confirm the IME input, | 2597 // If the user is currently using an IME, confirm the IME input, |
2597 // and then insert the text from the service, the same as TextEdit and Safari. | 2598 // and then insert the text from the service, the same as TextEdit and Safari. |
2598 [self confirmComposition]; | 2599 [self confirmComposition]; |
2599 [self insertText:string]; | 2600 [self insertText:string]; |
2600 return YES; | 2601 return YES; |
2601 } | 2602 } |
2602 | 2603 |
2603 @end | 2604 @end |
OLD | NEW |