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

Side by Side Diff: components/favicon_base/select_favicon_frames_unittest.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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 (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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 SkColor GetColor(const gfx::ImageSkia& image, float scale, 54 SkColor GetColor(const gfx::ImageSkia& image, float scale,
55 int x = -1, int y = -1) { 55 int x = -1, int y = -1) {
56 const SkBitmap& bitmap = 56 const SkBitmap& bitmap =
57 image.GetRepresentation(scale).sk_bitmap(); 57 image.GetRepresentation(scale).sk_bitmap();
58 if (x == -1) 58 if (x == -1)
59 x = bitmap.width() / 2; 59 x = bitmap.width() / 2;
60 if (y == -1) 60 if (y == -1)
61 y = bitmap.width() / 2; 61 y = bitmap.width() / 2;
62 bitmap.lockPixels();
63 SkColor color = bitmap.getColor(x, y); 62 SkColor color = bitmap.getColor(x, y);
64 bitmap.unlockPixels();
65 return color; 63 return color;
66 } 64 }
67 65
68 SkColor GetColor1x(const gfx::ImageSkia& image) { 66 SkColor GetColor1x(const gfx::ImageSkia& image) {
69 return GetColor(image, 1.0f); 67 return GetColor(image, 1.0f);
70 } 68 }
71 69
72 SkColor GetColor2x(const gfx::ImageSkia& image) { 70 SkColor GetColor2x(const gfx::ImageSkia& image) {
73 return GetColor(image, 2.0f); 71 return GetColor(image, 2.0f);
74 } 72 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15)); 320 bitmaps2.push_back(MakeBitmap(SK_ColorGREEN, 15, 15));
323 vector<gfx::Size> sizes2; 321 vector<gfx::Size> sizes2;
324 sizes2.push_back(gfx::Size(15, 15)); 322 sizes2.push_back(gfx::Size(15, 15));
325 float score2; 323 float score2;
326 CreateFaviconImageSkia(bitmaps2, sizes2, 16, &score2); 324 CreateFaviconImageSkia(bitmaps2, sizes2, 16, &score2);
327 325
328 EXPECT_GT(score2, score1); 326 EXPECT_GT(score2, score1);
329 } 327 }
330 328
331 } // namespace 329 } // namespace
OLDNEW
« no previous file with comments | « components/display_compositor/gl_helper_unittest.cc ('k') | components/history/core/browser/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698