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

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

Issue 10701063: Cleanup gfx::Canvas now that 10562027 has landed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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>
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 557 }
558 558
559 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 559 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
560 DCHECK(CalledOnValidThread()); 560 DCHECK(CalledOnValidThread());
561 ScopedGObject<GdkPixbuf>::Type pixbuf( 561 ScopedGObject<GdkPixbuf>::Type pixbuf(
562 gtk_clipboard_wait_for_image(clipboard_)); 562 gtk_clipboard_wait_for_image(clipboard_));
563 if (!pixbuf.get()) 563 if (!pixbuf.get())
564 return SkBitmap(); 564 return SkBitmap();
565 565
566 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()), 566 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf.get()),
567 gdk_pixbuf_get_height(pixbuf.get())), false); 567 gdk_pixbuf_get_height(pixbuf.get())),
568 ui::SCALE_FACTOR_100P,
569 false);
568 { 570 {
569 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 571 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
570 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); 572 cairo_t* context = scoped_platform_paint.GetPlatformSurface();
571 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); 573 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0);
572 cairo_paint(context); 574 cairo_paint(context);
573 } 575 }
574 return canvas.ExtractBitmap(); 576 return canvas.ExtractImageRep().sk_bitmap();
575 } 577 }
576 578
577 void Clipboard::ReadCustomData(Buffer buffer, 579 void Clipboard::ReadCustomData(Buffer buffer,
578 const string16& type, 580 const string16& type,
579 string16* result) const { 581 string16* result) const {
580 DCHECK(CalledOnValidThread()); 582 DCHECK(CalledOnValidThread());
581 GtkClipboard* clipboard = LookupBackingClipboard(buffer); 583 GtkClipboard* clipboard = LookupBackingClipboard(buffer);
582 if (!clipboard) 584 if (!clipboard)
583 return; 585 return;
584 586
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 return clipboard_; 690 return clipboard_;
689 case BUFFER_SELECTION: 691 case BUFFER_SELECTION:
690 return primary_selection_; 692 return primary_selection_;
691 default: 693 default:
692 NOTREACHED(); 694 NOTREACHED();
693 return NULL; 695 return NULL;
694 } 696 }
695 } 697 }
696 698
697 } // namespace ui 699 } // namespace ui
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698