| 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/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/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 #endif | 347 #endif |
| 348 CHECK(rep); | 348 CHECK(rep); |
| 349 AddRepresentation(rep); | 349 AddRepresentation(rep); |
| 350 return rep; | 350 return rep; |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Handle Skia-to-native conversions. | 353 // Handle Skia-to-native conversions. |
| 354 if (default_rep->type() == Image::kImageRepSkia) { | 354 if (default_rep->type() == Image::kImageRepSkia) { |
| 355 internal::ImageRepSkia* skia_rep = default_rep->AsImageRepSkia(); | 355 internal::ImageRepSkia* skia_rep = default_rep->AsImageRepSkia(); |
| 356 internal::ImageRep* native_rep = NULL; | 356 internal::ImageRep* native_rep = NULL; |
| 357 #if defined(TOOLKIT_USES_GTK) | 357 #if defined(USE_AURA) |
| 358 skia_rep = NULL; |
| 359 NOTIMPLEMENTED(); |
| 360 #elif defined(TOOLKIT_USES_GTK) |
| 358 if (rep_type == Image::kImageRepGdk) { | 361 if (rep_type == Image::kImageRepGdk) { |
| 359 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(skia_rep->bitmap()); | 362 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(skia_rep->bitmap()); |
| 360 native_rep = new internal::ImageRepGdk(pixbuf); | 363 native_rep = new internal::ImageRepGdk(pixbuf); |
| 361 } | 364 } |
| 362 #elif defined(OS_MACOSX) | 365 #elif defined(OS_MACOSX) |
| 363 if (rep_type == Image::kImageRepCocoa) { | 366 if (rep_type == Image::kImageRepCocoa) { |
| 364 NSImage* image = gfx::SkBitmapsToNSImage(skia_rep->bitmaps()); | 367 NSImage* image = gfx::SkBitmapsToNSImage(skia_rep->bitmaps()); |
| 365 base::mac::NSObjectRetain(image); | 368 base::mac::NSObjectRetain(image); |
| 366 native_rep = new internal::ImageRepCocoa(image); | 369 native_rep = new internal::ImageRepCocoa(image); |
| 367 } | 370 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 383 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> | 386 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> |
| 384 bitmaps().size(); | 387 bitmaps().size(); |
| 385 } | 388 } |
| 386 | 389 |
| 387 const SkBitmap* Image::GetSkBitmapAtIndex(size_t index) const { | 390 const SkBitmap* Image::GetSkBitmapAtIndex(size_t index) const { |
| 388 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> | 391 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> |
| 389 bitmaps()[index]; | 392 bitmaps()[index]; |
| 390 } | 393 } |
| 391 | 394 |
| 392 } // namespace gfx | 395 } // namespace gfx |
| OLD | NEW |