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

Side by Side Diff: ui/gfx/image.cc

Issue 6879013: skia::PlatformCanvas is being deprecated. Going forward we will use gfx::Canvas wherever we need ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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/canvas_skia_win.cc ('k') | ui/ui_gfx.gypi » ('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) 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/gfx/image.h" 5 #include "ui/gfx/image.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
(...skipping 13 matching lines...) Expand all
24 namespace internal { 24 namespace internal {
25 25
26 #if defined(OS_MACOSX) 26 #if defined(OS_MACOSX)
27 // This is a wrapper around gfx::NSImageToSkBitmap() because this cross-platform 27 // This is a wrapper around gfx::NSImageToSkBitmap() because this cross-platform
28 // file cannot include the [square brackets] of ObjC. 28 // file cannot include the [square brackets] of ObjC.
29 const SkBitmap* NSImageToSkBitmap(NSImage* image); 29 const SkBitmap* NSImageToSkBitmap(NSImage* image);
30 #endif 30 #endif
31 31
32 #if defined(OS_LINUX) 32 #if defined(OS_LINUX)
33 const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) { 33 const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) {
34 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf), 34 gfx::CanvasSkia canvas;
35 gdk_pixbuf_get_height(pixbuf), 35 canvas.Init(gdk_pixbuf_get_width(pixbuf),
36 /*is_opaque=*/false); 36 gdk_pixbuf_get_height(pixbuf),
37 false); // is_opaque
37 canvas.DrawGdkPixbuf(pixbuf, 0, 0); 38 canvas.DrawGdkPixbuf(pixbuf, 0, 0);
38 return new SkBitmap(canvas.ExtractBitmap()); 39 return new SkBitmap(canvas.ExtractBitmap());
39 } 40 }
40 #endif 41 #endif
41 42
42 class SkBitmapRep; 43 class SkBitmapRep;
43 class GdkPixbufRep; 44 class GdkPixbufRep;
44 class NSImageRep; 45 class NSImageRep;
45 46
46 // An ImageRep is the object that holds the backing memory for an Image. Each 47 // An ImageRep is the object that holds the backing memory for an Image. Each
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 279
279 // Something went seriously wrong... 280 // Something went seriously wrong...
280 return NULL; 281 return NULL;
281 } 282 }
282 283
283 void Image::AddRepresentation(internal::ImageRep* rep) { 284 void Image::AddRepresentation(internal::ImageRep* rep) {
284 representations_.insert(std::make_pair(rep->type(), rep)); 285 representations_.insert(std::make_pair(rep->type(), rep));
285 } 286 }
286 287
287 } // namespace gfx 288 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas_skia_win.cc ('k') | ui/ui_gfx.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698