| 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 "cc/layers/nine_patch_layer_impl.h" | 5 #include "cc/layers/nine_patch_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 visible_rect = | 218 visible_rect = |
| 219 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 219 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 220 layer_top_left); | 220 layer_top_left); |
| 221 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 221 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 222 if (!visible_rect.IsEmpty()) { | 222 if (!visible_rect.IsEmpty()) { |
| 223 TextureDrawQuad* quad = | 223 TextureDrawQuad* quad = |
| 224 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 224 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 225 quad->SetNew(shared_quad_state, layer_top_left, opaque_rect, visible_rect, | 225 quad->SetNew(shared_quad_state, layer_top_left, opaque_rect, visible_rect, |
| 226 resource, premultiplied_alpha, uv_top_left.origin(), | 226 resource, premultiplied_alpha, uv_top_left.origin(), |
| 227 uv_top_left.bottom_right(), SK_ColorTRANSPARENT, | 227 uv_top_left.bottom_right(), SK_ColorTRANSPARENT, |
| 228 vertex_opacity, flipped, nearest_neighbor_); | 228 vertex_opacity, flipped, nearest_neighbor_, false); |
| 229 ValidateQuadResources(quad); | 229 ValidateQuadResources(quad); |
| 230 } | 230 } |
| 231 | 231 |
| 232 visible_rect = | 232 visible_rect = |
| 233 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 233 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 234 layer_top_right); | 234 layer_top_right); |
| 235 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 235 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 236 if (!visible_rect.IsEmpty()) { | 236 if (!visible_rect.IsEmpty()) { |
| 237 TextureDrawQuad* quad = | 237 TextureDrawQuad* quad = |
| 238 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 238 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 239 quad->SetNew(shared_quad_state, layer_top_right, opaque_rect, visible_rect, | 239 quad->SetNew(shared_quad_state, layer_top_right, opaque_rect, visible_rect, |
| 240 resource, premultiplied_alpha, uv_top_right.origin(), | 240 resource, premultiplied_alpha, uv_top_right.origin(), |
| 241 uv_top_right.bottom_right(), SK_ColorTRANSPARENT, | 241 uv_top_right.bottom_right(), SK_ColorTRANSPARENT, |
| 242 vertex_opacity, flipped, nearest_neighbor_); | 242 vertex_opacity, flipped, nearest_neighbor_, false); |
| 243 ValidateQuadResources(quad); | 243 ValidateQuadResources(quad); |
| 244 } | 244 } |
| 245 | 245 |
| 246 visible_rect = | 246 visible_rect = |
| 247 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 247 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 248 layer_bottom_left); | 248 layer_bottom_left); |
| 249 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 249 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 250 if (!visible_rect.IsEmpty()) { | 250 if (!visible_rect.IsEmpty()) { |
| 251 TextureDrawQuad* quad = | 251 TextureDrawQuad* quad = |
| 252 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 252 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 253 quad->SetNew(shared_quad_state, layer_bottom_left, opaque_rect, | 253 quad->SetNew(shared_quad_state, layer_bottom_left, opaque_rect, |
| 254 visible_rect, resource, premultiplied_alpha, | 254 visible_rect, resource, premultiplied_alpha, |
| 255 uv_bottom_left.origin(), uv_bottom_left.bottom_right(), | 255 uv_bottom_left.origin(), uv_bottom_left.bottom_right(), |
| 256 SK_ColorTRANSPARENT, vertex_opacity, flipped, | 256 SK_ColorTRANSPARENT, vertex_opacity, flipped, |
| 257 nearest_neighbor_); | 257 nearest_neighbor_, false); |
| 258 ValidateQuadResources(quad); | 258 ValidateQuadResources(quad); |
| 259 } | 259 } |
| 260 | 260 |
| 261 visible_rect = | 261 visible_rect = |
| 262 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 262 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 263 layer_bottom_right); | 263 layer_bottom_right); |
| 264 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 264 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 265 if (!visible_rect.IsEmpty()) { | 265 if (!visible_rect.IsEmpty()) { |
| 266 TextureDrawQuad* quad = | 266 TextureDrawQuad* quad = |
| 267 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 267 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 268 quad->SetNew(shared_quad_state, layer_bottom_right, opaque_rect, | 268 quad->SetNew(shared_quad_state, layer_bottom_right, opaque_rect, |
| 269 visible_rect, resource, premultiplied_alpha, | 269 visible_rect, resource, premultiplied_alpha, |
| 270 uv_bottom_right.origin(), uv_bottom_right.bottom_right(), | 270 uv_bottom_right.origin(), uv_bottom_right.bottom_right(), |
| 271 SK_ColorTRANSPARENT, vertex_opacity, flipped, | 271 SK_ColorTRANSPARENT, vertex_opacity, flipped, |
| 272 nearest_neighbor_); | 272 nearest_neighbor_, false); |
| 273 ValidateQuadResources(quad); | 273 ValidateQuadResources(quad); |
| 274 } | 274 } |
| 275 | 275 |
| 276 visible_rect = | 276 visible_rect = |
| 277 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 277 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 278 layer_top); | 278 layer_top); |
| 279 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 279 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 280 if (!visible_rect.IsEmpty()) { | 280 if (!visible_rect.IsEmpty()) { |
| 281 TextureDrawQuad* quad = | 281 TextureDrawQuad* quad = |
| 282 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 282 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 283 quad->SetNew(shared_quad_state, layer_top, opaque_rect, visible_rect, | 283 quad->SetNew(shared_quad_state, layer_top, opaque_rect, visible_rect, |
| 284 resource, premultiplied_alpha, uv_top.origin(), | 284 resource, premultiplied_alpha, uv_top.origin(), |
| 285 uv_top.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, | 285 uv_top.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| 286 flipped, nearest_neighbor_); | 286 flipped, nearest_neighbor_, false); |
| 287 ValidateQuadResources(quad); | 287 ValidateQuadResources(quad); |
| 288 } | 288 } |
| 289 | 289 |
| 290 visible_rect = | 290 visible_rect = |
| 291 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 291 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 292 layer_left); | 292 layer_left); |
| 293 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 293 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 294 if (!visible_rect.IsEmpty()) { | 294 if (!visible_rect.IsEmpty()) { |
| 295 TextureDrawQuad* quad = | 295 TextureDrawQuad* quad = |
| 296 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 296 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 297 quad->SetNew(shared_quad_state, layer_left, opaque_rect, visible_rect, | 297 quad->SetNew(shared_quad_state, layer_left, opaque_rect, visible_rect, |
| 298 resource, premultiplied_alpha, uv_left.origin(), | 298 resource, premultiplied_alpha, uv_left.origin(), |
| 299 uv_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, | 299 uv_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| 300 flipped, nearest_neighbor_); | 300 flipped, nearest_neighbor_, false); |
| 301 ValidateQuadResources(quad); | 301 ValidateQuadResources(quad); |
| 302 } | 302 } |
| 303 | 303 |
| 304 visible_rect = | 304 visible_rect = |
| 305 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 305 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 306 layer_right); | 306 layer_right); |
| 307 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 307 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 308 if (!visible_rect.IsEmpty()) { | 308 if (!visible_rect.IsEmpty()) { |
| 309 TextureDrawQuad* quad = | 309 TextureDrawQuad* quad = |
| 310 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 310 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 311 quad->SetNew(shared_quad_state, layer_right, opaque_rect, layer_right, | 311 quad->SetNew(shared_quad_state, layer_right, opaque_rect, layer_right, |
| 312 resource, premultiplied_alpha, uv_right.origin(), | 312 resource, premultiplied_alpha, uv_right.origin(), |
| 313 uv_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, | 313 uv_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| 314 flipped, nearest_neighbor_); | 314 flipped, nearest_neighbor_, false); |
| 315 ValidateQuadResources(quad); | 315 ValidateQuadResources(quad); |
| 316 } | 316 } |
| 317 | 317 |
| 318 visible_rect = | 318 visible_rect = |
| 319 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 319 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 320 layer_bottom); | 320 layer_bottom); |
| 321 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 321 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 322 if (!visible_rect.IsEmpty()) { | 322 if (!visible_rect.IsEmpty()) { |
| 323 TextureDrawQuad* quad = | 323 TextureDrawQuad* quad = |
| 324 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 324 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 325 quad->SetNew(shared_quad_state, layer_bottom, opaque_rect, visible_rect, | 325 quad->SetNew(shared_quad_state, layer_bottom, opaque_rect, visible_rect, |
| 326 resource, premultiplied_alpha, uv_bottom.origin(), | 326 resource, premultiplied_alpha, uv_bottom.origin(), |
| 327 uv_bottom.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, | 327 uv_bottom.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| 328 flipped, nearest_neighbor_); | 328 flipped, nearest_neighbor_, false); |
| 329 ValidateQuadResources(quad); | 329 ValidateQuadResources(quad); |
| 330 } | 330 } |
| 331 | 331 |
| 332 if (fill_center_) { | 332 if (fill_center_) { |
| 333 visible_rect = | 333 visible_rect = |
| 334 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( | 334 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| 335 layer_center); | 335 layer_center); |
| 336 opaque_rect = opaque ? visible_rect : gfx::Rect(); | 336 opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| 337 if (!visible_rect.IsEmpty()) { | 337 if (!visible_rect.IsEmpty()) { |
| 338 TextureDrawQuad* quad = | 338 TextureDrawQuad* quad = |
| 339 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 339 render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| 340 quad->SetNew(shared_quad_state, layer_center, opaque_rect, visible_rect, | 340 quad->SetNew(shared_quad_state, layer_center, opaque_rect, visible_rect, |
| 341 resource, premultiplied_alpha, uv_center.origin(), | 341 resource, premultiplied_alpha, uv_center.origin(), |
| 342 uv_center.bottom_right(), SK_ColorTRANSPARENT, | 342 uv_center.bottom_right(), SK_ColorTRANSPARENT, |
| 343 vertex_opacity, flipped, nearest_neighbor_); | 343 vertex_opacity, flipped, nearest_neighbor_, false); |
| 344 ValidateQuadResources(quad); | 344 ValidateQuadResources(quad); |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 | 348 |
| 349 const char* NinePatchLayerImpl::LayerTypeAsString() const { | 349 const char* NinePatchLayerImpl::LayerTypeAsString() const { |
| 350 return "cc::NinePatchLayerImpl"; | 350 return "cc::NinePatchLayerImpl"; |
| 351 } | 351 } |
| 352 | 352 |
| 353 base::DictionaryValue* NinePatchLayerImpl::LayerTreeAsJson() const { | 353 base::DictionaryValue* NinePatchLayerImpl::LayerTreeAsJson() const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 366 result->Set("ImageBounds", list); | 366 result->Set("ImageBounds", list); |
| 367 | 367 |
| 368 result->Set("Border", MathUtil::AsValue(border_).release()); | 368 result->Set("Border", MathUtil::AsValue(border_).release()); |
| 369 | 369 |
| 370 result->SetBoolean("FillCenter", fill_center_); | 370 result->SetBoolean("FillCenter", fill_center_); |
| 371 | 371 |
| 372 return result; | 372 return result; |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace cc | 375 } // namespace cc |
| OLD | NEW |