OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/zero_copy_tile_task_worker_pool.h" | 5 #include "cc/raster/zero_copy_tile_task_worker_pool.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace cc { | 22 namespace cc { |
23 namespace { | 23 namespace { |
24 | 24 |
25 class RasterBufferImpl : public RasterBuffer { | 25 class RasterBufferImpl : public RasterBuffer { |
26 public: | 26 public: |
27 RasterBufferImpl(ResourceProvider* resource_provider, | 27 RasterBufferImpl(ResourceProvider* resource_provider, |
28 const Resource* resource) | 28 const Resource* resource) |
29 : lock_(resource_provider, resource->id()), resource_(resource) {} | 29 : lock_(resource_provider, resource->id()), resource_(resource) {} |
30 | 30 |
31 // Overridden from RasterBuffer: | 31 // Overridden from RasterBuffer: |
32 void Playback(const RasterSource* raster_source, | 32 void Playback( |
33 const gfx::Rect& raster_full_rect, | 33 const RasterSource* raster_source, |
34 const gfx::Rect& raster_dirty_rect, | 34 const gfx::Rect& raster_full_rect, |
35 uint64_t new_content_id, | 35 const gfx::Rect& raster_dirty_rect, |
36 float scale, | 36 uint64_t new_content_id, |
37 bool include_images) override { | 37 float scale, |
| 38 const RasterSource::PlaybackSettings& playback_settings) override { |
38 gfx::GpuMemoryBuffer* buffer = lock_.GetGpuMemoryBuffer(); | 39 gfx::GpuMemoryBuffer* buffer = lock_.GetGpuMemoryBuffer(); |
39 if (!buffer) | 40 if (!buffer) |
40 return; | 41 return; |
41 | 42 |
42 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); | 43 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); |
43 bool rv = buffer->Map(); | 44 bool rv = buffer->Map(); |
44 DCHECK(rv); | 45 DCHECK(rv); |
45 DCHECK(buffer->memory(0)); | 46 DCHECK(buffer->memory(0)); |
46 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. | 47 // TileTaskWorkerPool::PlaybackToMemory only supports unsigned strides. |
47 DCHECK_GE(buffer->stride(0), 0); | 48 DCHECK_GE(buffer->stride(0), 0); |
48 | 49 |
49 // TODO(danakj): Implement partial raster with raster_dirty_rect. | 50 // TODO(danakj): Implement partial raster with raster_dirty_rect. |
50 TileTaskWorkerPool::PlaybackToMemory( | 51 TileTaskWorkerPool::PlaybackToMemory( |
51 buffer->memory(0), resource_->format(), resource_->size(), | 52 buffer->memory(0), resource_->format(), resource_->size(), |
52 buffer->stride(0), raster_source, raster_full_rect, raster_full_rect, | 53 buffer->stride(0), raster_source, raster_full_rect, raster_full_rect, |
53 scale, include_images); | 54 scale, playback_settings); |
54 buffer->Unmap(); | 55 buffer->Unmap(); |
55 } | 56 } |
56 | 57 |
57 private: | 58 private: |
58 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; | 59 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; |
59 const Resource* resource_; | 60 const Resource* resource_; |
60 | 61 |
61 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 62 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
62 }; | 63 }; |
63 | 64 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return make_scoped_ptr<RasterBuffer>( | 147 return make_scoped_ptr<RasterBuffer>( |
147 new RasterBufferImpl(resource_provider_, resource)); | 148 new RasterBufferImpl(resource_provider_, resource)); |
148 } | 149 } |
149 | 150 |
150 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster( | 151 void ZeroCopyTileTaskWorkerPool::ReleaseBufferForRaster( |
151 scoped_ptr<RasterBuffer> buffer) { | 152 scoped_ptr<RasterBuffer> buffer) { |
152 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 153 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
153 } | 154 } |
154 | 155 |
155 } // namespace cc | 156 } // namespace cc |
OLD | NEW |