| 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 "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return [[NSImage alloc] initWithPasteboard:GetPasteboard()]; | 351 return [[NSImage alloc] initWithPasteboard:GetPasteboard()]; |
| 352 })); | 352 })); |
| 353 if (!image.get()) | 353 if (!image.get()) |
| 354 return SkBitmap(); | 354 return SkBitmap(); |
| 355 | 355 |
| 356 gfx::ScopedNSGraphicsContextSaveGState scoped_state; | 356 gfx::ScopedNSGraphicsContextSaveGState scoped_state; |
| 357 [image setFlipped:YES]; | 357 [image setFlipped:YES]; |
| 358 int width = [image size].width; | 358 int width = [image size].width; |
| 359 int height = [image size].height; | 359 int height = [image size].height; |
| 360 | 360 |
| 361 gfx::Canvas canvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P, false); | 361 gfx::Canvas canvas(gfx::Size(width, height), 1.0f, false); |
| 362 { | 362 { |
| 363 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); | 363 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); |
| 364 CGContextRef gc = scoped_platform_paint.GetPlatformSurface(); | 364 CGContextRef gc = scoped_platform_paint.GetPlatformSurface(); |
| 365 NSGraphicsContext* cocoa_gc = | 365 NSGraphicsContext* cocoa_gc = |
| 366 [NSGraphicsContext graphicsContextWithGraphicsPort:gc flipped:NO]; | 366 [NSGraphicsContext graphicsContextWithGraphicsPort:gc flipped:NO]; |
| 367 [NSGraphicsContext setCurrentContext:cocoa_gc]; | 367 [NSGraphicsContext setCurrentContext:cocoa_gc]; |
| 368 [image drawInRect:NSMakeRect(0, 0, width, height) | 368 [image drawInRect:NSMakeRect(0, 0, width, height) |
| 369 fromRect:NSZeroRect | 369 fromRect:NSZeroRect |
| 370 operation:NSCompositeCopy | 370 operation:NSCompositeCopy |
| 371 fraction:1.0]; | 371 fraction:1.0]; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 return type; | 484 return type; |
| 485 } | 485 } |
| 486 | 486 |
| 487 // static | 487 // static |
| 488 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | 488 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
| 489 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kPepperCustomDataPboardType)); | 489 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kPepperCustomDataPboardType)); |
| 490 return type; | 490 return type; |
| 491 } | 491 } |
| 492 | 492 |
| 493 } // namespace ui | 493 } // namespace ui |
| OLD | NEW |