| 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 "gpu/command_buffer/service/image_factory.h" | 5 #include "gpu/command_buffer/service/image_factory.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/common/capabilities.h" | 7 #include "gpu/command_buffer/common/capabilities.h" |
| 8 #include "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 case gfx::GpuMemoryBuffer::BGRA_8888: | 73 case gfx::GpuMemoryBuffer::BGRA_8888: |
| 74 return capabilities.texture_format_bgra8888; | 74 return capabilities.texture_format_bgra8888; |
| 75 case gfx::GpuMemoryBuffer::DXT1: | 75 case gfx::GpuMemoryBuffer::DXT1: |
| 76 return capabilities.texture_format_dxt1; | 76 return capabilities.texture_format_dxt1; |
| 77 case gfx::GpuMemoryBuffer::DXT5: | 77 case gfx::GpuMemoryBuffer::DXT5: |
| 78 return capabilities.texture_format_dxt5; | 78 return capabilities.texture_format_dxt5; |
| 79 case gfx::GpuMemoryBuffer::ETC1: | 79 case gfx::GpuMemoryBuffer::ETC1: |
| 80 return capabilities.texture_format_etc1; | 80 return capabilities.texture_format_etc1; |
| 81 case gfx::GpuMemoryBuffer::RGBA_8888: | 81 case gfx::GpuMemoryBuffer::RGBA_8888: |
| 82 case gfx::GpuMemoryBuffer::RGBX_8888: | 82 case gfx::GpuMemoryBuffer::RGBX_8888: |
| 83 case gfx::GpuMemoryBuffer::YUV_420: |
| 83 return true; | 84 return true; |
| 84 } | 85 } |
| 85 | 86 |
| 86 NOTREACHED(); | 87 NOTREACHED(); |
| 87 return false; | 88 return false; |
| 88 } | 89 } |
| 89 | 90 |
| 90 // static | 91 // static |
| 91 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( | 92 bool ImageFactory::IsImageSizeValidForGpuMemoryBufferFormat( |
| 92 const gfx::Size& size, | 93 const gfx::Size& size, |
| 93 gfx::GpuMemoryBuffer::Format format) { | 94 gfx::GpuMemoryBuffer::Format format) { |
| 94 switch (format) { | 95 switch (format) { |
| 95 case gfx::GpuMemoryBuffer::ATC: | 96 case gfx::GpuMemoryBuffer::ATC: |
| 96 case gfx::GpuMemoryBuffer::ATCIA: | 97 case gfx::GpuMemoryBuffer::ATCIA: |
| 97 case gfx::GpuMemoryBuffer::DXT1: | 98 case gfx::GpuMemoryBuffer::DXT1: |
| 98 case gfx::GpuMemoryBuffer::DXT5: | 99 case gfx::GpuMemoryBuffer::DXT5: |
| 99 case gfx::GpuMemoryBuffer::ETC1: | 100 case gfx::GpuMemoryBuffer::ETC1: |
| 100 // Compressed images must have a width and height that's evenly divisible | 101 // Compressed images must have a width and height that's evenly divisible |
| 101 // by the block size. | 102 // by the block size. |
| 102 return size.width() % 4 == 0 && size.height() % 4 == 0; | 103 return size.width() % 4 == 0 && size.height() % 4 == 0; |
| 103 case gfx::GpuMemoryBuffer::RGBA_8888: | 104 case gfx::GpuMemoryBuffer::RGBA_8888: |
| 104 case gfx::GpuMemoryBuffer::BGRA_8888: | 105 case gfx::GpuMemoryBuffer::BGRA_8888: |
| 105 case gfx::GpuMemoryBuffer::RGBX_8888: | 106 case gfx::GpuMemoryBuffer::RGBX_8888: |
| 107 case gfx::GpuMemoryBuffer::YUV_420: |
| 106 return true; | 108 return true; |
| 107 } | 109 } |
| 108 | 110 |
| 109 NOTREACHED(); | 111 NOTREACHED(); |
| 110 return false; | 112 return false; |
| 111 } | 113 } |
| 112 | 114 |
| 113 } // namespace gpu | 115 } // namespace gpu |
| OLD | NEW |