| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gl/test/gl_image_test_support.h" | 5 #include "ui/gl/test/gl_image_test_support.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ui/gfx/half_float.h" | 9 #include "ui/gfx/half_float.h" |
| 10 #include "ui/gl/gl_implementation.h" | 10 #include "ui/gl/gl_implementation.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const uint8_t color[4], | 53 const uint8_t color[4], |
| 54 uint8_t* data) { | 54 uint8_t* data) { |
| 55 switch (format) { | 55 switch (format) { |
| 56 case gfx::BufferFormat::R_8: | 56 case gfx::BufferFormat::R_8: |
| 57 case gfx::BufferFormat::RG_88: | 57 case gfx::BufferFormat::RG_88: |
| 58 DCHECK_EQ(0, plane); | 58 DCHECK_EQ(0, plane); |
| 59 for (int y = 0; y < height; ++y) { | 59 for (int y = 0; y < height; ++y) { |
| 60 memset(&data[y * stride], color[0], width); | 60 memset(&data[y * stride], color[0], width); |
| 61 } | 61 } |
| 62 return; | 62 return; |
| 63 case gfx::BufferFormat::R_16: |
| 64 DCHECK_EQ(0, plane); |
| 65 for (int y = 0; y < height; ++y) { |
| 66 uint16_t* row = reinterpret_cast<uint16_t*>(data + y * stride); |
| 67 for (int x = 0; x < width; ++x) { |
| 68 row[x] = static_cast<uint16_t>(color[0] << 8); |
| 69 } |
| 70 } |
| 71 return; |
| 63 case gfx::BufferFormat::BGR_565: | 72 case gfx::BufferFormat::BGR_565: |
| 64 DCHECK_EQ(0, plane); | 73 DCHECK_EQ(0, plane); |
| 65 for (int y = 0; y < height; ++y) { | 74 for (int y = 0; y < height; ++y) { |
| 66 for (int x = 0; x < width; ++x) { | 75 for (int x = 0; x < width; ++x) { |
| 67 *reinterpret_cast<uint16_t*>(&data[y * stride + x * 2]) = | 76 *reinterpret_cast<uint16_t*>(&data[y * stride + x * 2]) = |
| 68 ((color[2] >> 3) << 11) | ((color[1] >> 2) << 5) | | 77 ((color[2] >> 3) << 11) | ((color[1] >> 2) << 5) | |
| 69 (color[0] >> 3); | 78 (color[0] >> 3); |
| 70 } | 79 } |
| 71 } | 80 } |
| 72 return; | 81 return; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 case gfx::BufferFormat::ETC1: | 202 case gfx::BufferFormat::ETC1: |
| 194 case gfx::BufferFormat::RGBA_4444: | 203 case gfx::BufferFormat::RGBA_4444: |
| 195 case gfx::BufferFormat::UYVY_422: | 204 case gfx::BufferFormat::UYVY_422: |
| 196 NOTREACHED(); | 205 NOTREACHED(); |
| 197 return; | 206 return; |
| 198 } | 207 } |
| 199 NOTREACHED(); | 208 NOTREACHED(); |
| 200 } | 209 } |
| 201 | 210 |
| 202 } // namespace gl | 211 } // namespace gl |
| OLD | NEW |