| 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_raster_buffer_provider.h" | 5 #include "cc/raster/bitmap_raster_buffer_provider.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 23 matching lines...) Expand all Loading... |
| 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( | 38 void Playback( |
| 39 const RasterSource* raster_source, | 39 const RasterSource* raster_source, |
| 40 const gfx::Rect& raster_full_rect, | 40 const gfx::Rect& raster_full_rect, |
| 41 const gfx::Rect& raster_dirty_rect, | 41 const gfx::Rect& raster_dirty_rect, |
| 42 uint64_t new_content_id, | 42 uint64_t new_content_id, |
| 43 float scale, | 43 float scale, |
| 44 const gfx::Vector2dF& translation, |
| 44 const RasterSource::PlaybackSettings& playback_settings) override { | 45 const RasterSource::PlaybackSettings& playback_settings) override { |
| 45 TRACE_EVENT0("cc", "BitmapRasterBuffer::Playback"); | 46 TRACE_EVENT0("cc", "BitmapRasterBuffer::Playback"); |
| 46 gfx::Rect playback_rect = raster_full_rect; | 47 gfx::Rect playback_rect = raster_full_rect; |
| 47 if (resource_has_previous_content_) { | 48 if (resource_has_previous_content_) { |
| 48 playback_rect.Intersect(raster_dirty_rect); | 49 playback_rect.Intersect(raster_dirty_rect); |
| 49 } | 50 } |
| 50 DCHECK(!playback_rect.IsEmpty()) | 51 DCHECK(!playback_rect.IsEmpty()) |
| 51 << "Why are we rastering a tile that's not dirty?"; | 52 << "Why are we rastering a tile that's not dirty?"; |
| 52 | 53 |
| 53 size_t stride = 0u; | 54 size_t stride = 0u; |
| 54 RasterBufferProvider::PlaybackToMemory( | 55 RasterBufferProvider::PlaybackToMemory( |
| 55 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), | 56 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), |
| 56 stride, raster_source, raster_full_rect, playback_rect, scale, | 57 stride, raster_source, raster_full_rect, playback_rect, scale, |
| 57 playback_settings); | 58 translation, playback_settings); |
| 58 } | 59 } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 ResourceProvider::ScopedWriteLockSoftware lock_; | 62 ResourceProvider::ScopedWriteLockSoftware lock_; |
| 62 const Resource* resource_; | 63 const Resource* resource_; |
| 63 bool resource_has_previous_content_; | 64 bool resource_has_previous_content_; |
| 64 | 65 |
| 65 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 66 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 66 }; | 67 }; |
| 67 | 68 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 109 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
| 109 } | 110 } |
| 110 | 111 |
| 111 bool BitmapRasterBufferProvider::CanPartialRasterIntoProvidedResource() const { | 112 bool BitmapRasterBufferProvider::CanPartialRasterIntoProvidedResource() const { |
| 112 return true; | 113 return true; |
| 113 } | 114 } |
| 114 | 115 |
| 115 void BitmapRasterBufferProvider::Shutdown() {} | 116 void BitmapRasterBufferProvider::Shutdown() {} |
| 116 | 117 |
| 117 } // namespace cc | 118 } // namespace cc |
| OLD | NEW |