| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 float scale, | 43 float scale, |
| 44 const RasterSource::PlaybackSettings& playback_settings) override { | 44 const RasterSource::PlaybackSettings& playback_settings) override { |
| 45 TRACE_EVENT0("cc", "BitmapRasterBuffer::Playback"); | 45 TRACE_EVENT0("cc", "BitmapRasterBuffer::Playback"); |
| 46 gfx::Rect playback_rect = raster_full_rect; | 46 gfx::Rect playback_rect = raster_full_rect; |
| 47 if (resource_has_previous_content_) { | 47 if (resource_has_previous_content_) { |
| 48 playback_rect.Intersect(raster_dirty_rect); | 48 playback_rect.Intersect(raster_dirty_rect); |
| 49 } | 49 } |
| 50 DCHECK(!playback_rect.IsEmpty()) | 50 DCHECK(!playback_rect.IsEmpty()) |
| 51 << "Why are we rastering a tile that's not dirty?"; | 51 << "Why are we rastering a tile that's not dirty?"; |
| 52 | 52 |
| 53 sk_sp<SkColorSpace> raster_color_space = | |
| 54 raster_source->HasImpliedColorSpace() ? nullptr | |
| 55 : lock_.sk_color_space(); | |
| 56 | |
| 57 size_t stride = 0u; | 53 size_t stride = 0u; |
| 58 RasterBufferProvider::PlaybackToMemory( | 54 RasterBufferProvider::PlaybackToMemory( |
| 59 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), | 55 lock_.sk_bitmap().getPixels(), resource_->format(), resource_->size(), |
| 60 stride, raster_source, raster_full_rect, playback_rect, scale, | 56 stride, raster_source, raster_full_rect, playback_rect, scale, |
| 61 raster_color_space, playback_settings); | 57 lock_.sk_color_space(), playback_settings); |
| 62 } | 58 } |
| 63 | 59 |
| 64 private: | 60 private: |
| 65 ResourceProvider::ScopedWriteLockSoftware lock_; | 61 ResourceProvider::ScopedWriteLockSoftware lock_; |
| 66 const Resource* resource_; | 62 const Resource* resource_; |
| 67 bool resource_has_previous_content_; | 63 bool resource_has_previous_content_; |
| 68 | 64 |
| 69 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 65 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
| 70 }; | 66 }; |
| 71 | 67 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const ResourceProvider::ResourceIdArray& resource_ids, | 122 const ResourceProvider::ResourceIdArray& resource_ids, |
| 127 const base::Closure& callback, | 123 const base::Closure& callback, |
| 128 uint64_t pending_callback_id) const { | 124 uint64_t pending_callback_id) const { |
| 129 // Bitmap resources are immediately ready to draw. | 125 // Bitmap resources are immediately ready to draw. |
| 130 return 0; | 126 return 0; |
| 131 } | 127 } |
| 132 | 128 |
| 133 void BitmapRasterBufferProvider::Shutdown() {} | 129 void BitmapRasterBufferProvider::Shutdown() {} |
| 134 | 130 |
| 135 } // namespace cc | 131 } // namespace cc |
| OLD | NEW |