Commit 0551782d authored by reed's avatar reed Committed by Commit bot

remove legacy code from PlatformCanvas days

According to the comment, this extra copy was needed when the bitmaps in a platform-canvas
wasn't ref-countable. That is no longer the case (hasn't been true for quite a while AFAIK)
so this CL removes that code.

BUG=

Review-Url: https://codereview.chromium.org/2799283003
Cr-Commit-Position: refs/heads/master@{#462845}
parent 69cffb5b
......@@ -133,19 +133,6 @@ SkBitmap ContentBasedThumbnailingAlgorithm::PrepareSourceBitmap(
SkBitmap result_bitmap = SkBitmapOperations::DownsampleByTwoUntilSize(
clipped_bitmap, resize_target.width(), resize_target.height());
#if !defined(USE_AURA)
// If the bitmap has not been indeed resized, it has to be copied. In that
// case resampler simply returns a reference to the original bitmap, sitting
// in PlatformCanvas. One does not simply assign these 'magic' bitmaps to
// SkBitmap. They cannot be refcounted.
//
// With Aura, this does not happen since PlatformCanvas is platform
// idependent.
if (clipped_bitmap.width() == result_bitmap.width() &&
clipped_bitmap.height() == result_bitmap.height()) {
clipped_bitmap.copyTo(&result_bitmap, kN32_SkColorType);
}
#endif
return result_bitmap;
}
......
......@@ -177,24 +177,6 @@ SkBitmap SimpleThumbnailCrop::CreateThumbnail(const SkBitmap& bitmap,
// close, and let the caller make it the exact size if desired.
SkBitmap result = SkBitmapOperations::DownsampleByTwoUntilSize(
clipped_bitmap, desired_size.width(), desired_size.height());
#if !defined(USE_AURA)
// This is a bit subtle. SkBitmaps are refcounted, but the magic
// ones in PlatformCanvas can't be assigned to SkBitmap with proper
// refcounting. If the bitmap doesn't change, then the downsampler
// will return the input bitmap, which will be the reference to the
// weird PlatformCanvas one insetad of a regular one. To get a
// regular refcounted bitmap, we need to copy it.
//
// On Aura, the PlatformCanvas is platform-independent and does not have
// any native platform resources that can't be refounted, so this issue does
// not occur.
//
// Note that GetClippedBitmap() does extractSubset() but it won't copy
// the pixels, hence we check result size == clipped_bitmap size here.
if (clipped_bitmap.width() == result.width() &&
clipped_bitmap.height() == result.height())
clipped_bitmap.copyTo(&result, kN32_SkColorType);
#endif
LOCAL_HISTOGRAM_TIMES(kThumbnailHistogramName,
base::TimeTicks::Now() - begin_compute_thumbnail);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment