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

Side by Side Diff: chrome/browser/history/select_favicon_frames_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
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 "components/favicon_base/select_favicon_frames.h" 5 #include "components/favicon_base/select_favicon_frames.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 26 matching lines...) Expand all
37 SkBitmap bitmap; 37 SkBitmap bitmap;
38 bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h); 38 bitmap.setConfig(SkBitmap::kARGB_8888_Config, w, h);
39 bitmap.allocPixels(); 39 bitmap.allocPixels();
40 bitmap.eraseColor(color); 40 bitmap.eraseColor(color);
41 return bitmap; 41 return bitmap;
42 } 42 }
43 43
44 SkColor GetColor(const gfx::ImageSkia& image, ui::ScaleFactor factor, 44 SkColor GetColor(const gfx::ImageSkia& image, ui::ScaleFactor factor,
45 int x = -1, int y = -1) { 45 int x = -1, int y = -1) {
46 const SkBitmap& bitmap = 46 const SkBitmap& bitmap =
47 image.GetRepresentation(ui::GetImageScale(factor)).sk_bitmap(); 47 image.GetRepresentation(ui::GetScaleForScaleFactor(factor)).sk_bitmap();
48 if (x == -1) 48 if (x == -1)
49 x = bitmap.width() / 2; 49 x = bitmap.width() / 2;
50 if (y == -1) 50 if (y == -1)
51 y = bitmap.width() / 2; 51 y = bitmap.width() / 2;
52 bitmap.lockPixels(); 52 bitmap.lockPixels();
53 SkColor color = bitmap.getColor(x, y); 53 SkColor color = bitmap.getColor(x, y);
54 bitmap.unlockPixels(); 54 bitmap.unlockPixels();
55 return color; 55 return color;
56 } 56 }
57 57
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15)); 265 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15));
266 vector<gfx::Size> sizes2; 266 vector<gfx::Size> sizes2;
267 sizes2.push_back(gfx::Size(15, 15)); 267 sizes2.push_back(gfx::Size(15, 15));
268 float score2; 268 float score2;
269 SelectFaviconFrames(bitmaps2, sizes2, Scale1x(), 16, &score2); 269 SelectFaviconFrames(bitmaps2, sizes2, Scale1x(), 16, &score2);
270 270
271 EXPECT_GT(score2, score1); 271 EXPECT_GT(score2, score1);
272 } 272 }
273 273
274 } // namespace 274 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_icon_image_unittest.cc ('k') | components/favicon_base/select_favicon_frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698