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/output/gl_renderer.h" | 6 #include "cc/output/gl_renderer.h" |
7 #include "cc/quads/draw_quad.h" | 7 #include "cc/quads/draw_quad.h" |
8 #include "cc/quads/picture_draw_quad.h" | 8 #include "cc/quads/picture_draw_quad.h" |
9 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
10 #include "cc/resources/video_resource_updater.h" | 10 #include "cc/resources/video_resource_updater.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 SkColorGetB(texel_stripe_color)); | 123 SkColorGetB(texel_stripe_color)); |
124 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); | 124 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); |
125 for (int i = rect.height() / 4; i < (rect.height() * 3 / 4); ++i) { | 125 for (int i = rect.height() / 4; i < (rect.height() * 3 / 4); ++i) { |
126 for (int k = rect.width() / 4; k < (rect.width() * 3 / 4); ++k) { | 126 for (int k = rect.width() / 4; k < (rect.width() * 3 / 4); ++k) { |
127 pixels[i * rect.width() + k] = pixel_stripe_color; | 127 pixels[i * rect.width() + k] = pixel_stripe_color; |
128 } | 128 } |
129 } | 129 } |
130 ResourceId resource = resource_provider->CreateResource( | 130 ResourceId resource = resource_provider->CreateResource( |
131 rect.size(), GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 131 rect.size(), GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
132 RGBA_8888); | 132 RGBA_8888); |
133 resource_provider->SetPixels(resource, | 133 resource_provider->CopyToResource( |
134 reinterpret_cast<uint8_t*>(&pixels.front()), | 134 resource, reinterpret_cast<uint8_t*>(&pixels.front()), rect.size()); |
135 rect, rect, gfx::Vector2d()); | |
136 | 135 |
137 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 136 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
138 const gfx::PointF uv_top_left(0.0f, 0.0f); | 137 const gfx::PointF uv_top_left(0.0f, 0.0f); |
139 const gfx::PointF uv_bottom_right(1.0f, 1.0f); | 138 const gfx::PointF uv_bottom_right(1.0f, 1.0f); |
140 const bool flipped = false; | 139 const bool flipped = false; |
141 const bool nearest_neighbor = false; | 140 const bool nearest_neighbor = false; |
142 TextureDrawQuad* quad = | 141 TextureDrawQuad* quad = |
143 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 142 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
144 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, | 143 quad->SetNew(shared_state, rect, gfx::Rect(), rect, resource, |
145 premultiplied_alpha, uv_top_left, uv_bottom_right, | 144 premultiplied_alpha, uv_top_left, uv_bottom_right, |
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3043 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") | 3042 ? FILE_PATH_LITERAL("four_blue_green_checkers.png") |
3044 : FILE_PATH_LITERAL("checkers_big.png"); | 3043 : FILE_PATH_LITERAL("checkers_big.png"); |
3045 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), | 3044 EXPECT_TRUE(this->RunPixelTest(&pass_list, base::FilePath(path), |
3046 ExactPixelComparator(true))); | 3045 ExactPixelComparator(true))); |
3047 } | 3046 } |
3048 | 3047 |
3049 #endif // !defined(OS_ANDROID) | 3048 #endif // !defined(OS_ANDROID) |
3050 | 3049 |
3051 } // namespace | 3050 } // namespace |
3052 } // namespace cc | 3051 } // namespace cc |
OLD | NEW |