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

Side by Side Diff: skia/ext/image_operations.cc

Issue 2069009: chunk of straightforward ifdef/include changes for BSD port... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 7 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #define _USE_MATH_DEFINES 5 #define _USE_MATH_DEFINES
6 #include <cmath> 6 #include <cmath>
7 #include <limits> 7 #include <limits>
8 8
9 #include "skia/ext/image_operations.h" 9 #include "skia/ext/image_operations.h"
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if (method == ImageOperations::RESIZE_SUBPIXEL) 262 if (method == ImageOperations::RESIZE_SUBPIXEL)
263 return ResizeSubpixel(source, dest_width, dest_height, dest_subset); 263 return ResizeSubpixel(source, dest_width, dest_height, dest_subset);
264 else 264 else
265 return ResizeBasic(source, method, dest_width, dest_height, dest_subset); 265 return ResizeBasic(source, method, dest_width, dest_height, dest_subset);
266 } 266 }
267 267
268 // static 268 // static
269 SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source, 269 SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
270 int dest_width, int dest_height, 270 int dest_width, int dest_height,
271 const SkIRect& dest_subset) { 271 const SkIRect& dest_subset) {
272 // Currently only works on Linux because this is the only platform where 272 // Currently only works on Linux/BSD because this is the only platform where
Evan Martin 2010/05/19 11:50:11 s/this is ...platform/these are ...platforms/ (and
273 // SkFontHost::GetSubpixelOrder is defined. 273 // SkFontHost::GetSubpixelOrder is defined.
274 #if defined(OS_LINUX) 274 #if defined(OS_POSIX) && !defined(OS_MACOSX)
275 // Understand the display. 275 // Understand the display.
276 const SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder(); 276 const SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder();
277 const SkFontHost::LCDOrientation orientation = 277 const SkFontHost::LCDOrientation orientation =
278 SkFontHost::GetSubpixelOrientation(); 278 SkFontHost::GetSubpixelOrientation();
279 279
280 // Decide on which dimension, if any, to deploy subpixel rendering. 280 // Decide on which dimension, if any, to deploy subpixel rendering.
281 int w = 1; 281 int w = 1;
282 int h = 1; 282 int h = 1;
283 switch (orientation) { 283 switch (orientation) {
284 case SkFontHost::kHorizontal_LCDOrientation: 284 case SkFontHost::kHorizontal_LCDOrientation:
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 a = a > b ? a : b; 354 a = a > b ? a : b;
355 *dst = SkPackARGB32(a, r, g, b); 355 *dst = SkPackARGB32(a, r, g, b);
356 } 356 }
357 src_row += h * row_words; 357 src_row += h * row_words;
358 dst_row += result.rowBytes() / 4; 358 dst_row += result.rowBytes() / 4;
359 } 359 }
360 result.setIsOpaque(img.isOpaque()); 360 result.setIsOpaque(img.isOpaque());
361 return result; 361 return result;
362 #else 362 #else
363 return SkBitmap(); 363 return SkBitmap();
364 #endif // OS_LINUX 364 #endif // OS_POSIX && !OS_MACOSX
365 } 365 }
366 366
367 // static 367 // static
368 SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source, 368 SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
369 ResizeMethod method, 369 ResizeMethod method,
370 int dest_width, int dest_height, 370 int dest_width, int dest_height,
371 const SkIRect& dest_subset) { 371 const SkIRect& dest_subset) {
372 // Time how long this takes to see if it's a problem for users. 372 // Time how long this takes to see if it's a problem for users.
373 base::TimeTicks resize_start = base::TimeTicks::Now(); 373 base::TimeTicks resize_start = base::TimeTicks::Now();
374 374
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 // static 414 // static
415 SkBitmap ImageOperations::Resize(const SkBitmap& source, 415 SkBitmap ImageOperations::Resize(const SkBitmap& source,
416 ResizeMethod method, 416 ResizeMethod method,
417 int dest_width, int dest_height) { 417 int dest_width, int dest_height) {
418 SkIRect dest_subset = { 0, 0, dest_width, dest_height }; 418 SkIRect dest_subset = { 0, 0, dest_width, dest_height };
419 return Resize(source, method, dest_width, dest_height, dest_subset); 419 return Resize(source, method, dest_width, dest_height, dest_subset);
420 } 420 }
421 421
422 } // namespace skia 422 } // namespace skia
OLDNEW
« net/base/x509_certificate_unittest.cc ('K') | « net/tools/hresolv/hresolv.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698