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

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

Issue 10790128: Revert 147915 - 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())), 567 gdk_pixbuf_get_height(pixbuf.get())), false);
568 ui::SCALE_FACTOR_100P,
569 false);
570 { 568 {
571 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 569 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
572 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); 570 cairo_t* context = scoped_platform_paint.GetPlatformSurface();
573 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); 571 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0);
574 cairo_paint(context); 572 cairo_paint(context);
575 } 573 }
576 return canvas.ExtractImageRep().sk_bitmap(); 574 return canvas.ExtractBitmap();
577 } 575 }
578 576
579 void Clipboard::ReadCustomData(Buffer buffer, 577 void Clipboard::ReadCustomData(Buffer buffer,
580 const string16& type, 578 const string16& type,
581 string16* result) const { 579 string16* result) const {
582 DCHECK(CalledOnValidThread()); 580 DCHECK(CalledOnValidThread());
583 GtkClipboard* clipboard = LookupBackingClipboard(buffer); 581 GtkClipboard* clipboard = LookupBackingClipboard(buffer);
584 if (!clipboard) 582 if (!clipboard)
585 return; 583 return;
586 584
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 return clipboard_; 688 return clipboard_;
691 case BUFFER_SELECTION: 689 case BUFFER_SELECTION:
692 return primary_selection_; 690 return primary_selection_;
693 default: 691 default:
694 NOTREACHED(); 692 NOTREACHED();
695 return NULL; 693 return NULL;
696 } 694 }
697 } 695 }
698 696
699 } // namespace ui 697 } // 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