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

Side by Side Diff: ui/gfx/image/image.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
« 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)), 35 gdk_pixbuf_get_height(pixbuf)), false);
36 ui::SCALE_FACTOR_100P,
37 false);
38 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas()); 36 skia::ScopedPlatformPaint scoped_platform_paint(canvas.sk_canvas());
39 cairo_t* cr = scoped_platform_paint.GetPlatformSurface(); 37 cairo_t* cr = scoped_platform_paint.GetPlatformSurface();
40 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0); 38 gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
41 cairo_paint(cr); 39 cairo_paint(cr);
42 return ImageSkia(canvas.ExtractImageRep()); 40 return ImageSkia(SkBitmap(canvas.ExtractBitmap()));
43 } 41 }
44 #endif 42 #endif
45 43
46 class ImageRepSkia; 44 class ImageRepSkia;
47 class ImageRepGdk; 45 class ImageRepGdk;
48 class ImageRepCairo; 46 class ImageRepCairo;
49 class ImageRepCocoa; 47 class ImageRepCocoa;
50 48
51 // An ImageRep is the object that holds the backing memory for an Image. Each 49 // An ImageRep is the object that holds the backing memory for an Image. Each
52 // RepresentationType has an ImageRep subclass that is responsible for freeing 50 // RepresentationType has an ImageRep subclass that is responsible for freeing
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 403 }
406 return it->second; 404 return it->second;
407 } 405 }
408 406
409 void Image::AddRepresentation(internal::ImageRep* rep) const { 407 void Image::AddRepresentation(internal::ImageRep* rep) const {
410 CHECK(storage_.get()); 408 CHECK(storage_.get());
411 storage_->representations().insert(std::make_pair(rep->type(), rep)); 409 storage_->representations().insert(std::make_pair(rep->type(), rep));
412 } 410 }
413 411
414 } // namespace gfx 412 } // 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