| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
| 7 #include "cc/output/gl_renderer.h" | 7 #include "cc/output/gl_renderer.h" |
| 8 #include "cc/quads/draw_quad.h" | 8 #include "cc/quads/draw_quad.h" |
| 9 #include "cc/quads/picture_draw_quad.h" | 9 #include "cc/quads/picture_draw_quad.h" |
| 10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 ResourceProvider* resource_provider) { | 105 ResourceProvider* resource_provider) { |
| 106 SkPMColor pixel_color = premultiplied_alpha ? | 106 SkPMColor pixel_color = premultiplied_alpha ? |
| 107 SkPreMultiplyColor(texel_color) : | 107 SkPreMultiplyColor(texel_color) : |
| 108 SkPackARGB32NoCheck(SkColorGetA(texel_color), | 108 SkPackARGB32NoCheck(SkColorGetA(texel_color), |
| 109 SkColorGetR(texel_color), | 109 SkColorGetR(texel_color), |
| 110 SkColorGetG(texel_color), | 110 SkColorGetG(texel_color), |
| 111 SkColorGetB(texel_color)); | 111 SkColorGetB(texel_color)); |
| 112 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); | 112 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); |
| 113 | 113 |
| 114 ResourceProvider::ResourceId resource = resource_provider->CreateResource( | 114 ResourceProvider::ResourceId resource = resource_provider->CreateResource( |
| 115 rect.size(), GL_RGBA, ResourceProvider::TextureUsageAny); | 115 rect.size(), GL_RGBA, GL_CLAMP_TO_EDGE, |
| 116 ResourceProvider::TextureUsageAny); |
| 116 resource_provider->SetPixels( | 117 resource_provider->SetPixels( |
| 117 resource, | 118 resource, |
| 118 reinterpret_cast<uint8_t*>(&pixels.front()), | 119 reinterpret_cast<uint8_t*>(&pixels.front()), |
| 119 rect, | 120 rect, |
| 120 rect, | 121 rect, |
| 121 gfx::Vector2d()); | 122 gfx::Vector2d()); |
| 122 | 123 |
| 123 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 124 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| 124 | 125 |
| 125 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); | 126 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create(); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 protected: | 403 protected: |
| 403 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( | 404 scoped_ptr<YUVVideoDrawQuad> CreateTestYUVVideoDrawQuad( |
| 404 SharedQuadState* shared_state, bool with_alpha, bool is_transparent) { | 405 SharedQuadState* shared_state, bool with_alpha, bool is_transparent) { |
| 405 gfx::Rect rect(this->device_viewport_size_); | 406 gfx::Rect rect(this->device_viewport_size_); |
| 406 gfx::Rect opaque_rect(0, 0, 0, 0); | 407 gfx::Rect opaque_rect(0, 0, 0, 0); |
| 407 | 408 |
| 408 ResourceProvider::ResourceId y_resource = | 409 ResourceProvider::ResourceId y_resource = |
| 409 resource_provider_->CreateResource( | 410 resource_provider_->CreateResource( |
| 410 this->device_viewport_size_, | 411 this->device_viewport_size_, |
| 411 GL_LUMINANCE, | 412 GL_LUMINANCE, |
| 413 GL_CLAMP_TO_EDGE, |
| 412 ResourceProvider::TextureUsageAny); | 414 ResourceProvider::TextureUsageAny); |
| 413 ResourceProvider::ResourceId u_resource = | 415 ResourceProvider::ResourceId u_resource = |
| 414 resource_provider_->CreateResource( | 416 resource_provider_->CreateResource( |
| 415 this->device_viewport_size_, | 417 this->device_viewport_size_, |
| 416 GL_LUMINANCE, | 418 GL_LUMINANCE, |
| 419 GL_CLAMP_TO_EDGE, |
| 417 ResourceProvider::TextureUsageAny); | 420 ResourceProvider::TextureUsageAny); |
| 418 ResourceProvider::ResourceId v_resource = | 421 ResourceProvider::ResourceId v_resource = |
| 419 resource_provider_->CreateResource( | 422 resource_provider_->CreateResource( |
| 420 this->device_viewport_size_, | 423 this->device_viewport_size_, |
| 421 GL_LUMINANCE, | 424 GL_LUMINANCE, |
| 425 GL_CLAMP_TO_EDGE, |
| 422 ResourceProvider::TextureUsageAny); | 426 ResourceProvider::TextureUsageAny); |
| 423 ResourceProvider::ResourceId a_resource = 0; | 427 ResourceProvider::ResourceId a_resource = 0; |
| 424 if (with_alpha) { | 428 if (with_alpha) { |
| 425 a_resource = resource_provider_->CreateResource( | 429 a_resource = resource_provider_->CreateResource( |
| 426 this->device_viewport_size_, | 430 this->device_viewport_size_, |
| 427 GL_LUMINANCE, | 431 GL_LUMINANCE, |
| 432 GL_CLAMP_TO_EDGE, |
| 428 ResourceProvider::TextureUsageAny); | 433 ResourceProvider::TextureUsageAny); |
| 429 } | 434 } |
| 430 | 435 |
| 431 int w = this->device_viewport_size_.width(); | 436 int w = this->device_viewport_size_.width(); |
| 432 int h = this->device_viewport_size_.height(); | 437 int h = this->device_viewport_size_.height(); |
| 433 const int y_plane_size = w * h; | 438 const int y_plane_size = w * h; |
| 434 gfx::Rect uv_rect((w + 1) / 2, (h + 1) / 2); | 439 gfx::Rect uv_rect((w + 1) / 2, (h + 1) / 2); |
| 435 const int uv_plane_size = uv_rect.size().GetArea(); | 440 const int uv_plane_size = uv_rect.size().GetArea(); |
| 436 scoped_ptr<uint8_t[]> y_plane(new uint8_t[y_plane_size]); | 441 scoped_ptr<uint8_t[]> y_plane(new uint8_t[y_plane_size]); |
| 437 scoped_ptr<uint8_t[]> u_plane(new uint8_t[uv_plane_size]); | 442 scoped_ptr<uint8_t[]> u_plane(new uint8_t[uv_plane_size]); |
| (...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1663 EXPECT_TRUE(this->RunPixelTest( | 1668 EXPECT_TRUE(this->RunPixelTest( |
| 1664 &pass_list, | 1669 &pass_list, |
| 1665 PixelTest::NoOffscreenContext, | 1670 PixelTest::NoOffscreenContext, |
| 1666 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), | 1671 base::FilePath(FILE_PATH_LITERAL("four_blue_green_checkers.png")), |
| 1667 ExactPixelComparator(true))); | 1672 ExactPixelComparator(true))); |
| 1668 } | 1673 } |
| 1669 #endif // !defined(OS_ANDROID) | 1674 #endif // !defined(OS_ANDROID) |
| 1670 | 1675 |
| 1671 } // namespace | 1676 } // namespace |
| 1672 } // namespace cc | 1677 } // namespace cc |
| OLD | NEW |