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_raster_buffer_provider.h" | 5 #include "cc/raster/zero_copy_raster_buffer_provider.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
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( | 32 void Playback( |
33 const RasterSource* raster_source, | 33 const RasterSource* raster_source, |
34 const gfx::Rect& raster_full_rect, | 34 const gfx::Rect& raster_full_rect, |
35 const gfx::Rect& raster_dirty_rect, | 35 const gfx::Rect& raster_dirty_rect, |
36 uint64_t new_content_id, | 36 uint64_t new_content_id, |
37 float scale, | 37 float scale, |
| 38 const gfx::Vector2dF& translation, |
38 const RasterSource::PlaybackSettings& playback_settings) override { | 39 const RasterSource::PlaybackSettings& playback_settings) override { |
39 TRACE_EVENT0("cc", "ZeroCopyRasterBuffer::Playback"); | 40 TRACE_EVENT0("cc", "ZeroCopyRasterBuffer::Playback"); |
40 gfx::GpuMemoryBuffer* buffer = lock_.GetGpuMemoryBuffer(); | 41 gfx::GpuMemoryBuffer* buffer = lock_.GetGpuMemoryBuffer(); |
41 if (!buffer) | 42 if (!buffer) |
42 return; | 43 return; |
43 | 44 |
44 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); | 45 DCHECK_EQ(1u, gfx::NumberOfPlanesForBufferFormat(buffer->GetFormat())); |
45 bool rv = buffer->Map(); | 46 bool rv = buffer->Map(); |
46 DCHECK(rv); | 47 DCHECK(rv); |
47 DCHECK(buffer->memory(0)); | 48 DCHECK(buffer->memory(0)); |
48 // RasterBufferProvider::PlaybackToMemory only supports unsigned strides. | 49 // RasterBufferProvider::PlaybackToMemory only supports unsigned strides. |
49 DCHECK_GE(buffer->stride(0), 0); | 50 DCHECK_GE(buffer->stride(0), 0); |
50 | 51 |
51 // TODO(danakj): Implement partial raster with raster_dirty_rect. | 52 // TODO(danakj): Implement partial raster with raster_dirty_rect. |
52 RasterBufferProvider::PlaybackToMemory( | 53 RasterBufferProvider::PlaybackToMemory( |
53 buffer->memory(0), resource_->format(), resource_->size(), | 54 buffer->memory(0), resource_->format(), resource_->size(), |
54 buffer->stride(0), raster_source, raster_full_rect, raster_full_rect, | 55 buffer->stride(0), raster_source, raster_full_rect, raster_full_rect, |
55 scale, playback_settings); | 56 scale, translation, playback_settings); |
56 buffer->Unmap(); | 57 buffer->Unmap(); |
57 } | 58 } |
58 | 59 |
59 private: | 60 private: |
60 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; | 61 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock_; |
61 const Resource* resource_; | 62 const Resource* resource_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); | 64 DISALLOW_COPY_AND_ASSIGN(RasterBufferImpl); |
64 }; | 65 }; |
65 | 66 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 118 } |
118 | 119 |
119 bool ZeroCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource() | 120 bool ZeroCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource() |
120 const { | 121 const { |
121 return false; | 122 return false; |
122 } | 123 } |
123 | 124 |
124 void ZeroCopyRasterBufferProvider::Shutdown() {} | 125 void ZeroCopyRasterBufferProvider::Shutdown() {} |
125 | 126 |
126 } // namespace cc | 127 } // namespace cc |
OLD | NEW |