| 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 "cc/layer_painter.h" | 9 #include "cc/layer_painter.h" |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CCRenderingStats& stats) { | 38 CCRenderingStats& stats) { |
| 39 BitmapCanvasLayerTextureUpdater::prepareToUpdate(content_rect, | 39 BitmapCanvasLayerTextureUpdater::prepareToUpdate(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 ASSERT(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 CachingBitmapCanvasLayerTextureUpdater::pixelsDidChange() const | 60 bool CachingBitmapCanvasLayerTextureUpdater::pixelsDidChange() const |
| 61 { | 61 { |
| 62 return pixels_did_change_; | 62 return pixels_did_change_; |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace cc | 65 } // namespace cc |
| OLD | NEW |