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

Side by Side Diff: chrome/browser/extensions/extension_icon_image_unittest.cc

Issue 294863002: Cleanup changes related to replacing usage of GetImageScale with GetScaleForScaleFactor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing changes to enable high dpi by default from this patch Created 6 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
« no previous file with comments | « no previous file | chrome/browser/history/select_favicon_frames_unittest.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 "chrome/browser/extensions/extension_icon_image.h" 5 #include "chrome/browser/extensions/extension_icon_image.h"
6 6
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/extensions/image_loader.h" 10 #include "chrome/browser/extensions/image_loader.h"
(...skipping 13 matching lines...) Expand all
24 24
25 using content::BrowserThread; 25 using content::BrowserThread;
26 using extensions::Extension; 26 using extensions::Extension;
27 using extensions::IconImage; 27 using extensions::IconImage;
28 using extensions::Manifest; 28 using extensions::Manifest;
29 29
30 namespace { 30 namespace {
31 31
32 SkBitmap CreateBlankBitmapForScale(int size_dip, ui::ScaleFactor scale_factor) { 32 SkBitmap CreateBlankBitmapForScale(int size_dip, ui::ScaleFactor scale_factor) {
33 SkBitmap bitmap; 33 SkBitmap bitmap;
34 const float scale = ui::GetImageScale(scale_factor); 34 const float scale = ui::GetScaleForScaleFactor(scale_factor);
35 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 35 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
36 static_cast<int>(size_dip * scale), 36 static_cast<int>(size_dip * scale),
37 static_cast<int>(size_dip * scale)); 37 static_cast<int>(size_dip * scale));
38 bitmap.allocPixels(); 38 bitmap.allocPixels();
39 bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0)); 39 bitmap.eraseColor(SkColorSetARGB(0, 0, 0, 0));
40 return bitmap; 40 return bitmap;
41 } 41 }
42 42
43 SkBitmap EnsureBitmapSize(const SkBitmap& original, int size) { 43 SkBitmap EnsureBitmapSize(const SkBitmap& original, int size) {
44 if (original.width() == size && original.height() == size) 44 if (original.width() == size && original.height() == size)
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 565
566 // When requesting another representation, we should not crash and return some 566 // When requesting another representation, we should not crash and return some
567 // image of the size. It could be blank or a rescale from the existing 1.0f 567 // image of the size. It could be blank or a rescale from the existing 1.0f
568 // icon. 568 // icon.
569 representation = image_skia.GetRepresentation(2.0f); 569 representation = image_skia.GetRepresentation(2.0f);
570 570
571 EXPECT_EQ(16, representation.GetWidth()); 571 EXPECT_EQ(16, representation.GetWidth());
572 EXPECT_EQ(16, representation.GetHeight()); 572 EXPECT_EQ(16, representation.GetHeight());
573 EXPECT_EQ(2.0f, representation.scale()); 573 EXPECT_EQ(2.0f, representation.scale());
574 } 574 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/select_favicon_frames_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698