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

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

Issue 10799014: Add support for PNG representation in gfx::Image (Closed) Base URL: http://git.chromium.org/chromium/src.git@bookmark-sync
Patch Set: Created 8 years, 4 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
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 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/gfx/image/image_unittest_util.h" 10 #include "ui/gfx/image/image_unittest_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 PlatformImage ToPlatformType(const gfx::Image& image) { 106 PlatformImage ToPlatformType(const gfx::Image& image) {
107 #if defined(OS_MACOSX) 107 #if defined(OS_MACOSX)
108 return image.ToNSImage(); 108 return image.ToNSImage();
109 #elif defined(TOOLKIT_GTK) 109 #elif defined(TOOLKIT_GTK)
110 return image.ToGdkPixbuf(); 110 return image.ToGdkPixbuf();
111 #else 111 #else
112 return *image.ToSkBitmap(); 112 return *image.ToSkBitmap();
113 #endif 113 #endif
114 } 114 }
115 115
116 PlatformImage CopyPlatformType(const gfx::Image& image) {
117 #if defined(OS_MACOSX)
118 return image.CopyNSImage();
119 #elif defined(TOOLKIT_GTK)
120 return image.CopyGdkPixbuf();
121 #else
122 return *image.ToSkBitmap();
123 #endif
124 }
125
116 bool IsPlatformImageValid(PlatformImage image) { 126 bool IsPlatformImageValid(PlatformImage image) {
117 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK) 127 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
118 return image != NULL; 128 return image != NULL;
119 #else 129 #else
120 return !image.isNull(); 130 return !image.isNull();
121 #endif 131 #endif
122 } 132 }
123 133
124 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) { 134 bool PlatformImagesEqual(PlatformImage image1, PlatformImage image2) {
125 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK) 135 #if defined(OS_MACOSX) || defined(TOOLKIT_GTK)
126 return image1 == image2; 136 return image1 == image2;
127 #else 137 #else
128 return image1.getPixels() == image2.getPixels(); 138 return image1.getPixels() == image2.getPixels();
129 #endif 139 #endif
130 } 140 }
131 141
132 } // namespace test 142 } // namespace test
133 } // namespace gfx 143 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698