| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/raster/bitmap_tile_task_worker_pool.h" | 5 #include "cc/raster/bitmap_tile_task_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const Resource* resource, | 28 const Resource* resource, |
| 29 uint64_t resource_content_id, | 29 uint64_t resource_content_id, |
| 30 uint64_t previous_content_id) | 30 uint64_t previous_content_id) |
| 31 : lock_(resource_provider, resource->id()), | 31 : lock_(resource_provider, resource->id()), |
| 32 resource_(resource), | 32 resource_(resource), |
| 33 resource_has_previous_content_( | 33 resource_has_previous_content_( |
| 34 resource_content_id && resource_content_id == previous_content_id) { | 34 resource_content_id && resource_content_id == previous_content_id) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Overridden from RasterBuffer: | 37 // Overridden from RasterBuffer: |
| 38 void Playback(const RasterSource* raster_source, | 38 void Playback( |
| 39 const gfx::Rect& raster_full_rect, | 39 const RasterSource* raster_source, |
| 40 const gfx::Rect& raster_dirty_rect, | 40 const gfx::Rect& raster_full_rect, |
| 41 uint64_t new_content_id, | 41 const gfx::Rect& raster_dirty_rect, |
| 42 float scale, | 42 uint64_t new_content_id, |
| 43 bool include_images) override { | 43 float scale, |
| 44 const RasterSource::PlaybackSettings& playback_settings) override { |
| 44 gfx::Rect playback_rect = raster_full_rect; | 45 gfx::Rect playback_rect = raster_full_rect; |
| 45 if (resource_has_previous_content_) { | 46 if (resource_has_previous_content_) { |
| 46 playback_rect.Intersect(raster_dirty_rect); | 47 playback_rect.Intersect(raster_dirty_rect); |
| 47 } | 48 } |
| 48 DCHECK(!playback_rect.IsEmpty()) | 49 DCHECK(!playback_rect.IsEmpty()) |
| 49 << "Why are we rastering a tile that's not dirty?"; | 50 << "Why are we rastering a tile that's not dirty?"; |
| 50 | 51 |
| 51 size_t stride = 0u; | 52 size_t stride = 0u; |
| 52 TileTaskWorkerPool::PlaybackToMemory( | 53 TileTaskWorkerPool::PlaybackToMemory( |
| 53 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), | 54 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), |
| 54 stride, raster_source, raster_full_rect, playback_rect, scale, | 55 stride, raster_source, raster_full_rect, playback_rect, scale, |
| 55 include_images); | 56 playback_settings); |
| 56 } | 57 } |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 ResourceProvider::ScopedWriteLockSoftware lock_; | 60 ResourceProvider::ScopedWriteLockSoftware lock_; |
| 60 const Resource* resource_; | 61 const Resource* resource_; |
| 61 bool resource_has_previous_content_; | 62 bool resource_has_previous_content_; |
| 62 | 63 |
| 63 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 64 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 64 }; | 65 }; |
| 65 | 66 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( | 139 return scoped_ptr<RasterBuffer>(new RasterBufferImpl( |
| 139 resource_provider_, resource, resource_content_id, previous_content_id)); | 140 resource_provider_, resource, resource_content_id, previous_content_id)); |
| 140 } | 141 } |
| 141 | 142 |
| 142 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( | 143 void BitmapTileTaskWorkerPool::ReleaseBufferForRaster( |
| 143 scoped_ptr<RasterBuffer> buffer) { | 144 scoped_ptr<RasterBuffer> buffer) { |
| 144 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 145 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 145 } | 146 } |
| 146 | 147 |
| 147 } // namespace cc | 148 } // namespace cc |
| OLD | NEW |