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

Side by Side Diff: ui/gfx/color_utils.cc

Issue 361643002: setConfig is deprecated, use setInfo or allocPixels instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't call allocPixels+rowbytes yet (skia bug) Created 6 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
« no previous file with comments | « ui/gfx/color_analysis_unittest.cc ('k') | ui/gfx/icon_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 #include "ui/gfx/color_utils.h" 5 #include "ui/gfx/color_utils.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #endif 10 #endif
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 g += (255.0 - g) * ((shift.l - 0.5) * 2.0); 217 g += (255.0 - g) * ((shift.l - 0.5) * 2.0);
218 b += (255.0 - b) * ((shift.l - 0.5) * 2.0); 218 b += (255.0 - b) * ((shift.l - 0.5) * 2.0);
219 } 219 }
220 return SkColorSetARGB(alpha, 220 return SkColorSetARGB(alpha,
221 static_cast<int>(r), 221 static_cast<int>(r),
222 static_cast<int>(g), 222 static_cast<int>(g),
223 static_cast<int>(b)); 223 static_cast<int>(b));
224 } 224 }
225 225
226 void BuildLumaHistogram(const SkBitmap& bitmap, int histogram[256]) { 226 void BuildLumaHistogram(const SkBitmap& bitmap, int histogram[256]) {
227 DCHECK_EQ(kPMColor_SkColorType, bitmap.colorType()); 227 DCHECK_EQ(kN32_SkColorType, bitmap.colorType());
228 228
229 SkAutoLockPixels bitmap_lock(bitmap); 229 SkAutoLockPixels bitmap_lock(bitmap);
230 230
231 int pixel_width = bitmap.width(); 231 int pixel_width = bitmap.width();
232 int pixel_height = bitmap.height(); 232 int pixel_height = bitmap.height();
233 for (int y = 0; y < pixel_height; ++y) { 233 for (int y = 0; y < pixel_height; ++y) {
234 for (int x = 0; x < pixel_width; ++x) 234 for (int x = 0; x < pixel_width; ++x)
235 ++histogram[GetLuminanceForColor(bitmap.getColor(x, y))]; 235 ++histogram[GetLuminanceForColor(bitmap.getColor(x, y))];
236 } 236 }
237 } 237 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 SkColor GetSysSkColor(int which) { 292 SkColor GetSysSkColor(int which) {
293 #if defined(OS_WIN) 293 #if defined(OS_WIN)
294 return skia::COLORREFToSkColor(GetSysColor(which)); 294 return skia::COLORREFToSkColor(GetSysColor(which));
295 #else 295 #else
296 NOTIMPLEMENTED(); 296 NOTIMPLEMENTED();
297 return SK_ColorLTGRAY; 297 return SK_ColorLTGRAY;
298 #endif 298 #endif
299 } 299 }
300 300
301 } // namespace color_utils 301 } // namespace color_utils
OLDNEW
« no previous file with comments | « ui/gfx/color_analysis_unittest.cc ('k') | ui/gfx/icon_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698