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

Side by Side Diff: chrome/browser/android/thumbnail/thumbnail_cache.cc

Issue 1142113002: Remove SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/android/thumbnail/thumbnail_cache.h" 5 #include "chrome/browser/android/thumbnail/thumbnail_cache.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/big_endian.h" 10 #include "base/big_endian.h"
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 DCHECK(!bitmap.empty()); 907 DCHECK(!bitmap.empty());
908 DCHECK_GT(scale, 0); 908 DCHECK_GT(scale, 0);
909 SkAutoLockPixels bitmap_lock(bitmap); 909 SkAutoLockPixels bitmap_lock(bitmap);
910 float new_scale = 1.f / kApproximationScaleFactor; 910 float new_scale = 1.f / kApproximationScaleFactor;
911 911
912 gfx::Size dst_size = gfx::ToFlooredSize( 912 gfx::Size dst_size = gfx::ToFlooredSize(
913 gfx::ScaleSize(gfx::Size(bitmap.width(), bitmap.height()), new_scale)); 913 gfx::ScaleSize(gfx::Size(bitmap.width(), bitmap.height()), new_scale));
914 SkBitmap dst_bitmap; 914 SkBitmap dst_bitmap;
915 dst_bitmap.allocPixels(SkImageInfo::Make(dst_size.width(), 915 dst_bitmap.allocPixels(SkImageInfo::Make(dst_size.width(),
916 dst_size.height(), 916 dst_size.height(),
917 bitmap.info().fColorType, 917 bitmap.info().colorType(),
918 bitmap.info().fAlphaType)); 918 bitmap.info().alphaType()));
919 dst_bitmap.eraseColor(0); 919 dst_bitmap.eraseColor(0);
920 SkAutoLockPixels dst_bitmap_lock(dst_bitmap); 920 SkAutoLockPixels dst_bitmap_lock(dst_bitmap);
921 921
922 SkCanvas canvas(dst_bitmap); 922 SkCanvas canvas(dst_bitmap);
923 canvas.scale(new_scale, new_scale); 923 canvas.scale(new_scale, new_scale);
924 canvas.drawBitmap(bitmap, 0, 0, NULL); 924 canvas.drawBitmap(bitmap, 0, 0, NULL);
925 dst_bitmap.setImmutable(); 925 dst_bitmap.setImmutable();
926 926
927 return std::make_pair(dst_bitmap, new_scale * scale); 927 return std::make_pair(dst_bitmap, new_scale * scale);
928 } 928 }
OLDNEW
« no previous file with comments | « cc/resources/ui_resource_bitmap.cc ('k') | content/shell/renderer/layout_test/blink_test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698