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 <stdio.h> | 5 #include <stdio.h> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include <GLES2/gl2.h> | 10 #include <GLES2/gl2.h> |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 gfx::Rect(src_size), | 994 gfx::Rect(src_size), |
995 pixels, | 995 pixels, |
996 bitmap_config); | 996 bitmap_config); |
997 } | 997 } |
998 } | 998 } |
999 | 999 |
1000 // Test basic format readback. | 1000 // Test basic format readback. |
1001 bool TestTextureFormatReadback(const gfx::Size& src_size, | 1001 bool TestTextureFormatReadback(const gfx::Size& src_size, |
1002 SkBitmap::Config bitmap_config, | 1002 SkBitmap::Config bitmap_config, |
1003 bool async) { | 1003 bool async) { |
1004 DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) || | 1004 if (!helper_->IsReadbackConfigSupported(bitmap_config)) { |
1005 (bitmap_config == SkBitmap::kARGB_8888_Config)); | 1005 LOG(INFO) << "Skipping test format not supported" << bitmap_config; |
1006 bool rgb565_format = (bitmap_config == SkBitmap::kRGB_565_Config); | |
1007 if (rgb565_format && !helper_->CanUseRgb565Readback()) { | |
1008 LOG(INFO) << "RGB565 Format Not supported on this platform"; | |
1009 LOG(INFO) << "Skipping RGB565ReadBackTest"; | |
1010 return true; | 1006 return true; |
1011 } | 1007 } |
1012 WebGLId src_texture = context_->createTexture(); | 1008 WebGLId src_texture = context_->createTexture(); |
1013 SkBitmap input_pixels; | 1009 SkBitmap input_pixels; |
1014 input_pixels.setConfig(bitmap_config, src_size.width(), | 1010 input_pixels.setConfig(bitmap_config, src_size.width(), |
1015 src_size.height()); | 1011 src_size.height()); |
1016 input_pixels.allocPixels(); | 1012 input_pixels.allocPixels(); |
1017 SkAutoLockPixels lock1(input_pixels); | 1013 SkAutoLockPixels lock1(input_pixels); |
1018 // Test Pattern-1, Fill with Plain color pattern. | 1014 // Test Pattern-1, Fill with Plain color pattern. |
1019 // Erase the input bitmap with red color. | 1015 // Erase the input bitmap with red color. |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 #endif | 1671 #endif |
1676 #if defined(TOOLKIT_GTK) | 1672 #if defined(TOOLKIT_GTK) |
1677 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); | 1673 gfx::GtkInitFromCommandLine(*CommandLine::ForCurrentProcess()); |
1678 #endif | 1674 #endif |
1679 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); | 1675 gpu::ApplyGpuDriverBugWorkarounds(CommandLine::ForCurrentProcess()); |
1680 | 1676 |
1681 content::UnitTestTestSuite runner(suite); | 1677 content::UnitTestTestSuite runner(suite); |
1682 base::MessageLoop message_loop; | 1678 base::MessageLoop message_loop; |
1683 return runner.Run(); | 1679 return runner.Run(); |
1684 } | 1680 } |
OLD | NEW |