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 16 matching lines...) Expand all Loading... |
27 int layer_id) | 27 int layer_id) |
28 : BitmapContentLayerUpdater(painter.Pass(), | 28 : BitmapContentLayerUpdater(painter.Pass(), |
29 stats_instrumentation, | 29 stats_instrumentation, |
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::Rect paint_rect, |
37 gfx::Size tile_size, | 38 gfx::Size tile_size, |
38 float contents_width_scale, | 39 float contents_width_scale, |
39 float contents_height_scale, | 40 float contents_height_scale, |
40 gfx::Rect* resulting_opaque_rect) { | 41 gfx::Rect* resulting_opaque_rect) { |
41 BitmapContentLayerUpdater::PrepareToUpdate(content_rect, | 42 BitmapContentLayerUpdater::PrepareToUpdate(content_rect, |
| 43 paint_rect, |
42 tile_size, | 44 tile_size, |
43 contents_width_scale, | 45 contents_width_scale, |
44 contents_height_scale, | 46 contents_height_scale, |
45 resulting_opaque_rect); | 47 resulting_opaque_rect); |
46 | 48 |
47 const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false); | 49 const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false); |
48 SkAutoLockPixels lock(new_bitmap); | 50 SkAutoLockPixels lock(new_bitmap); |
49 DCHECK_GT(new_bitmap.bytesPerPixel(), 0); | 51 DCHECK_GT(new_bitmap.bytesPerPixel(), 0); |
50 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || | 52 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || |
51 new_bitmap.height() != cached_bitmap_.height() || | 53 new_bitmap.height() != cached_bitmap_.height() || |
52 new_bitmap.width() != cached_bitmap_.width() || | 54 new_bitmap.width() != cached_bitmap_.width() || |
53 memcmp(new_bitmap.getPixels(), | 55 memcmp(new_bitmap.getPixels(), |
54 cached_bitmap_.getPixels(), | 56 cached_bitmap_.getPixels(), |
55 new_bitmap.getSafeSize()); | 57 new_bitmap.getSafeSize()); |
56 | 58 |
57 if (pixels_did_change_) | 59 if (pixels_did_change_) |
58 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); | 60 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); |
59 } | 61 } |
60 | 62 |
61 } // namespace cc | 63 } // namespace cc |
OLD | NEW |