| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_skia_util_ios.h" | 5 #include "ui/gfx/image/image_skia_util_ios.h" |
| 6 | 6 |
| 7 #include <UIKit/UIKit.h> | 7 #include <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 UIImage* UIImageFromImageSkia(const gfx::ImageSkia& image_skia) { | 42 UIImage* UIImageFromImageSkia(const gfx::ImageSkia& image_skia) { |
| 43 return UIImageFromImageSkiaRep(image_skia.GetRepresentation( | 43 return UIImageFromImageSkiaRep(image_skia.GetRepresentation( |
| 44 ui::GetMaxScaleFactor())); | 44 ui::GetMaxScaleFactor())); |
| 45 } | 45 } |
| 46 | 46 |
| 47 UIImage* UIImageFromImageSkiaRep(const gfx::ImageSkiaRep& image_skia_rep) { | 47 UIImage* UIImageFromImageSkiaRep(const gfx::ImageSkiaRep& image_skia_rep) { |
| 48 if (image_skia_rep.is_null()) | 48 if (image_skia_rep.is_null()) |
| 49 return nil; | 49 return nil; |
| 50 | 50 |
| 51 float scale = ui::GetScaleFactorScale(image_skia_rep.scale_factor()); | 51 float scale = ui::GetScaleFactorScale(image_skia_rep.scale_factor()); |
| 52 base::mac::ScopedCFTypeRef<CGColorSpaceRef> color_space( | 52 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
| 53 CGColorSpaceCreateDeviceRGB()); | 53 CGColorSpaceCreateDeviceRGB()); |
| 54 return gfx::SkBitmapToUIImageWithColorSpace(image_skia_rep.sk_bitmap(), scale, | 54 return gfx::SkBitmapToUIImageWithColorSpace(image_skia_rep.sk_bitmap(), scale, |
| 55 color_space); | 55 color_space); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace gfx | 58 } // namespace gfx |
| OLD | NEW |