| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 uint64_t previous_content_id) { | 88 uint64_t previous_content_id) { |
| 89 return base::WrapUnique<RasterBuffer>( | 89 return base::WrapUnique<RasterBuffer>( |
| 90 new RasterBufferImpl(resource_provider_, resource)); | 90 new RasterBufferImpl(resource_provider_, resource)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void ZeroCopyRasterBufferProvider::ReleaseBufferForRaster( | 93 void ZeroCopyRasterBufferProvider::ReleaseBufferForRaster( |
| 94 std::unique_ptr<RasterBuffer> buffer) { | 94 std::unique_ptr<RasterBuffer> buffer) { |
| 95 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. | 95 // Nothing to do here. RasterBufferImpl destructor cleans up after itself. |
| 96 } | 96 } |
| 97 | 97 |
| 98 void ZeroCopyRasterBufferProvider::OrderingBarrier() { | 98 bool ZeroCopyRasterBufferProvider::OrderingBarrier() { |
| 99 // No need to sync resources as this provider does not use GL context. | 99 // No need to sync resources as this provider does not use GL context. |
| 100 return true; |
| 100 } | 101 } |
| 101 | 102 |
| 102 ResourceFormat ZeroCopyRasterBufferProvider::GetResourceFormat( | 103 ResourceFormat ZeroCopyRasterBufferProvider::GetResourceFormat( |
| 103 bool must_support_alpha) const { | 104 bool must_support_alpha) const { |
| 104 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && | 105 if (resource_provider_->IsResourceFormatSupported(preferred_tile_format_) && |
| 105 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || | 106 (DoesResourceFormatSupportAlpha(preferred_tile_format_) || |
| 106 !must_support_alpha)) { | 107 !must_support_alpha)) { |
| 107 return preferred_tile_format_; | 108 return preferred_tile_format_; |
| 108 } | 109 } |
| 109 | 110 |
| 110 return resource_provider_->best_texture_format(); | 111 return resource_provider_->best_texture_format(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 bool ZeroCopyRasterBufferProvider::GetResourceRequiresSwizzle( | 114 bool ZeroCopyRasterBufferProvider::GetResourceRequiresSwizzle( |
| 114 bool must_support_alpha) const { | 115 bool must_support_alpha) const { |
| 115 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); | 116 return ResourceFormatRequiresSwizzle(GetResourceFormat(must_support_alpha)); |
| 116 } | 117 } |
| 117 | 118 |
| 118 void ZeroCopyRasterBufferProvider::Shutdown() {} | 119 void ZeroCopyRasterBufferProvider::Shutdown() {} |
| 119 | 120 |
| 120 } // namespace cc | 121 } // namespace cc |
| OLD | NEW |