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

Unified Diff: chrome/browser/themes/browser_theme_pack_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/themes/browser_theme_pack_unittest.cc
diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc
index a2dd82f320805619f615285675f9ea3b3364e69b..1833a1e304edabf1d720935c46802fe02499ab87 100644
--- a/chrome/browser/themes/browser_theme_pack_unittest.cc
+++ b/chrome/browser/themes/browser_theme_pack_unittest.cc
@@ -287,25 +287,21 @@ class BrowserThemePackTest : public ::testing::Test {
ASSERT_FALSE(rep1.is_null());
EXPECT_EQ(80, rep1.sk_bitmap().width());
EXPECT_EQ(80, rep1.sk_bitmap().height());
- rep1.sk_bitmap().lockPixels();
EXPECT_EQ(SkColorSetRGB(255, 255, 255), rep1.sk_bitmap().getColor(4, 4));
EXPECT_EQ(SkColorSetRGB(255, 255, 255), rep1.sk_bitmap().getColor(8, 8));
EXPECT_EQ(SkColorSetRGB(0, 241, 237), rep1.sk_bitmap().getColor(16, 16));
EXPECT_EQ(SkColorSetRGB(255, 255, 255), rep1.sk_bitmap().getColor(24, 24));
EXPECT_EQ(SkColorSetRGB(0, 241, 237), rep1.sk_bitmap().getColor(32, 32));
- rep1.sk_bitmap().unlockPixels();
// Scale 200%.
const gfx::ImageSkiaRep& rep2 = image_skia->GetRepresentation(2.0f);
ASSERT_FALSE(rep2.is_null());
EXPECT_EQ(160, rep2.sk_bitmap().width());
EXPECT_EQ(160, rep2.sk_bitmap().height());
- rep2.sk_bitmap().lockPixels();
EXPECT_EQ(SkColorSetRGB(255, 255, 255), rep2.sk_bitmap().getColor(4, 4));
EXPECT_EQ(SkColorSetRGB(223, 42, 0), rep2.sk_bitmap().getColor(8, 8));
EXPECT_EQ(SkColorSetRGB(223, 42, 0), rep2.sk_bitmap().getColor(16, 16));
EXPECT_EQ(SkColorSetRGB(223, 42, 0), rep2.sk_bitmap().getColor(24, 24));
EXPECT_EQ(SkColorSetRGB(255, 255, 255), rep2.sk_bitmap().getColor(32, 32));
- rep2.sk_bitmap().unlockPixels();
// TODO(sschmitz): I plan to remove the following (to the end of the fct)
// Reason: this test may be brittle. It depends on details of how we scale
@@ -327,7 +323,6 @@ class BrowserThemePackTest : public ::testing::Test {
ASSERT_FALSE(rep3.is_null());
EXPECT_EQ(80, rep3.sk_bitmap().width());
EXPECT_EQ(80, rep3.sk_bitmap().height());
- rep3.sk_bitmap().lockPixels();
// We take samples of colors and locations along the diagonal whenever
// the color changes. Note these colors are slightly different from
// the input PNG file due to input processing.
@@ -343,13 +338,11 @@ class BrowserThemePackTest : public ::testing::Test {
}
}
EXPECT_EQ(static_cast<size_t>(9), normal.size());
- rep3.sk_bitmap().unlockPixels();
// Scale 200%.
const gfx::ImageSkiaRep& rep4 = image_skia->GetRepresentation(2.0f);
ASSERT_FALSE(rep4.is_null());
EXPECT_EQ(160, rep4.sk_bitmap().width());
EXPECT_EQ(160, rep4.sk_bitmap().height());
- rep4.sk_bitmap().lockPixels();
// We expect the same colors and at locations scaled by 2
// since this bitmap was scaled by 2.
for (size_t i = 0; i < normal.size(); ++i) {
@@ -357,7 +350,6 @@ class BrowserThemePackTest : public ::testing::Test {
SkColor color = normal[i].second;
EXPECT_EQ(color, rep4.sk_bitmap().getColor(xy, xy));
}
- rep4.sk_bitmap().unlockPixels();
}
base::MessageLoop message_loop;
« no previous file with comments | « chrome/browser/sync/test/integration/bookmarks_helper.cc ('k') | chrome/browser/thumbnails/content_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698