| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 flip, | 646 flip, |
| 647 kQualities[quality]); | 647 kQualities[quality]); |
| 648 | 648 |
| 649 SkBitmap output_pixels; | 649 SkBitmap output_pixels; |
| 650 output_pixels.allocN32Pixels(scaled_xsize, scaled_ysize); | 650 output_pixels.allocN32Pixels(scaled_xsize, scaled_ysize); |
| 651 | 651 |
| 652 helper_->ReadbackTextureSync( | 652 helper_->ReadbackTextureSync( |
| 653 dst_texture, | 653 dst_texture, |
| 654 gfx::Rect(0, 0, scaled_xsize, scaled_ysize), | 654 gfx::Rect(0, 0, scaled_xsize, scaled_ysize), |
| 655 static_cast<unsigned char*>(output_pixels.getPixels()), | 655 static_cast<unsigned char*>(output_pixels.getPixels()), |
| 656 SkBitmap::kARGB_8888_Config); | 656 kN32_SkColorType); |
| 657 if (flip) { | 657 if (flip) { |
| 658 // Flip the pixels back. | 658 // Flip the pixels back. |
| 659 FlipSKBitmap(&output_pixels); | 659 FlipSKBitmap(&output_pixels); |
| 660 } | 660 } |
| 661 if (xsize == scaled_xsize && ysize == scaled_ysize) { | 661 if (xsize == scaled_xsize && ysize == scaled_ysize) { |
| 662 Compare(&input_pixels, | 662 Compare(&input_pixels, |
| 663 &output_pixels, | 663 &output_pixels, |
| 664 2, | 664 2, |
| 665 NULL, | 665 NULL, |
| 666 stages, | 666 stages, |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 ASSERT_GT(grid_pitch, 0); | 838 ASSERT_GT(grid_pitch, 0); |
| 839 ASSERT_GT(grid_width, 0); | 839 ASSERT_GT(grid_width, 0); |
| 840 ASSERT_NE(background_color, grid_color); | 840 ASSERT_NE(background_color, grid_color); |
| 841 | 841 |
| 842 for (int y = 0; y < h; ++y) { | 842 for (int y = 0; y < h; ++y) { |
| 843 bool y_on_grid = ((y % grid_pitch) < grid_width); | 843 bool y_on_grid = ((y % grid_pitch) < grid_width); |
| 844 | 844 |
| 845 for (int x = 0; x < w; ++x) { | 845 for (int x = 0; x < w; ++x) { |
| 846 bool on_grid = (y_on_grid || ((x % grid_pitch) < grid_width)); | 846 bool on_grid = (y_on_grid || ((x % grid_pitch) < grid_width)); |
| 847 | 847 |
| 848 if (bmp.config() == SkBitmap::kARGB_8888_Config) { | 848 if (bmp.colorType() == kN32_SkColorType) { |
| 849 *bmp.getAddr32(x, y) = (on_grid ? grid_color : background_color); | 849 *bmp.getAddr32(x, y) = (on_grid ? grid_color : background_color); |
| 850 } else if (bmp.config() == SkBitmap::kRGB_565_Config) { | 850 } else if (bmp.colorType() == kRGB_565_SkColorType) { |
| 851 *bmp.getAddr16(x, y) = (on_grid ? grid_color : background_color); | 851 *bmp.getAddr16(x, y) = (on_grid ? grid_color : background_color); |
| 852 } | 852 } |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 } | 855 } |
| 856 | 856 |
| 857 void DrawCheckerToBitmap(int w, int h, | 857 void DrawCheckerToBitmap(int w, int h, |
| 858 SkColor color1, SkColor color2, | 858 SkColor color1, SkColor color2, |
| 859 int rect_w, int rect_h, | 859 int rect_w, int rect_h, |
| 860 SkBitmap& bmp) { | 860 SkBitmap& bmp) { |
| 861 ASSERT_GT(rect_w, 0); | 861 ASSERT_GT(rect_w, 0); |
| 862 ASSERT_GT(rect_h, 0); | 862 ASSERT_GT(rect_h, 0); |
| 863 ASSERT_NE(color1, color2); | 863 ASSERT_NE(color1, color2); |
| 864 | 864 |
| 865 for (int y = 0; y < h; ++y) { | 865 for (int y = 0; y < h; ++y) { |
| 866 bool y_bit = (((y / rect_h) & 0x1) == 0); | 866 bool y_bit = (((y / rect_h) & 0x1) == 0); |
| 867 | 867 |
| 868 for (int x = 0; x < w; ++x) { | 868 for (int x = 0; x < w; ++x) { |
| 869 bool x_bit = (((x / rect_w) & 0x1) == 0); | 869 bool x_bit = (((x / rect_w) & 0x1) == 0); |
| 870 | 870 |
| 871 bool use_color2 = (x_bit != y_bit); // xor | 871 bool use_color2 = (x_bit != y_bit); // xor |
| 872 if (bmp.config() == SkBitmap::kARGB_8888_Config) { | 872 if (bmp.colorType() == kN32_SkColorType) { |
| 873 *bmp.getAddr32(x, y) = (use_color2 ? color2 : color1); | 873 *bmp.getAddr32(x, y) = (use_color2 ? color2 : color1); |
| 874 } else if (bmp.config() == SkBitmap::kRGB_565_Config) { | 874 } else if (bmp.colorType() == kRGB_565_SkColorType) { |
| 875 *bmp.getAddr16(x, y) = (use_color2 ? color2 : color1); | 875 *bmp.getAddr16(x, y) = (use_color2 ? color2 : color1); |
| 876 } | 876 } |
| 877 } | 877 } |
| 878 } | 878 } |
| 879 } | 879 } |
| 880 | 880 |
| 881 bool ColorComponentsClose(SkColor component1, | 881 bool ColorComponentsClose(SkColor component1, |
| 882 SkColor component2, | 882 SkColor component2, |
| 883 SkBitmap::Config config) { | 883 SkColorType color_type) { |
| 884 int c1 = static_cast<int>(component1); | 884 int c1 = static_cast<int>(component1); |
| 885 int c2 = static_cast<int>(component2); | 885 int c2 = static_cast<int>(component2); |
| 886 bool result = false; | 886 bool result = false; |
| 887 switch (config) { | 887 switch (color_type) { |
| 888 case SkBitmap::kARGB_8888_Config: | 888 case kN32_SkColorType: |
| 889 result = (std::abs(c1 - c2) == 0); | 889 result = (std::abs(c1 - c2) == 0); |
| 890 break; | 890 break; |
| 891 case SkBitmap::kRGB_565_Config: | 891 case kRGB_565_SkColorType: |
| 892 result = (std::abs(c1 - c2) <= 7); | 892 result = (std::abs(c1 - c2) <= 7); |
| 893 break; | 893 break; |
| 894 default: | 894 default: |
| 895 break; | 895 break; |
| 896 } | 896 } |
| 897 return result; | 897 return result; |
| 898 } | 898 } |
| 899 | 899 |
| 900 bool ColorsClose(SkColor color1, SkColor color2, SkBitmap::Config config) { | 900 bool ColorsClose(SkColor color1, SkColor color2, SkColorType color_type) { |
| 901 bool red = ColorComponentsClose(SkColorGetR(color1), | 901 bool red = ColorComponentsClose(SkColorGetR(color1), |
| 902 SkColorGetR(color2), config); | 902 SkColorGetR(color2), color_type); |
| 903 bool green = ColorComponentsClose(SkColorGetG(color1), | 903 bool green = ColorComponentsClose(SkColorGetG(color1), |
| 904 SkColorGetG(color2), config); | 904 SkColorGetG(color2), color_type); |
| 905 bool blue = ColorComponentsClose(SkColorGetB(color1), | 905 bool blue = ColorComponentsClose(SkColorGetB(color1), |
| 906 SkColorGetB(color2), config); | 906 SkColorGetB(color2), color_type); |
| 907 bool alpha = ColorComponentsClose(SkColorGetA(color1), | 907 bool alpha = ColorComponentsClose(SkColorGetA(color1), |
| 908 SkColorGetA(color2), config); | 908 SkColorGetA(color2), color_type); |
| 909 if (config == SkBitmap::kRGB_565_Config) { | 909 if (color_type == kRGB_565_SkColorType) { |
| 910 return red && blue && green; | 910 return red && blue && green; |
| 911 } | 911 } |
| 912 return red && blue && green && alpha; | 912 return red && blue && green && alpha; |
| 913 } | 913 } |
| 914 | 914 |
| 915 bool IsEqual(const SkBitmap& bmp1, const SkBitmap& bmp2) { | 915 bool IsEqual(const SkBitmap& bmp1, const SkBitmap& bmp2) { |
| 916 if (bmp1.isNull() && bmp2.isNull()) | 916 if (bmp1.isNull() && bmp2.isNull()) |
| 917 return true; | 917 return true; |
| 918 if (bmp1.width() != bmp2.width() || | 918 if (bmp1.width() != bmp2.width() || |
| 919 bmp1.height() != bmp2.height()) { | 919 bmp1.height() != bmp2.height()) { |
| 920 LOG(ERROR) << "Bitmap geometry check failure"; | 920 LOG(ERROR) << "Bitmap geometry check failure"; |
| 921 return false; | 921 return false; |
| 922 } | 922 } |
| 923 if (bmp1.config() != bmp2.config()) | 923 if (bmp1.colorType() != bmp2.colorType()) |
| 924 return false; | 924 return false; |
| 925 | 925 |
| 926 SkAutoLockPixels lock1(bmp1); | 926 SkAutoLockPixels lock1(bmp1); |
| 927 SkAutoLockPixels lock2(bmp2); | 927 SkAutoLockPixels lock2(bmp2); |
| 928 if (!bmp1.getPixels() || !bmp2.getPixels()) { | 928 if (!bmp1.getPixels() || !bmp2.getPixels()) { |
| 929 LOG(ERROR) << "Empty Bitmap!"; | 929 LOG(ERROR) << "Empty Bitmap!"; |
| 930 return false; | 930 return false; |
| 931 } | 931 } |
| 932 for (int y = 0; y < bmp1.height(); ++y) { | 932 for (int y = 0; y < bmp1.height(); ++y) { |
| 933 for (int x = 0; x < bmp1.width(); ++x) { | 933 for (int x = 0; x < bmp1.width(); ++x) { |
| 934 if (!ColorsClose(bmp1.getColor(x,y), | 934 if (!ColorsClose(bmp1.getColor(x,y), |
| 935 bmp2.getColor(x,y), | 935 bmp2.getColor(x,y), |
| 936 bmp1.config())) { | 936 bmp1.colorType())) { |
| 937 LOG(ERROR) << "Bitmap color comparision failure"; | 937 LOG(ERROR) << "Bitmap color comparision failure"; |
| 938 return false; | 938 return false; |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 } | 941 } |
| 942 return true; | 942 return true; |
| 943 } | 943 } |
| 944 | 944 |
| 945 void BindAndAttachTextureWithPixels(GLuint src_texture, | 945 void BindAndAttachTextureWithPixels(GLuint src_texture, |
| 946 SkBitmap::Config bitmap_config, | 946 SkColorType color_type, |
| 947 const gfx::Size& src_size, | 947 const gfx::Size& src_size, |
| 948 const SkBitmap& input_pixels) { | 948 const SkBitmap& input_pixels) { |
| 949 context_->bindTexture(GL_TEXTURE_2D, src_texture); | 949 context_->bindTexture(GL_TEXTURE_2D, src_texture); |
| 950 GLenum format = (bitmap_config == SkBitmap::kRGB_565_Config) ? | 950 GLenum format = (color_type == kRGB_565_SkColorType) ? |
| 951 GL_RGB : GL_RGBA; | 951 GL_RGB : GL_RGBA; |
| 952 GLenum type = (bitmap_config == SkBitmap::kRGB_565_Config) ? | 952 GLenum type = (color_type == kRGB_565_SkColorType) ? |
| 953 GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE; | 953 GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE; |
| 954 context_->texImage2D(GL_TEXTURE_2D, | 954 context_->texImage2D(GL_TEXTURE_2D, |
| 955 0, | 955 0, |
| 956 format, | 956 format, |
| 957 src_size.width(), | 957 src_size.width(), |
| 958 src_size.height(), | 958 src_size.height(), |
| 959 0, | 959 0, |
| 960 format, | 960 format, |
| 961 type, | 961 type, |
| 962 input_pixels.getPixels()); | 962 input_pixels.getPixels()); |
| 963 } | 963 } |
| 964 | 964 |
| 965 void ReadBackTexture(GLuint src_texture, | 965 void ReadBackTexture(GLuint src_texture, |
| 966 const gfx::Size& src_size, | 966 const gfx::Size& src_size, |
| 967 unsigned char* pixels, | 967 unsigned char* pixels, |
| 968 SkBitmap::Config bitmap_config, | 968 SkColorType color_type, |
| 969 bool async) { | 969 bool async) { |
| 970 if (async) { | 970 if (async) { |
| 971 base::RunLoop run_loop; | 971 base::RunLoop run_loop; |
| 972 helper_->ReadbackTextureAsync(src_texture, | 972 helper_->ReadbackTextureAsync(src_texture, |
| 973 src_size, | 973 src_size, |
| 974 pixels, | 974 pixels, |
| 975 bitmap_config, | 975 color_type, |
| 976 base::Bind(&callcallback, | 976 base::Bind(&callcallback, |
| 977 run_loop.QuitClosure())); | 977 run_loop.QuitClosure())); |
| 978 run_loop.Run(); | 978 run_loop.Run(); |
| 979 } else { | 979 } else { |
| 980 helper_->ReadbackTextureSync(src_texture, | 980 helper_->ReadbackTextureSync(src_texture, |
| 981 gfx::Rect(src_size), | 981 gfx::Rect(src_size), |
| 982 pixels, | 982 pixels, |
| 983 bitmap_config); | 983 color_type); |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 | 986 |
| 987 // Test basic format readback. | 987 // Test basic format readback. |
| 988 bool TestTextureFormatReadback(const gfx::Size& src_size, | 988 bool TestTextureFormatReadback(const gfx::Size& src_size, |
| 989 SkBitmap::Config bitmap_config, | 989 SkColorType color_type, |
| 990 bool async) { | 990 bool async) { |
| 991 SkImageInfo info = | 991 SkImageInfo info = |
| 992 SkImageInfo::Make(src_size.width(), | 992 SkImageInfo::Make(src_size.width(), |
| 993 src_size.height(), | 993 src_size.height(), |
| 994 SkBitmapConfigToColorType(bitmap_config), | 994 color_type, |
| 995 kPremul_SkAlphaType); | 995 kPremul_SkAlphaType); |
| 996 if (!helper_->IsReadbackConfigSupported(bitmap_config)) { | 996 if (!helper_->IsReadbackConfigSupported(color_type)) { |
| 997 LOG(INFO) << "Skipping test format not supported" << bitmap_config; | 997 LOG(INFO) << "Skipping test format not supported" << color_type; |
| 998 return true; | 998 return true; |
| 999 } | 999 } |
| 1000 WebGLId src_texture = context_->createTexture(); | 1000 WebGLId src_texture = context_->createTexture(); |
| 1001 SkBitmap input_pixels; | 1001 SkBitmap input_pixels; |
| 1002 input_pixels.allocPixels(info); | 1002 input_pixels.allocPixels(info); |
| 1003 // Test Pattern-1, Fill with Plain color pattern. | 1003 // Test Pattern-1, Fill with Plain color pattern. |
| 1004 // Erase the input bitmap with red color. | 1004 // Erase the input bitmap with red color. |
| 1005 input_pixels.eraseColor(SK_ColorRED); | 1005 input_pixels.eraseColor(SK_ColorRED); |
| 1006 BindAndAttachTextureWithPixels(src_texture, | 1006 BindAndAttachTextureWithPixels(src_texture, |
| 1007 bitmap_config, | 1007 color_type, |
| 1008 src_size, | 1008 src_size, |
| 1009 input_pixels); | 1009 input_pixels); |
| 1010 SkBitmap output_pixels; | 1010 SkBitmap output_pixels; |
| 1011 output_pixels.allocPixels(info); | 1011 output_pixels.allocPixels(info); |
| 1012 // Initialize the output bitmap with Green color. | 1012 // Initialize the output bitmap with Green color. |
| 1013 // When the readback is over output bitmap should have the red color. | 1013 // When the readback is over output bitmap should have the red color. |
| 1014 output_pixels.eraseColor(SK_ColorGREEN); | 1014 output_pixels.eraseColor(SK_ColorGREEN); |
| 1015 uint8* pixels = static_cast<uint8*>(output_pixels.getPixels()); | 1015 uint8* pixels = static_cast<uint8*>(output_pixels.getPixels()); |
| 1016 ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); | 1016 ReadBackTexture(src_texture, src_size, pixels, color_type, async); |
| 1017 bool result = IsEqual(input_pixels, output_pixels); | 1017 bool result = IsEqual(input_pixels, output_pixels); |
| 1018 if (!result) { | 1018 if (!result) { |
| 1019 LOG(ERROR) << "Bitmap comparision failure Pattern-1"; | 1019 LOG(ERROR) << "Bitmap comparision failure Pattern-1"; |
| 1020 return false; | 1020 return false; |
| 1021 } | 1021 } |
| 1022 const int rect_w = 10, rect_h = 4, src_grid_pitch = 10, src_grid_width = 4; | 1022 const int rect_w = 10, rect_h = 4, src_grid_pitch = 10, src_grid_width = 4; |
| 1023 const SkColor color1 = SK_ColorRED, color2 = SK_ColorBLUE; | 1023 const SkColor color1 = SK_ColorRED, color2 = SK_ColorBLUE; |
| 1024 // Test Pattern-2, Fill with Grid Pattern. | 1024 // Test Pattern-2, Fill with Grid Pattern. |
| 1025 DrawGridToBitmap(src_size.width(), src_size.height(), | 1025 DrawGridToBitmap(src_size.width(), src_size.height(), |
| 1026 color2, color1, | 1026 color2, color1, |
| 1027 src_grid_pitch, src_grid_width, | 1027 src_grid_pitch, src_grid_width, |
| 1028 input_pixels); | 1028 input_pixels); |
| 1029 BindAndAttachTextureWithPixels(src_texture, | 1029 BindAndAttachTextureWithPixels(src_texture, |
| 1030 bitmap_config, | 1030 color_type, |
| 1031 src_size, | 1031 src_size, |
| 1032 input_pixels); | 1032 input_pixels); |
| 1033 ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); | 1033 ReadBackTexture(src_texture, src_size, pixels, color_type, async); |
| 1034 result = IsEqual(input_pixels, output_pixels); | 1034 result = IsEqual(input_pixels, output_pixels); |
| 1035 if (!result) { | 1035 if (!result) { |
| 1036 LOG(ERROR) << "Bitmap comparision failure Pattern-2"; | 1036 LOG(ERROR) << "Bitmap comparision failure Pattern-2"; |
| 1037 return false; | 1037 return false; |
| 1038 } | 1038 } |
| 1039 // Test Pattern-3, Fill with CheckerBoard Pattern. | 1039 // Test Pattern-3, Fill with CheckerBoard Pattern. |
| 1040 DrawCheckerToBitmap(src_size.width(), | 1040 DrawCheckerToBitmap(src_size.width(), |
| 1041 src_size.height(), | 1041 src_size.height(), |
| 1042 color1, | 1042 color1, |
| 1043 color2, rect_w, rect_h, input_pixels); | 1043 color2, rect_w, rect_h, input_pixels); |
| 1044 BindAndAttachTextureWithPixels(src_texture, | 1044 BindAndAttachTextureWithPixels(src_texture, |
| 1045 bitmap_config, | 1045 color_type, |
| 1046 src_size, | 1046 src_size, |
| 1047 input_pixels); | 1047 input_pixels); |
| 1048 ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); | 1048 ReadBackTexture(src_texture, src_size, pixels, color_type, async); |
| 1049 result = IsEqual(input_pixels, output_pixels); | 1049 result = IsEqual(input_pixels, output_pixels); |
| 1050 if (!result) { | 1050 if (!result) { |
| 1051 LOG(ERROR) << "Bitmap comparision failure Pattern-3"; | 1051 LOG(ERROR) << "Bitmap comparision failure Pattern-3"; |
| 1052 return false; | 1052 return false; |
| 1053 } | 1053 } |
| 1054 context_->deleteTexture(src_texture); | 1054 context_->deleteTexture(src_texture); |
| 1055 if (HasFailure()) { | 1055 if (HasFailure()) { |
| 1056 return false; | 1056 return false; |
| 1057 } | 1057 } |
| 1058 return true; | 1058 return true; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 }; | 1432 }; |
| 1433 | 1433 |
| 1434 class GLHelperPixelTest : public GLHelperTest { | 1434 class GLHelperPixelTest : public GLHelperTest { |
| 1435 private: | 1435 private: |
| 1436 gfx::DisableNullDrawGLBindings enable_pixel_output_; | 1436 gfx::DisableNullDrawGLBindings enable_pixel_output_; |
| 1437 }; | 1437 }; |
| 1438 | 1438 |
| 1439 TEST_F(GLHelperTest, ARGBSyncReadbackTest) { | 1439 TEST_F(GLHelperTest, ARGBSyncReadbackTest) { |
| 1440 const int kTestSize = 64; | 1440 const int kTestSize = 64; |
| 1441 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), | 1441 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), |
| 1442 SkBitmap::kARGB_8888_Config, | 1442 kN32_SkColorType, |
| 1443 false); | 1443 false); |
| 1444 EXPECT_EQ(result, true); | 1444 EXPECT_EQ(result, true); |
| 1445 } | 1445 } |
| 1446 | 1446 |
| 1447 TEST_F(GLHelperTest, RGB565SyncReadbackTest) { | 1447 TEST_F(GLHelperTest, RGB565SyncReadbackTest) { |
| 1448 const int kTestSize = 64; | 1448 const int kTestSize = 64; |
| 1449 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), | 1449 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), |
| 1450 SkBitmap::kRGB_565_Config, | 1450 kRGB_565_SkColorType, |
| 1451 false); | 1451 false); |
| 1452 EXPECT_EQ(result, true); | 1452 EXPECT_EQ(result, true); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 TEST_F(GLHelperTest, ARGBASyncReadbackTest) { | 1455 TEST_F(GLHelperTest, ARGBASyncReadbackTest) { |
| 1456 const int kTestSize = 64; | 1456 const int kTestSize = 64; |
| 1457 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), | 1457 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), |
| 1458 SkBitmap::kARGB_8888_Config, | 1458 kN32_SkColorType, |
| 1459 true); | 1459 true); |
| 1460 EXPECT_EQ(result, true); | 1460 EXPECT_EQ(result, true); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 TEST_F(GLHelperTest, RGB565ASyncReadbackTest) { | 1463 TEST_F(GLHelperTest, RGB565ASyncReadbackTest) { |
| 1464 const int kTestSize = 64; | 1464 const int kTestSize = 64; |
| 1465 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), | 1465 bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), |
| 1466 SkBitmap::kRGB_565_Config, | 1466 kRGB_565_SkColorType, |
| 1467 true); | 1467 true); |
| 1468 EXPECT_EQ(result, true); | 1468 EXPECT_EQ(result, true); |
| 1469 } | 1469 } |
| 1470 | 1470 |
| 1471 TEST_F(GLHelperPixelTest, YUVReadbackOptTest) { | 1471 TEST_F(GLHelperPixelTest, YUVReadbackOptTest) { |
| 1472 // This test uses the cb_command tracing events to detect how many | 1472 // This test uses the cb_command tracing events to detect how many |
| 1473 // scaling passes are actually performed by the YUV readback pipeline. | 1473 // scaling passes are actually performed by the YUV readback pipeline. |
| 1474 StartTracing(TRACE_DISABLED_BY_DEFAULT("cb_command")); | 1474 StartTracing(TRACE_DISABLED_BY_DEFAULT("cb_command")); |
| 1475 | 1475 |
| 1476 TestYUVReadback(800, | 1476 TestYUVReadback(800, |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 CommandLine::Init(argc, argv); | 1651 CommandLine::Init(argc, argv); |
| 1652 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); | 1652 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); |
| 1653 #if defined(OS_MACOSX) | 1653 #if defined(OS_MACOSX) |
| 1654 base::mac::ScopedNSAutoreleasePool pool; | 1654 base::mac::ScopedNSAutoreleasePool pool; |
| 1655 #endif | 1655 #endif |
| 1656 | 1656 |
| 1657 content::UnitTestTestSuite runner(suite); | 1657 content::UnitTestTestSuite runner(suite); |
| 1658 base::MessageLoop message_loop; | 1658 base::MessageLoop message_loop; |
| 1659 return runner.Run(); | 1659 return runner.Run(); |
| 1660 } | 1660 } |
| OLD | NEW |