| Index: skia/ext/image_operations.cc
|
| diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc
|
| index bf063d7719b20170537d483698a5d37a052152d0..17c99973aeebcfd238f03296689633f269888a5a 100644
|
| --- a/skia/ext/image_operations.cc
|
| +++ b/skia/ext/image_operations.cc
|
| @@ -342,134 +342,9 @@ SkBitmap ImageOperations::Resize(const SkBitmap& source,
|
| int dest_width, int dest_height,
|
| const SkIRect& dest_subset,
|
| SkBitmap::Allocator* allocator) {
|
| - if (method == ImageOperations::RESIZE_SUBPIXEL) {
|
| - return ResizeSubpixel(source, dest_width, dest_height,
|
| - dest_subset, allocator);
|
| - } else {
|
| - return ResizeBasic(source, method, dest_width, dest_height, dest_subset,
|
| - allocator);
|
| - }
|
| -}
|
| -
|
| -// static
|
| -SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
|
| - int dest_width, int dest_height,
|
| - const SkIRect& dest_subset,
|
| - SkBitmap::Allocator* allocator) {
|
| - TRACE_EVENT2("skia", "ImageOperations::ResizeSubpixel",
|
| - "src_pixels", source.width()*source.height(),
|
| - "dst_pixels", dest_width*dest_height);
|
| - // Currently only works on Linux/BSD because these are the only platforms
|
| - // where SkFontHost::GetSubpixelOrder is defined.
|
| -#if defined(OS_LINUX) && !defined(GTV)
|
| - // Understand the display.
|
| - const SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder();
|
| - const SkFontHost::LCDOrientation orientation =
|
| - SkFontHost::GetSubpixelOrientation();
|
| -
|
| - // Decide on which dimension, if any, to deploy subpixel rendering.
|
| - int w = 1;
|
| - int h = 1;
|
| - switch (orientation) {
|
| - case SkFontHost::kHorizontal_LCDOrientation:
|
| - w = dest_width < source.width() ? 3 : 1;
|
| - break;
|
| - case SkFontHost::kVertical_LCDOrientation:
|
| - h = dest_height < source.height() ? 3 : 1;
|
| - break;
|
| - }
|
| -
|
| - // Resize the image.
|
| - const int width = dest_width * w;
|
| - const int height = dest_height * h;
|
| - SkIRect subset = { dest_subset.fLeft, dest_subset.fTop,
|
| - dest_subset.fLeft + dest_subset.width() * w,
|
| - dest_subset.fTop + dest_subset.height() * h };
|
| - SkBitmap img = ResizeBasic(source, ImageOperations::RESIZE_LANCZOS3, width,
|
| - height, subset, allocator);
|
| - const int row_words = img.rowBytes() / 4;
|
| - if (w == 1 && h == 1)
|
| - return img;
|
| -
|
| - // Render into subpixels.
|
| - SkBitmap result;
|
| - result.setInfo(SkImageInfo::MakeN32(dest_subset.width(), dest_subset.height(),
|
| - img.alphaType()));
|
| - result.allocPixels(allocator, NULL);
|
| - if (!result.readyToDraw())
|
| - return img;
|
| -
|
| - SkAutoLockPixels locker(img);
|
| - if (!img.readyToDraw())
|
| - return img;
|
| -
|
| - uint32* src_row = img.getAddr32(0, 0);
|
| - uint32* dst_row = result.getAddr32(0, 0);
|
| - for (int y = 0; y < dest_subset.height(); y++) {
|
| - uint32* src = src_row;
|
| - uint32* dst = dst_row;
|
| - for (int x = 0; x < dest_subset.width(); x++, src += w, dst++) {
|
| - uint8 r = 0, g = 0, b = 0, a = 0;
|
| - switch (order) {
|
| - case SkFontHost::kRGB_LCDOrder:
|
| - switch (orientation) {
|
| - case SkFontHost::kHorizontal_LCDOrientation:
|
| - r = SkGetPackedR32(src[0]);
|
| - g = SkGetPackedG32(src[1]);
|
| - b = SkGetPackedB32(src[2]);
|
| - a = SkGetPackedA32(src[1]);
|
| - break;
|
| - case SkFontHost::kVertical_LCDOrientation:
|
| - r = SkGetPackedR32(src[0 * row_words]);
|
| - g = SkGetPackedG32(src[1 * row_words]);
|
| - b = SkGetPackedB32(src[2 * row_words]);
|
| - a = SkGetPackedA32(src[1 * row_words]);
|
| - break;
|
| - }
|
| - break;
|
| - case SkFontHost::kBGR_LCDOrder:
|
| - switch (orientation) {
|
| - case SkFontHost::kHorizontal_LCDOrientation:
|
| - b = SkGetPackedB32(src[0]);
|
| - g = SkGetPackedG32(src[1]);
|
| - r = SkGetPackedR32(src[2]);
|
| - a = SkGetPackedA32(src[1]);
|
| - break;
|
| - case SkFontHost::kVertical_LCDOrientation:
|
| - b = SkGetPackedB32(src[0 * row_words]);
|
| - g = SkGetPackedG32(src[1 * row_words]);
|
| - r = SkGetPackedR32(src[2 * row_words]);
|
| - a = SkGetPackedA32(src[1 * row_words]);
|
| - break;
|
| - }
|
| - break;
|
| - case SkFontHost::kNONE_LCDOrder:
|
| - NOTREACHED();
|
| - }
|
| - // Premultiplied alpha is very fragile.
|
| - a = a > r ? a : r;
|
| - a = a > g ? a : g;
|
| - a = a > b ? a : b;
|
| - *dst = SkPackARGB32(a, r, g, b);
|
| - }
|
| - src_row += h * row_words;
|
| - dst_row += result.rowBytes() / 4;
|
| - }
|
| - return result;
|
| -#else
|
| - return SkBitmap();
|
| -#endif // OS_POSIX && !OS_MACOSX && !defined(OS_ANDROID)
|
| -}
|
| -
|
| -// static
|
| -SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
|
| - ResizeMethod method,
|
| - int dest_width, int dest_height,
|
| - const SkIRect& dest_subset,
|
| - SkBitmap::Allocator* allocator) {
|
| - TRACE_EVENT2("skia", "ImageOperations::ResizeBasic",
|
| - "src_pixels", source.width()*source.height(),
|
| - "dst_pixels", dest_width*dest_height);
|
| + TRACE_EVENT2("disabled-by-default-skia", "ImageOperations::Resize",
|
| + "src_pixels", source.width() * source.height(), "dst_pixels",
|
| + dest_width * dest_height);
|
| // Ensure that the ResizeMethod enumeration is sound.
|
| SkASSERT(((RESIZE_FIRST_QUALITY_METHOD <= method) &&
|
| (method <= RESIZE_LAST_QUALITY_METHOD)) ||
|
|
|