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

Side by Side Diff: ui/views/controls/image_view.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 | « ui/gfx/skia_util.cc ('k') | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.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 (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 "ui/views/controls/image_view.h" 5 #include "ui/views/controls/image_view.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "cc/paint/paint_flags.h" 11 #include "cc/paint/paint_flags.h"
12 #include "ui/accessibility/ax_node_data.h" 12 #include "ui/accessibility/ax_node_data.h"
13 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/geometry/insets.h" 14 #include "ui/gfx/geometry/insets.h"
15 15
16 namespace views { 16 namespace views {
17 17
18 namespace { 18 namespace {
19 19
20 // Returns the pixels for the bitmap in |image| at scale |image_scale|. 20 // Returns the pixels for the bitmap in |image| at scale |image_scale|.
21 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) { 21 void* GetBitmapPixels(const gfx::ImageSkia& img, float image_scale) {
22 DCHECK_NE(0.0f, image_scale); 22 DCHECK_NE(0.0f, image_scale);
23 const SkBitmap& bitmap = img.GetRepresentation(image_scale).sk_bitmap(); 23 return img.GetRepresentation(image_scale).sk_bitmap().getPixels();
24 SkAutoLockPixels pixel_lock(bitmap);
25 return bitmap.getPixels();
26 } 24 }
27 25
28 } // namespace 26 } // namespace
29 27
30 // static 28 // static
31 const char ImageView::kViewClassName[] = "ImageView"; 29 const char ImageView::kViewClassName[] = "ImageView";
32 30
33 ImageView::ImageView() 31 ImageView::ImageView()
34 : image_size_set_(false), 32 : image_size_set_(false),
35 horiz_alignment_(CENTER), 33 horiz_alignment_(CENTER),
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 image_bounds.x(), image_bounds.y(), 199 image_bounds.x(), image_bounds.y(),
202 image_bounds.width(), image_bounds.height(), true, 200 image_bounds.width(), image_bounds.height(), true,
203 flags); 201 flags);
204 } else { 202 } else {
205 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y()); 203 canvas->DrawImageInt(image_, image_bounds.x(), image_bounds.y());
206 } 204 }
207 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_); 205 last_painted_bitmap_pixels_ = GetBitmapPixels(image_, last_paint_scale_);
208 } 206 }
209 207
210 } // namespace views 208 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/skia_util.cc ('k') | ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698