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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "caching_bitmap_canvas_layer_texture_updater.h" | 7 #include "caching_bitmap_canvas_layer_texture_updater.h" |
8 | 8 |
9 #include "LayerPainterChromium.h" | 9 #include "LayerPainterChromium.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 CCRenderingStats& stats) { | 32 CCRenderingStats& stats) { |
33 BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect, | 33 BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect, |
34 tile_size, | 34 tile_size, |
35 contents_width_scale, | 35 contents_width_scale, |
36 contents_height_scale, | 36 contents_height_scale, |
37 resulting_opaque_rect, | 37 resulting_opaque_rect, |
38 stats); | 38 stats); |
39 | 39 |
40 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false); | 40 const SkBitmap& new_bitmap = m_canvas->getDevice()->accessBitmap(false); |
41 SkAutoLockPixels lock(new_bitmap); | 41 SkAutoLockPixels lock(new_bitmap); |
42 ASSERT(new_bitmap.bytesPerPixel() > 0); | 42 CC_DCHECK(new_bitmap.bytesPerPixel() > 0); |
43 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || | 43 pixels_did_change_ = new_bitmap.config() != cached_bitmap_.config() || |
44 new_bitmap.height() != cached_bitmap_.height() || | 44 new_bitmap.height() != cached_bitmap_.height() || |
45 new_bitmap.width() != cached_bitmap_.width() || | 45 new_bitmap.width() != cached_bitmap_.width() || |
46 memcmp(new_bitmap.getPixels(), | 46 memcmp(new_bitmap.getPixels(), |
47 cached_bitmap_.getPixels(), | 47 cached_bitmap_.getPixels(), |
48 new_bitmap.getSafeSize()); | 48 new_bitmap.getSafeSize()); |
49 | 49 |
50 if (pixels_did_change_) | 50 if (pixels_did_change_) |
51 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); | 51 new_bitmap.deepCopyTo(&cached_bitmap_, new_bitmap.config()); |
52 } | 52 } |
53 | 53 |
54 bool CachingBitmapCanvasLayerTextureUpdater::pixelsDidChange() const | 54 bool CachingBitmapCanvasLayerTextureUpdater::pixelsDidChange() const |
55 { | 55 { |
56 return pixels_did_change_; | 56 return pixels_did_change_; |
57 } | 57 } |
58 | 58 |
59 } // namespace cc | 59 } // namespace cc |
OLD | NEW |