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

Side by Side Diff: ui/gfx/image/image_ios.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 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
OLDNEW
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.h" 5 #include "ui/gfx/image/image.h"
6 6
7 #import <UIKit/UIKit.h>
7 #include <cmath> 8 #include <cmath>
8 #include <limits> 9 #include <limits>
9 #import <UIKit/UIKit.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/scoped_cftyperef.h" 12 #include "base/mac/scoped_cftyperef.h"
13 #include "base/memory/scoped_nsobject.h" 13 #include "base/mac/scoped_nsobject.h"
14 #include "ui/base/layout.h" 14 #include "ui/base/layout.h"
15 #include "ui/gfx/image/image_png_rep.h" 15 #include "ui/gfx/image/image_png_rep.h"
16 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
17 #include "ui/gfx/image/image_skia_util_ios.h" 17 #include "ui/gfx/image/image_skia_util_ios.h"
18 #include "ui/gfx/size.h" 18 #include "ui/gfx/size.h"
19 19
20 namespace gfx { 20 namespace gfx {
21 namespace internal { 21 namespace internal {
22 22
23 namespace { 23 namespace {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 UIImage* image = UIImageFromImageSkiaRep(image_skia_rep); 110 UIImage* image = UIImageFromImageSkiaRep(image_skia_rep);
111 return Get1xPNGBytesFromUIImage(image); 111 return Get1xPNGBytesFromUIImage(image);
112 } 112 }
113 113
114 ImageSkia* ImageSkiaFromPNG( 114 ImageSkia* ImageSkiaFromPNG(
115 const std::vector<gfx::ImagePNGRep>& image_png_reps) { 115 const std::vector<gfx::ImagePNGRep>& image_png_reps) {
116 // iOS does not expose libpng, so conversion from PNG to ImageSkia must go 116 // iOS does not expose libpng, so conversion from PNG to ImageSkia must go
117 // through UIImage. 117 // through UIImage.
118 gfx::ImageSkia* image_skia = new gfx::ImageSkia(); 118 gfx::ImageSkia* image_skia = new gfx::ImageSkia();
119 for (size_t i = 0; i < image_png_reps.size(); ++i) { 119 for (size_t i = 0; i < image_png_reps.size(); ++i) {
120 scoped_nsobject<UIImage> uiimage(CreateUIImageFromImagePNGRep( 120 base::scoped_nsobject<UIImage> uiimage(
121 image_png_reps[i])); 121 CreateUIImageFromImagePNGRep(image_png_reps[i]));
122 gfx::ImageSkiaRep image_skia_rep = ImageSkiaRepOfScaleFactorFromUIImage( 122 gfx::ImageSkiaRep image_skia_rep = ImageSkiaRepOfScaleFactorFromUIImage(
123 uiimage, image_png_reps[i].scale_factor); 123 uiimage, image_png_reps[i].scale_factor);
124 if (!image_skia_rep.is_null()) 124 if (!image_skia_rep.is_null())
125 image_skia->AddRepresentation(image_skia_rep); 125 image_skia->AddRepresentation(image_skia_rep);
126 } 126 }
127 return image_skia; 127 return image_skia;
128 } 128 }
129 129
130 gfx::Size UIImageSize(UIImage* image) { 130 gfx::Size UIImageSize(UIImage* image) {
131 int width = static_cast<int>(image.size.width); 131 int width = static_cast<int>(image.size.width);
132 int height = static_cast<int>(image.size.height); 132 int height = static_cast<int>(image.size.height);
133 return gfx::Size(width, height); 133 return gfx::Size(width, height);
134 } 134 }
135 135
136 } // namespace internal 136 } // namespace internal
137 } // namespace gfx 137 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698