OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 SkBitmap Clipboard::ReadImage(Buffer buffer) const { | 382 SkBitmap Clipboard::ReadImage(Buffer buffer) const { |
383 ScopedGObject<GdkPixbuf>::Type pixbuf( | 383 ScopedGObject<GdkPixbuf>::Type pixbuf( |
384 gtk_clipboard_wait_for_image(clipboard_)); | 384 gtk_clipboard_wait_for_image(clipboard_)); |
385 if (!pixbuf.get()) | 385 if (!pixbuf.get()) |
386 return SkBitmap(); | 386 return SkBitmap(); |
387 | 387 |
388 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()), | 388 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()), |
389 gdk_pixbuf_get_height(pixbuf.get()), | 389 gdk_pixbuf_get_height(pixbuf.get()), |
390 false); | 390 false); |
391 cairo_t* context = canvas.beginPlatformPaint(); | 391 skia::ScopedPlatformPaint scoped_platform_paint(&canvas); |
| 392 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); |
392 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); | 393 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); |
393 cairo_paint(context); | 394 cairo_paint(context); |
394 canvas.endPlatformPaint(); | |
395 return canvas.ExtractBitmap(); | 395 return canvas.ExtractBitmap(); |
396 } | 396 } |
397 | 397 |
398 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 398 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
399 // TODO(estade): implement this. | 399 // TODO(estade): implement this. |
400 NOTIMPLEMENTED(); | 400 NOTIMPLEMENTED(); |
401 } | 401 } |
402 | 402 |
403 void Clipboard::ReadData(const std::string& format, std::string* result) { | 403 void Clipboard::ReadData(const std::string& format, std::string* result) { |
404 GtkSelectionData* data = | 404 GtkSelectionData* data = |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return clipboard_; | 447 return clipboard_; |
448 case BUFFER_SELECTION: | 448 case BUFFER_SELECTION: |
449 return primary_selection_; | 449 return primary_selection_; |
450 default: | 450 default: |
451 NOTREACHED(); | 451 NOTREACHED(); |
452 return NULL; | 452 return NULL; |
453 } | 453 } |
454 } | 454 } |
455 | 455 |
456 } // namespace ui | 456 } // namespace ui |
OLD | NEW |