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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 SkPreMultiplyColor(texel_color) : | 122 SkPreMultiplyColor(texel_color) : |
123 SkPackARGB32NoCheck(SkColorGetA(texel_color), | 123 SkPackARGB32NoCheck(SkColorGetA(texel_color), |
124 SkColorGetR(texel_color), | 124 SkColorGetR(texel_color), |
125 SkColorGetG(texel_color), | 125 SkColorGetG(texel_color), |
126 SkColorGetB(texel_color)); | 126 SkColorGetB(texel_color)); |
127 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); | 127 std::vector<uint32_t> pixels(rect.size().GetArea(), pixel_color); |
128 | 128 |
129 ResourceProvider::ResourceId resource = | 129 ResourceProvider::ResourceId resource = |
130 resource_provider->CreateResource(rect.size(), | 130 resource_provider->CreateResource(rect.size(), |
131 GL_CLAMP_TO_EDGE, | 131 GL_CLAMP_TO_EDGE, |
132 ResourceProvider::TextureUsageAny, | 132 ResourceProvider::TextureHintImmutable, |
133 RGBA_8888); | 133 RGBA_8888); |
134 resource_provider->SetPixels( | 134 resource_provider->SetPixels( |
135 resource, | 135 resource, |
136 reinterpret_cast<uint8_t*>(&pixels.front()), | 136 reinterpret_cast<uint8_t*>(&pixels.front()), |
137 rect, | 137 rect, |
138 rect, | 138 rect, |
139 gfx::Vector2d()); | 139 gfx::Vector2d()); |
140 | 140 |
141 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 141 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
142 | 142 |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 canvas.drawRect( | 1210 canvas.drawRect( |
1211 SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()), | 1211 SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()), |
1212 paint); | 1212 paint); |
1213 rect.Inset(6, 6, 4, 4); | 1213 rect.Inset(6, 6, 4, 4); |
1214 } | 1214 } |
1215 | 1215 |
1216 ResourceProvider::ResourceId mask_resource_id = | 1216 ResourceProvider::ResourceId mask_resource_id = |
1217 this->resource_provider_->CreateResource( | 1217 this->resource_provider_->CreateResource( |
1218 mask_rect.size(), | 1218 mask_rect.size(), |
1219 GL_CLAMP_TO_EDGE, | 1219 GL_CLAMP_TO_EDGE, |
1220 ResourceProvider::TextureUsageAny, | 1220 ResourceProvider::TextureHintImmutable, |
1221 RGBA_8888); | 1221 RGBA_8888); |
1222 { | 1222 { |
1223 SkAutoLockPixels lock(bitmap); | 1223 SkAutoLockPixels lock(bitmap); |
1224 this->resource_provider_->SetPixels( | 1224 this->resource_provider_->SetPixels( |
1225 mask_resource_id, | 1225 mask_resource_id, |
1226 reinterpret_cast<uint8_t*>(bitmap.getPixels()), | 1226 reinterpret_cast<uint8_t*>(bitmap.getPixels()), |
1227 mask_rect, | 1227 mask_rect, |
1228 mask_rect, | 1228 mask_rect, |
1229 gfx::Vector2d()); | 1229 gfx::Vector2d()); |
1230 } | 1230 } |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 uint32_t pixels[16] = { | 2169 uint32_t pixels[16] = { |
2170 colors[0], colors[0], colors[1], colors[1], | 2170 colors[0], colors[0], colors[1], colors[1], |
2171 colors[0], colors[0], colors[1], colors[1], | 2171 colors[0], colors[0], colors[1], colors[1], |
2172 colors[2], colors[2], colors[3], colors[3], | 2172 colors[2], colors[2], colors[3], colors[3], |
2173 colors[2], colors[2], colors[3], colors[3], | 2173 colors[2], colors[2], colors[3], colors[3], |
2174 }; | 2174 }; |
2175 ResourceProvider::ResourceId resource = | 2175 ResourceProvider::ResourceId resource = |
2176 this->resource_provider_->CreateResource( | 2176 this->resource_provider_->CreateResource( |
2177 texture_rect.size(), | 2177 texture_rect.size(), |
2178 GL_REPEAT, | 2178 GL_REPEAT, |
2179 ResourceProvider::TextureUsageAny, | 2179 ResourceProvider::TextureHintImmutable, |
2180 RGBA_8888); | 2180 RGBA_8888); |
2181 this->resource_provider_->SetPixels( | 2181 this->resource_provider_->SetPixels( |
2182 resource, | 2182 resource, |
2183 reinterpret_cast<uint8_t*>(pixels), | 2183 reinterpret_cast<uint8_t*>(pixels), |
2184 texture_rect, | 2184 texture_rect, |
2185 texture_rect, | 2185 texture_rect, |
2186 gfx::Vector2d()); | 2186 gfx::Vector2d()); |
2187 | 2187 |
2188 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | 2188 float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; |
2189 TextureDrawQuad* texture_quad = | 2189 TextureDrawQuad* texture_quad = |
(...skipping 19 matching lines...) Expand all Loading... |
2209 EXPECT_TRUE(this->RunPixelTest( | 2209 EXPECT_TRUE(this->RunPixelTest( |
2210 &pass_list, | 2210 &pass_list, |
2211 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), | 2211 base::FilePath(FILE_PATH_LITERAL("wrap_mode_repeat.png")), |
2212 FuzzyPixelOffByOneComparator(true))); | 2212 FuzzyPixelOffByOneComparator(true))); |
2213 } | 2213 } |
2214 | 2214 |
2215 #endif // !defined(OS_ANDROID) | 2215 #endif // !defined(OS_ANDROID) |
2216 | 2216 |
2217 } // namespace | 2217 } // namespace |
2218 } // namespace cc | 2218 } // namespace cc |
OLD | NEW |