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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <string> | 10 #include <string> |
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 break; | 695 break; |
696 case 2: // Medium blocks | 696 case 2: // Medium blocks |
697 SetChannel(bitmap.get(), x, y, 0, 10 + x / 2 * 50); | 697 SetChannel(bitmap.get(), x, y, 0, 10 + x / 2 * 50); |
698 SetChannel(bitmap.get(), x, y, 1, 10 + y / 3 * 50); | 698 SetChannel(bitmap.get(), x, y, 1, 10 + y / 3 * 50); |
699 SetChannel(bitmap.get(), x, y, 2, (x + y) / 5 * 50 + 5); | 699 SetChannel(bitmap.get(), x, y, 2, (x + y) / 5 * 50 + 5); |
700 SetChannel(bitmap.get(), x, y, 3, 255); | 700 SetChannel(bitmap.get(), x, y, 3, 255); |
701 break; | 701 break; |
702 } | 702 } |
703 } | 703 } |
704 } | 704 } |
705 return bitmap.Pass(); | 705 return bitmap; |
706 } | 706 } |
707 | 707 |
708 // Binds texture and framebuffer and loads the bitmap pixels into the texture. | 708 // Binds texture and framebuffer and loads the bitmap pixels into the texture. |
709 void BindTextureAndFrameBuffer(WebGLId texture, | 709 void BindTextureAndFrameBuffer(WebGLId texture, |
710 WebGLId framebuffer, | 710 WebGLId framebuffer, |
711 SkBitmap* bitmap, | 711 SkBitmap* bitmap, |
712 int width, | 712 int width, |
713 int height) { | 713 int height) { |
714 context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer); | 714 context_->bindFramebuffer(GL_FRAMEBUFFER, framebuffer); |
715 context_->bindTexture(GL_TEXTURE_2D, texture); | 715 context_->bindTexture(GL_TEXTURE_2D, texture); |
(...skipping 18 matching lines...) Expand all Loading... |
734 int test_pattern, | 734 int test_pattern, |
735 SkColorType out_color_type, | 735 SkColorType out_color_type, |
736 bool swizzle, | 736 bool swizzle, |
737 size_t quality_index) { | 737 size_t quality_index) { |
738 DCHECK(out_color_type == kAlpha_8_SkColorType || | 738 DCHECK(out_color_type == kAlpha_8_SkColorType || |
739 out_color_type == kRGBA_8888_SkColorType || | 739 out_color_type == kRGBA_8888_SkColorType || |
740 out_color_type == kBGRA_8888_SkColorType); | 740 out_color_type == kBGRA_8888_SkColorType); |
741 WebGLId src_texture = context_->createTexture(); | 741 WebGLId src_texture = context_->createTexture(); |
742 WebGLId framebuffer = context_->createFramebuffer(); | 742 WebGLId framebuffer = context_->createFramebuffer(); |
743 scoped_ptr<SkBitmap> input_pixels = | 743 scoped_ptr<SkBitmap> input_pixels = |
744 CreateTestBitmap(xsize, ysize, test_pattern).Pass(); | 744 CreateTestBitmap(xsize, ysize, test_pattern); |
745 BindTextureAndFrameBuffer( | 745 BindTextureAndFrameBuffer( |
746 src_texture, framebuffer, input_pixels.get(), xsize, ysize); | 746 src_texture, framebuffer, input_pixels.get(), xsize, ysize); |
747 | 747 |
748 std::string message = base::StringPrintf( | 748 std::string message = base::StringPrintf( |
749 "input size: %dx%d " | 749 "input size: %dx%d " |
750 "output size: %dx%d " | 750 "output size: %dx%d " |
751 "pattern: %d , quality: %s, " | 751 "pattern: %d , quality: %s, " |
752 "out_color_type: %d", | 752 "out_color_type: %d", |
753 xsize, | 753 xsize, |
754 ysize, | 754 ysize, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 void TestScale(int xsize, | 828 void TestScale(int xsize, |
829 int ysize, | 829 int ysize, |
830 int scaled_xsize, | 830 int scaled_xsize, |
831 int scaled_ysize, | 831 int scaled_ysize, |
832 int test_pattern, | 832 int test_pattern, |
833 size_t quality_index, | 833 size_t quality_index, |
834 bool flip) { | 834 bool flip) { |
835 WebGLId src_texture = context_->createTexture(); | 835 WebGLId src_texture = context_->createTexture(); |
836 WebGLId framebuffer = context_->createFramebuffer(); | 836 WebGLId framebuffer = context_->createFramebuffer(); |
837 scoped_ptr<SkBitmap> input_pixels = | 837 scoped_ptr<SkBitmap> input_pixels = |
838 CreateTestBitmap(xsize, ysize, test_pattern).Pass(); | 838 CreateTestBitmap(xsize, ysize, test_pattern); |
839 BindTextureAndFrameBuffer( | 839 BindTextureAndFrameBuffer( |
840 src_texture, framebuffer, input_pixels.get(), xsize, ysize); | 840 src_texture, framebuffer, input_pixels.get(), xsize, ysize); |
841 | 841 |
842 std::string message = base::StringPrintf( | 842 std::string message = base::StringPrintf( |
843 "input size: %dx%d " | 843 "input size: %dx%d " |
844 "output size: %dx%d " | 844 "output size: %dx%d " |
845 "pattern: %d quality: %s", | 845 "pattern: %d quality: %s", |
846 xsize, | 846 xsize, |
847 ysize, | 847 ysize, |
848 scaled_xsize, | 848 scaled_xsize, |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); | 2003 base::TestSuite* suite = new content::ContentTestSuite(argc, argv); |
2004 #if defined(OS_MACOSX) | 2004 #if defined(OS_MACOSX) |
2005 base::mac::ScopedNSAutoreleasePool pool; | 2005 base::mac::ScopedNSAutoreleasePool pool; |
2006 #endif | 2006 #endif |
2007 | 2007 |
2008 return base::LaunchUnitTestsSerially( | 2008 return base::LaunchUnitTestsSerially( |
2009 argc, | 2009 argc, |
2010 argv, | 2010 argv, |
2011 base::Bind(&RunHelper, base::Unretained(suite))); | 2011 base::Bind(&RunHelper, base::Unretained(suite))); |
2012 } | 2012 } |
OLD | NEW |