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

Side by Side Diff: cc/layers/scrollbar_layer_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
« no previous file with comments | « no previous file | cc/output/gl_renderer.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 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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 gfx::Rect screen_space_clip_rect; 1201 gfx::Rect screen_space_clip_rect;
1202 scrollbar_layer->SavePaintProperties(); 1202 scrollbar_layer->SavePaintProperties();
1203 1203
1204 scrollbar_layer->Update(); 1204 scrollbar_layer->Update();
1205 1205
1206 UIResourceBitmap* bitmap = fake_ui_resource_manager_->ui_resource_bitmap( 1206 UIResourceBitmap* bitmap = fake_ui_resource_manager_->ui_resource_bitmap(
1207 scrollbar_layer->track_resource_id()); 1207 scrollbar_layer->track_resource_id());
1208 1208
1209 DCHECK(bitmap); 1209 DCHECK(bitmap);
1210 1210
1211 AutoLockUIResourceBitmap locked_bitmap(*bitmap);
1212
1213 const SkColor* pixels = 1211 const SkColor* pixels =
1214 reinterpret_cast<const SkColor*>(locked_bitmap.GetPixels()); 1212 reinterpret_cast<const SkColor*>(bitmap->GetPixels());
1215 SkColor color = argb_to_skia( 1213 SkColor color = argb_to_skia(
1216 scrollbar_layer->fake_scrollbar()->paint_fill_color()); 1214 scrollbar_layer->fake_scrollbar()->paint_fill_color());
1217 int width = bitmap->GetSize().width(); 1215 int width = bitmap->GetSize().width();
1218 int height = bitmap->GetSize().height(); 1216 int height = bitmap->GetSize().height();
1219 1217
1220 // Make sure none of the corners of the bitmap were inadvertently clipped. 1218 // Make sure none of the corners of the bitmap were inadvertently clipped.
1221 EXPECT_EQ(color, pixels[0]) 1219 EXPECT_EQ(color, pixels[0])
1222 << "Top left pixel doesn't match scrollbar color."; 1220 << "Top left pixel doesn't match scrollbar color.";
1223 1221
1224 EXPECT_EQ(color, pixels[width - 1]) 1222 EXPECT_EQ(color, pixels[width - 1])
(...skipping 23 matching lines...) Expand all
1248 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); 1246 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f);
1249 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); 1247 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f);
1250 1248
1251 // Horizontal Scrollbars. 1249 // Horizontal Scrollbars.
1252 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); 1250 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f);
1253 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); 1251 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f);
1254 } 1252 }
1255 1253
1256 } // namespace 1254 } // namespace
1257 } // namespace cc 1255 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698