| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/backing_store_mac.h" | 7 #include "content/browser/renderer_host/backing_store_mac.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // The layer hasn't been created yet, so draw into the cache bitmap. | 102 // The layer hasn't been created yet, so draw into the cache bitmap. |
| 103 gfx::Rect paint_rect = copy_rect; | 103 gfx::Rect paint_rect = copy_rect; |
| 104 paint_rect.set_y(size().height() - copy_rect.bottom()); | 104 paint_rect.set_y(size().height() - copy_rect.bottom()); |
| 105 CGContextDrawImage(cg_bitmap_, paint_rect.ToCGRect(), image); | 105 CGContextDrawImage(cg_bitmap_, paint_rect.ToCGRect(), image); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool BackingStoreMac::CopyFromBackingStore(const gfx::Rect& rect, | 110 bool BackingStoreMac::CopyFromBackingStore(const gfx::Rect& rect, |
| 111 skia::PlatformCanvas* output) { | 111 skia::PlatformCanvas* output) { |
| 112 if (!output->initialize(rect.width(), rect.height(), true)) | 112 if (!output->initialize(rect.width(), rect.height(), |
| 113 skia::PlatformDevice::FLAGS_OPAQUE)) |
| 113 return false; | 114 return false; |
| 114 | 115 |
| 115 skia::ScopedPlatformPaint scoped_platform_paint(output); | 116 skia::ScopedPlatformPaint scoped_platform_paint(output); |
| 116 CGContextRef temp_context = scoped_platform_paint.GetPlatformSurface(); | 117 CGContextRef temp_context = scoped_platform_paint.GetPlatformSurface(); |
| 117 CGContextSaveGState(temp_context); | 118 CGContextSaveGState(temp_context); |
| 118 CGContextTranslateCTM(temp_context, 0.0, size().height()); | 119 CGContextTranslateCTM(temp_context, 0.0, size().height()); |
| 119 CGContextScaleCTM(temp_context, 1.0, -1.0); | 120 CGContextScaleCTM(temp_context, 1.0, -1.0); |
| 120 CGContextDrawLayerAtPoint(temp_context, CGPointMake(rect.x(), rect.y()), | 121 CGContextDrawLayerAtPoint(temp_context, CGPointMake(rect.x(), rect.y()), |
| 121 cg_layer()); | 122 cg_layer()); |
| 122 CGContextRestoreGState(temp_context); | 123 CGContextRestoreGState(temp_context); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 CGContextRef context = CGBitmapContextCreate(NULL, | 224 CGContextRef context = CGBitmapContextCreate(NULL, |
| 224 size().width(), size().height(), | 225 size().width(), size().height(), |
| 225 8, size().width() * 4, | 226 8, size().width() * 4, |
| 226 base::mac::GetSystemColorSpace(), | 227 base::mac::GetSystemColorSpace(), |
| 227 kCGImageAlphaPremultipliedFirst | | 228 kCGImageAlphaPremultipliedFirst | |
| 228 kCGBitmapByteOrder32Host); | 229 kCGBitmapByteOrder32Host); |
| 229 DCHECK(context); | 230 DCHECK(context); |
| 230 | 231 |
| 231 return context; | 232 return context; |
| 232 } | 233 } |
| OLD | NEW |