| 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/base/render_surface_filters.h" | 10 #include "cc/base/render_surface_filters.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, | 464 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, |
| 465 content_texture->id()); | 465 content_texture->id()); |
| 466 if (!lock.valid()) | 466 if (!lock.valid()) |
| 467 return; | 467 return; |
| 468 | 468 |
| 469 SkRect dest_rect = gfx::RectFToSkRect(QuadVertexRect()); | 469 SkRect dest_rect = gfx::RectFToSkRect(QuadVertexRect()); |
| 470 SkRect dest_visible_rect = gfx::RectFToSkRect( | 470 SkRect dest_visible_rect = gfx::RectFToSkRect( |
| 471 MathUtil::ScaleRectProportional(QuadVertexRect(), gfx::RectF(quad->rect), | 471 MathUtil::ScaleRectProportional(QuadVertexRect(), gfx::RectF(quad->rect), |
| 472 gfx::RectF(quad->visible_rect))); | 472 gfx::RectF(quad->visible_rect))); |
| 473 SkRect content_rect = RectFToSkRect(quad->tex_coord_rect); | 473 // TODO(sunxd): make this never be empty. |
| 474 SkRect content_rect = |
| 475 quad->tex_coord_rect.IsEmpty() |
| 476 ? SkRect::MakeWH(quad->rect.width(), quad->rect.height()) |
| 477 : RectFToSkRect(quad->tex_coord_rect); |
| 474 | 478 |
| 475 const SkBitmap* content = lock.sk_bitmap(); | 479 const SkBitmap* content = lock.sk_bitmap(); |
| 476 | 480 |
| 477 sk_sp<SkImage> filter_image; | 481 sk_sp<SkImage> filter_image; |
| 478 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); | 482 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); |
| 479 if (filters) { | 483 if (filters) { |
| 480 DCHECK(!filters->IsEmpty()); | 484 DCHECK(!filters->IsEmpty()); |
| 481 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( | 485 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( |
| 482 *filters, gfx::SizeF(content_texture->size())); | 486 *filters, gfx::SizeF(content_texture->size())); |
| 483 if (image_filter) { | 487 if (image_filter) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 728 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
| 725 | 729 |
| 726 if (!filter_backdrop_image) | 730 if (!filter_backdrop_image) |
| 727 return nullptr; | 731 return nullptr; |
| 728 | 732 |
| 729 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 733 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
| 730 &filter_backdrop_transform); | 734 &filter_backdrop_transform); |
| 731 } | 735 } |
| 732 | 736 |
| 733 } // namespace cc | 737 } // namespace cc |
| OLD | NEW |