OLD | NEW |
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 "cc/resources/caching_bitmap_content_layer_updater.h" | 5 #include "cc/resources/caching_bitmap_content_layer_updater.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "cc/resources/layer_painter.h" | 8 #include "cc/resources/layer_painter.h" |
9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 layer_id), | 30 layer_id), |
31 pixels_did_change_(false) {} | 31 pixels_did_change_(false) {} |
32 | 32 |
33 CachingBitmapContentLayerUpdater::~CachingBitmapContentLayerUpdater() {} | 33 CachingBitmapContentLayerUpdater::~CachingBitmapContentLayerUpdater() {} |
34 | 34 |
35 void CachingBitmapContentLayerUpdater::PrepareToUpdate( | 35 void CachingBitmapContentLayerUpdater::PrepareToUpdate( |
36 gfx::Rect content_rect, | 36 gfx::Rect content_rect, |
37 gfx::Size tile_size, | 37 gfx::Size tile_size, |
38 float contents_width_scale, | 38 float contents_width_scale, |
39 float contents_height_scale, | 39 float contents_height_scale, |
40 gfx::Rect* resulting_opaque_rect, | 40 gfx::Rect* resulting_opaque_rect) { |
41 RenderingStats* stats) { | |
42 BitmapContentLayerUpdater::PrepareToUpdate(content_rect, | 41 BitmapContentLayerUpdater::PrepareToUpdate(content_rect, |
43 tile_size, | 42 tile_size, |
44 contents_width_scale, | 43 contents_width_scale, |
45 contents_height_scale, | 44 contents_height_scale, |
46 resulting_opaque_rect, | 45 resulting_opaque_rect); |
47 stats); | |
48 | 46 |
49 const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false); | 47 const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false); |
50 SkAutoLockPixels lock(new_bitmap); | 48 SkAutoLockPixels lock(new_bitmap); |
51 DCHECK_GT(new_bitmap.bytesPerPixel(), 0); | 49 DCHECK_GT(new_bitmap.bytesPerPixel(), 0); |
52 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || | 50 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || |
53 new_bitmap.height() != cached_bitmap_.height() || | 51 new_bitmap.height() != cached_bitmap_.height() || |
54 new_bitmap.width() != cached_bitmap_.width() || | 52 new_bitmap.width() != cached_bitmap_.width() || |
55 memcmp(new_bitmap.getPixels(), | 53 memcmp(new_bitmap.getPixels(), |
56 cached_bitmap_.getPixels(), | 54 cached_bitmap_.getPixels(), |
57 new_bitmap.getSafeSize()); | 55 new_bitmap.getSafeSize()); |
58 | 56 |
59 if (pixels_did_change_) | 57 if (pixels_did_change_) |
60 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); | 58 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); |
61 } | 59 } |
62 | 60 |
63 } // namespace cc | 61 } // namespace cc |
OLD | NEW |