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

Side by Side Diff: content/browser/devtools/protocol/color_picker.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/devtools/protocol/color_picker.h" 5 #include "content/browser/devtools/protocol/color_picker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/renderer_host/render_widget_host_view_base.h" 10 #include "content/browser/renderer_host/render_widget_host_view_base.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return true; 118 return true;
119 119
120 if (event.button == blink::WebMouseEvent::Button::kLeft && 120 if (event.button == blink::WebMouseEvent::Button::kLeft &&
121 (event.GetType() == blink::WebInputEvent::kMouseDown || 121 (event.GetType() == blink::WebInputEvent::kMouseDown ||
122 event.GetType() == blink::WebInputEvent::kMouseMove)) { 122 event.GetType() == blink::WebInputEvent::kMouseMove)) {
123 if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() || 123 if (last_cursor_x_ < 0 || last_cursor_x_ >= frame_.width() ||
124 last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) { 124 last_cursor_y_ < 0 || last_cursor_y_ >= frame_.height()) {
125 return true; 125 return true;
126 } 126 }
127 127
128 SkAutoLockPixels lock_image(frame_);
129 SkColor sk_color = frame_.getColor(last_cursor_x_, last_cursor_y_); 128 SkColor sk_color = frame_.getColor(last_cursor_x_, last_cursor_y_);
130 callback_.Run(SkColorGetR(sk_color), SkColorGetG(sk_color), 129 callback_.Run(SkColorGetR(sk_color), SkColorGetG(sk_color),
131 SkColorGetB(sk_color), SkColorGetA(sk_color)); 130 SkColorGetB(sk_color), SkColorGetA(sk_color));
132 } 131 }
133 UpdateCursor(); 132 UpdateCursor();
134 return true; 133 return true;
135 } 134 }
136 135
137 void ColorPicker::UpdateCursor() { 136 void ColorPicker::UpdateCursor() {
138 if (!host_ || frame_.drawsNothing()) 137 if (!host_ || frame_.drawsNothing())
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 gfx::Point(kHotspotOffset * device_scale_factor, 256 gfx::Point(kHotspotOffset * device_scale_factor,
258 kHotspotOffset * device_scale_factor); 257 kHotspotOffset * device_scale_factor);
259 258
260 cursor.InitFromCursorInfo(cursor_info); 259 cursor.InitFromCursorInfo(cursor_info);
261 DCHECK(host_); 260 DCHECK(host_);
262 host_->SetCursor(cursor); 261 host_->SetCursor(cursor);
263 } 262 }
264 263
265 } // namespace protocol 264 } // namespace protocol
266 } // namespace content 265 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698