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

Side by Side Diff: cc/caching_bitmap_content_layer_updater.cc

Issue 12095053: cc: Avoid expensive RenderingStats collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/caching_bitmap_content_layer_updater.h ('k') | cc/content_layer.h » ('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 "caching_bitmap_content_layer_updater.h" 5 #include "caching_bitmap_content_layer_updater.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/layer_painter.h" 8 #include "cc/layer_painter.h"
9 #include "skia/ext/platform_canvas.h" 9 #include "skia/ext/platform_canvas.h"
10 10
(...skipping 16 matching lines...) Expand all
27 ~CachingBitmapContentLayerUpdater() 27 ~CachingBitmapContentLayerUpdater()
28 { 28 {
29 } 29 }
30 30
31 void CachingBitmapContentLayerUpdater::prepareToUpdate( 31 void CachingBitmapContentLayerUpdater::prepareToUpdate(
32 const gfx::Rect& content_rect, 32 const gfx::Rect& content_rect,
33 const gfx::Size& tile_size, 33 const gfx::Size& tile_size,
34 float contents_width_scale, 34 float contents_width_scale,
35 float contents_height_scale, 35 float contents_height_scale,
36 gfx::Rect& resulting_opaque_rect, 36 gfx::Rect& resulting_opaque_rect,
37 RenderingStats& stats) { 37 RenderingStats* stats) {
38 BitmapContentLayerUpdater::prepareToUpdate( 38 BitmapContentLayerUpdater::prepareToUpdate(
39 content_rect, 39 content_rect,
40 tile_size, 40 tile_size,
41 contents_width_scale, 41 contents_width_scale,
42 contents_height_scale, 42 contents_height_scale,
43 resulting_opaque_rect, 43 resulting_opaque_rect,
44 stats); 44 stats);
45 45
46 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false); 46 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false);
47 SkAutoLockPixels lock(new_bitmap); 47 SkAutoLockPixels lock(new_bitmap);
48 DCHECK(new_bitmap.bytesPerPixel() > 0); 48 DCHECK(new_bitmap.bytesPerPixel() > 0);
49 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || 49 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() ||
50 new_bitmap.height() != cached_bitmap_.height() || 50 new_bitmap.height() != cached_bitmap_.height() ||
51 new_bitmap.width() != cached_bitmap_.width() || 51 new_bitmap.width() != cached_bitmap_.width() ||
52 memcmp(new_bitmap.getPixels(), 52 memcmp(new_bitmap.getPixels(),
53 cached_bitmap_.getPixels(), 53 cached_bitmap_.getPixels(),
54 new_bitmap.getSafeSize()); 54 new_bitmap.getSafeSize());
55 55
56 if (pixels_did_change_) 56 if (pixels_did_change_)
57 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); 57 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config());
58 } 58 }
59 59
60 bool CachingBitmapContentLayerUpdater::pixelsDidChange() const 60 bool CachingBitmapContentLayerUpdater::pixelsDidChange() const
61 { 61 {
62 return pixels_did_change_; 62 return pixels_did_change_;
63 } 63 }
64 64
65 } // namespace cc 65 } // namespace cc
OLDNEW
« no previous file with comments | « cc/caching_bitmap_content_layer_updater.h ('k') | cc/content_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698