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

Side by Side Diff: cc/layers/scrollbar_layer_unittest.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: fix mac 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
« no previous file with comments | « no previous file | cc/output/gl_renderer.cc » ('j') | cc/resources/ui_resource_bitmap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <unordered_map> 7 #include <unordered_map>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 gfx::Rect screen_space_clip_rect; 1188 gfx::Rect screen_space_clip_rect;
1189 scrollbar_layer->SavePaintProperties(); 1189 scrollbar_layer->SavePaintProperties();
1190 1190
1191 scrollbar_layer->Update(); 1191 scrollbar_layer->Update();
1192 1192
1193 UIResourceBitmap* bitmap = fake_ui_resource_manager_->ui_resource_bitmap( 1193 UIResourceBitmap* bitmap = fake_ui_resource_manager_->ui_resource_bitmap(
1194 scrollbar_layer->track_resource_id()); 1194 scrollbar_layer->track_resource_id());
1195 1195
1196 DCHECK(bitmap); 1196 DCHECK(bitmap);
1197 1197
1198 AutoLockUIResourceBitmap locked_bitmap(*bitmap);
1199
1200 const SkColor* pixels = 1198 const SkColor* pixels =
1201 reinterpret_cast<const SkColor*>(locked_bitmap.GetPixels()); 1199 reinterpret_cast<const SkColor*>(bitmap->GetPixels());
1202 SkColor color = argb_to_skia( 1200 SkColor color = argb_to_skia(
1203 scrollbar_layer->fake_scrollbar()->paint_fill_color()); 1201 scrollbar_layer->fake_scrollbar()->paint_fill_color());
1204 int width = bitmap->GetSize().width(); 1202 int width = bitmap->GetSize().width();
1205 int height = bitmap->GetSize().height(); 1203 int height = bitmap->GetSize().height();
1206 1204
1207 // Make sure none of the corners of the bitmap were inadvertently clipped. 1205 // Make sure none of the corners of the bitmap were inadvertently clipped.
1208 EXPECT_EQ(color, pixels[0]) 1206 EXPECT_EQ(color, pixels[0])
1209 << "Top left pixel doesn't match scrollbar color."; 1207 << "Top left pixel doesn't match scrollbar color.";
1210 1208
1211 EXPECT_EQ(color, pixels[width - 1]) 1209 EXPECT_EQ(color, pixels[width - 1])
(...skipping 23 matching lines...) Expand all
1235 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1233 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1236 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1234 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1237 1235
1238 // Horizontal Scrollbars. 1236 // Horizontal Scrollbars.
1239 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1237 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1240 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1238 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1241 } 1239 }
1242 1240
1243 } // namespace 1241 } // namespace
1244 } // namespace cc 1242 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer.cc » ('j') | cc/resources/ui_resource_bitmap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698