| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/gpu/WebGLImageConversion.h" | 5 #include "platform/graphics/gpu/WebGLImageConversion.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class WebGLImageConversionTest : public testing::Test { | 12 class WebGLImageConversionTest : public ::testing::Test { |
| 13 protected: | 13 protected: |
| 14 void UnpackPixels(const uint16_t* source_data, | 14 void UnpackPixels(const uint16_t* source_data, |
| 15 WebGLImageConversion::DataFormat source_data_format, | 15 WebGLImageConversion::DataFormat source_data_format, |
| 16 unsigned pixels_per_row, | 16 unsigned pixels_per_row, |
| 17 uint8_t* destination_data) { | 17 uint8_t* destination_data) { |
| 18 WebGLImageConversion::UnpackPixels(source_data, source_data_format, | 18 WebGLImageConversion::UnpackPixels(source_data, source_data_format, |
| 19 pixels_per_row, destination_data); | 19 pixels_per_row, destination_data); |
| 20 } | 20 } |
| 21 void PackPixels(const uint8_t* source_data, | 21 void PackPixels(const uint8_t* source_data, |
| 22 WebGLImageConversion::DataFormat source_data_format, | 22 WebGLImageConversion::DataFormat source_data_format, |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 uint16_t expected_data[10] = {0x32a6, 0x32a6, 0x32a6, 0x32a6, 0x32a6, | 164 uint16_t expected_data[10] = {0x32a6, 0x32a6, 0x32a6, 0x32a6, 0x32a6, |
| 165 0x32a6, 0x32a6, 0x32a6, 0x32a6, 0x32a6}; | 165 0x32a6, 0x32a6, 0x32a6, 0x32a6, 0x32a6}; |
| 166 uint16_t destination_data[10]; | 166 uint16_t destination_data[10]; |
| 167 PackPixels(source_data, WebGLImageConversion::kDataFormatRGB565, 10, | 167 PackPixels(source_data, WebGLImageConversion::kDataFormatRGB565, 10, |
| 168 reinterpret_cast<uint8_t*>(&destination_data[0])); | 168 reinterpret_cast<uint8_t*>(&destination_data[0])); |
| 169 EXPECT_EQ(0, | 169 EXPECT_EQ(0, |
| 170 memcmp(expected_data, destination_data, sizeof(destination_data))); | 170 memcmp(expected_data, destination_data, sizeof(destination_data))); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace blink | 173 } // namespace blink |
| OLD | NEW |