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

Side by Side Diff: trunk/src/ui/gfx/image/image_unittest_util.h

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | « trunk/src/ui/gfx/image/image_unittest.cc ('k') | trunk/src/ui/gfx/image/image_unittest_util.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 // Because the unit tests for gfx::Image are spread across multiple 5 // Because the unit tests for gfx::Image are spread across multiple
6 // implementation files, this header contains the reusable components. 6 // implementation files, this header contains the reusable components.
7 7
8 #ifndef UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ 8 #ifndef UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
9 #define UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ 9 #define UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
10 10
11 #include "ui/base/layout.h"
11 #include "ui/gfx/image/image.h" 12 #include "ui/gfx/image/image.h"
12 #include "third_party/skia/include/core/SkColor.h" 13 #include "third_party/skia/include/core/SkColor.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 namespace test { 16 namespace test {
16 17
17 #if defined(OS_IOS) 18 #if defined(OS_IOS)
18 typedef UIImage* PlatformImage; 19 typedef UIImage* PlatformImage;
19 #elif defined(OS_MACOSX) 20 #elif defined(OS_MACOSX)
20 typedef NSImage* PlatformImage; 21 typedef NSImage* PlatformImage;
21 #elif defined(TOOLKIT_GTK) 22 #elif defined(TOOLKIT_GTK)
22 typedef GdkPixbuf* PlatformImage; 23 typedef GdkPixbuf* PlatformImage;
23 #else 24 #else
24 typedef gfx::ImageSkia PlatformImage; 25 typedef gfx::ImageSkia PlatformImage;
25 #endif 26 #endif
26 27
27 std::vector<float> Get1xAnd2xScales(); 28 std::vector<ui::ScaleFactor> Get1xAnd2xScaleFactors();
28 29
29 // Create a bitmap of |width|x|height|. 30 // Create a bitmap of |width|x|height|.
30 const SkBitmap CreateBitmap(int width, int height); 31 const SkBitmap CreateBitmap(int width, int height);
31 32
32 // Creates an ImageSkia of |width|x|height| DIP with bitmap data for an 33 // Creates an ImageSkia of |width|x|height| DIP with bitmap data for an
33 // arbitrary scale factor. 34 // arbitrary scale factor.
34 gfx::ImageSkia CreateImageSkia(int width, int height); 35 gfx::ImageSkia CreateImageSkia(int width, int height);
35 36
36 // Returns PNG encoded bytes for a bitmap of |edge_size|x|edge_size|. 37 // Returns PNG encoded bytes for a bitmap of |edge_size|x|edge_size|.
37 scoped_refptr<base::RefCountedMemory> CreatePNGBytes(int edge_size); 38 scoped_refptr<base::RefCountedMemory> CreatePNGBytes(int edge_size);
(...skipping 19 matching lines...) Expand all
57 // described by |width|, |height|, and |scale_factors|. 58 // described by |width|, |height|, and |scale_factors|.
58 // The structure matches if: 59 // The structure matches if:
59 // - |image_skia| is non null. 60 // - |image_skia| is non null.
60 // - |image_skia| has ImageSkiaReps of |scale_factors|. 61 // - |image_skia| has ImageSkiaReps of |scale_factors|.
61 // - Each of the ImageSkiaReps has a pixel size of |image_skia|.size() * 62 // - Each of the ImageSkiaReps has a pixel size of |image_skia|.size() *
62 // scale_factor. 63 // scale_factor.
63 bool ImageSkiaStructureMatches( 64 bool ImageSkiaStructureMatches(
64 const gfx::ImageSkia& image_skia, 65 const gfx::ImageSkia& image_skia,
65 int width, 66 int width,
66 int height, 67 int height,
67 const std::vector<float>& scale_factors); 68 const std::vector<ui::ScaleFactor>& scale_factors);
68 69
69 bool IsEmpty(const gfx::Image& image); 70 bool IsEmpty(const gfx::Image& image);
70 71
71 PlatformImage CreatePlatformImage(); 72 PlatformImage CreatePlatformImage();
72 73
73 gfx::Image::RepresentationType GetPlatformRepresentationType(); 74 gfx::Image::RepresentationType GetPlatformRepresentationType();
74 75
75 PlatformImage ToPlatformType(const gfx::Image& image); 76 PlatformImage ToPlatformType(const gfx::Image& image);
76 PlatformImage CopyPlatformType(const gfx::Image& image); 77 PlatformImage CopyPlatformType(const gfx::Image& image);
77 78
78 SkColor GetPlatformImageColor(PlatformImage image, int x, int y); 79 SkColor GetPlatformImageColor(PlatformImage image, int x, int y);
79 void CheckColors(SkColor color1, SkColor color2); 80 void CheckColors(SkColor color1, SkColor color2);
80 void CheckIsTransparent(SkColor color); 81 void CheckIsTransparent(SkColor color);
81 82
82 bool IsPlatformImageValid(PlatformImage image); 83 bool IsPlatformImageValid(PlatformImage image);
83 84
84 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2); 85 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2);
85 86
86 } // namespace test 87 } // namespace test
87 } // namespace gfx 88 } // namespace gfx
88 89
89 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_ 90 #endif // UI_GFX_IMAGE_IMAGE_UNITTEST_UTIL_H_
OLDNEW
« no previous file with comments | « trunk/src/ui/gfx/image/image_unittest.cc ('k') | trunk/src/ui/gfx/image/image_unittest_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698