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

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

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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) 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 384 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
385 ScopedGObject<GdkPixbuf>::Type pixbuf( 385 ScopedGObject<GdkPixbuf>::Type pixbuf(
386 gtk_clipboard_wait_for_image(clipboard_)); 386 gtk_clipboard_wait_for_image(clipboard_));
387 if (!pixbuf.get()) 387 if (!pixbuf.get())
388 return SkBitmap(); 388 return SkBitmap();
389 389
390 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()), 390 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()),
391 gdk_pixbuf_get_height(pixbuf.get()), 391 gdk_pixbuf_get_height(pixbuf.get()),
392 false); 392 false);
393 { 393 {
394 skia::ScopedPlatformPaint scoped_platform_paint(&canvas); 394 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
395 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); 395 cairo_t* context = scoped_platform_paint.GetPlatformSurface();
396 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); 396 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0);
397 cairo_paint(context); 397 cairo_paint(context);
398 } 398 }
399 return canvas.ExtractBitmap(); 399 return canvas.ExtractBitmap();
400 } 400 }
401 401
402 void Clipboard::ReadBookmark(string16* title, std::string* url) const { 402 void Clipboard::ReadBookmark(string16* title, std::string* url) const {
403 // TODO(estade): implement this. 403 // TODO(estade): implement this.
404 NOTIMPLEMENTED(); 404 NOTIMPLEMENTED();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 return clipboard_; 458 return clipboard_;
459 case BUFFER_SELECTION: 459 case BUFFER_SELECTION:
460 return primary_selection_; 460 return primary_selection_;
461 default: 461 default:
462 NOTREACHED(); 462 NOTREACHED();
463 return NULL; 463 return NULL;
464 } 464 }
465 } 465 }
466 466
467 } // namespace ui 467 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window_unittest.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698