Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Side by Side Diff: trunk/src/ui/base/clipboard/clipboard_mac.mm

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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), 1.0f, false); 361 gfx::Canvas canvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P, 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
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
OLDNEW
« no previous file with comments | « trunk/src/ui/base/clipboard/clipboard_gtk.cc ('k') | trunk/src/ui/base/clipboard/clipboard_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698