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

Side by Side Diff: ui/gfx/image/image.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, 4 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
« no previous file with comments | « ui/gfx/image/canvas_image_source.cc ('k') | ui/views/controls/glow_hover_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gfx/image/image.h" 5 #include "ui/gfx/image/image.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 14 matching lines...) Expand all
25 #endif 25 #endif
26 26
27 namespace gfx { 27 namespace gfx {
28 28
29 namespace internal { 29 namespace internal {
30 30
31 #if defined(TOOLKIT_GTK) 31 #if defined(TOOLKIT_GTK)
32 const ImageSkia ImageSkiaFromGdkPixbuf(GdkPixbuf* pixbuf) { 32 const ImageSkia ImageSkiaFromGdkPixbuf(GdkPixbuf* pixbuf) {
33 CHECK(pixbuf); 33 CHECK(pixbuf);
34 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf), 34 gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf),
35 gdk_pixbuf_get_height(pixbuf)), false); 35 gdk_pixbuf_get_height(pixbuf)),
36 ui::SCALE_FACTOR_100P,
37 false);
36 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 38 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
37 cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); 39 cairo_t* cr = scoped_platform_paint.GetPlatformSurface();
38 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); 40 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
39 cairo_paint(cr); 41 cairo_paint(cr);
40 return ImageSkia(SkBitmap(canvas.ExtractBitmap())); 42 return ImageSkia(canvas.ExtractImageRep());
41 } 43 }
42 #endif 44 #endif
43 45
44 class ImageRepSkia; 46 class ImageRepSkia;
45 class ImageRepGdk; 47 class ImageRepGdk;
46 class ImageRepCairo; 48 class ImageRepCairo;
47 class ImageRepCocoa; 49 class ImageRepCocoa;
48 50
49 // An ImageRep is the object that holds the backing memory for an Image. Each 51 // An ImageRep is the object that holds the backing memory for an Image. Each
50 // RepresentationType has an ImageRep subclass that is responsible for freeing 52 // RepresentationType has an ImageRep subclass that is responsible for freeing
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 405 }
404 return it->second; 406 return it->second;
405 } 407 }
406 408
407 void Image::AddRepresentation(internal::ImageRep* rep) const { 409 void Image::AddRepresentation(internal::ImageRep* rep) const {
408 CHECK(storage_.get()); 410 CHECK(storage_.get());
409 storage_->representations().insert(std::make_pair(rep->type(), rep)); 411 storage_->representations().insert(std::make_pair(rep->type(), rep));
410 } 412 }
411 413
412 } // namespace gfx 414 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/canvas_image_source.cc ('k') | ui/views/controls/glow_hover_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698