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/output/software_renderer.h" | 5 #include "cc/output/software_renderer.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 | 453 |
454 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, | 454 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, |
455 content_texture->id()); | 455 content_texture->id()); |
456 if (!lock.valid()) | 456 if (!lock.valid()) |
457 return; | 457 return; |
458 | 458 |
459 SkRect dest_rect = gfx::RectFToSkRect(QuadVertexRect()); | 459 SkRect dest_rect = gfx::RectFToSkRect(QuadVertexRect()); |
460 SkRect dest_visible_rect = gfx::RectFToSkRect( | 460 SkRect dest_visible_rect = gfx::RectFToSkRect( |
461 MathUtil::ScaleRectProportional(QuadVertexRect(), gfx::RectF(quad->rect), | 461 MathUtil::ScaleRectProportional(QuadVertexRect(), gfx::RectF(quad->rect), |
462 gfx::RectF(quad->visible_rect))); | 462 gfx::RectF(quad->visible_rect))); |
463 SkRect content_rect = SkRect::MakeWH(quad->rect.width(), quad->rect.height()); | 463 // TODO(sunxd): make this never be empty. |
| 464 SkRect content_rect = |
| 465 quad->tex_coord_rect.IsEmpty() |
| 466 ? SkRect::MakeWH(quad->rect.width(), quad->rect.height()) |
| 467 : RectFToSkRect(quad->tex_coord_rect); |
464 | 468 |
465 const SkBitmap* content = lock.sk_bitmap(); | 469 const SkBitmap* content = lock.sk_bitmap(); |
466 | 470 |
467 sk_sp<SkImage> filter_image; | 471 sk_sp<SkImage> filter_image; |
468 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); | 472 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); |
469 if (filters) { | 473 if (filters) { |
470 DCHECK(!filters->IsEmpty()); | 474 DCHECK(!filters->IsEmpty()); |
471 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( | 475 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( |
472 *filters, gfx::SizeF(content_texture->size())); | 476 *filters, gfx::SizeF(content_texture->size())); |
473 if (image_filter) { | 477 if (image_filter) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 714 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
711 | 715 |
712 if (!filter_backdrop_image) | 716 if (!filter_backdrop_image) |
713 return nullptr; | 717 return nullptr; |
714 | 718 |
715 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 719 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
716 &filter_backdrop_transform); | 720 &filter_backdrop_transform); |
717 } | 721 } |
718 | 722 |
719 } // namespace cc | 723 } // namespace cc |
OLD | NEW |