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

Side by Side Diff: ui/base/clipboard/clipboard_gtk.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear 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 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <X11/extensions/Xfixes.h> 8 #include <X11/extensions/Xfixes.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/base/clipboard/custom_data_helper.h" 21 #include "ui/base/clipboard/custom_data_helper.h"
22 #include "ui/base/gtk/gtk_signal.h" 22 #include "ui/base/gtk/gtk_signal.h"
23 #include "ui/base/layout.h"
23 #include "ui/base/x/x11_util.h" 24 #include "ui/base/x/x11_util.h"
24 #include "ui/gfx/canvas.h" 25 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/gtk_util.h" 26 #include "ui/gfx/gtk_util.h"
26 #include "ui/gfx/scoped_gobject.h" 27 #include "ui/gfx/scoped_gobject.h"
27 #include "ui/gfx/size.h" 28 #include "ui/gfx/size.h"
28 29
29 namespace ui { 30 namespace ui {
30 31
31 namespace { 32 namespace {
32 33
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 535
535 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 536 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
536 DCHECK(CalledOnValidThread()); 537 DCHECK(CalledOnValidThread());
537 ScopedGObject<GdkPixbuf>::Type pixbuf( 538 ScopedGObject<GdkPixbuf>::Type pixbuf(
538 gtk_clipboard_wait_for_image(clipboard_)); 539 gtk_clipboard_wait_for_image(clipboard_));
539 if (!pixbuf.get()) 540 if (!pixbuf.get())
540 return SkBitmap(); 541 return SkBitmap();
541 542
542 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()), 543 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()),
543 gdk_pixbuf_get_height(pixbuf.get())), 544 gdk_pixbuf_get_height(pixbuf.get())),
544 ui::SCALE_FACTOR_100P, 545 1.0f, false);
545 false);
546 { 546 {
547 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 547 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
548 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); 548 cairo_t* context = scoped_platform_paint.GetPlatformSurface();
549 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); 549 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0);
550 cairo_paint(context); 550 cairo_paint(context);
551 } 551 }
552 return canvas.ExtractImageRep().sk_bitmap(); 552 return canvas.ExtractImageRep().sk_bitmap();
553 } 553 }
554 554
555 void Clipboard::ReadCustomData(Buffer buffer, 555 void Clipboard::ReadCustomData(Buffer buffer,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return clipboard_; 673 return clipboard_;
674 case BUFFER_SELECTION: 674 case BUFFER_SELECTION:
675 return primary_selection_; 675 return primary_selection_;
676 default: 676 default:
677 NOTREACHED(); 677 NOTREACHED();
678 return NULL; 678 return NULL;
679 } 679 }
680 } 680 }
681 681
682 } // namespace ui 682 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698