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 // TODO(sunxd): make this never be empty. | 473 SkRect content_rect = RectFToSkRect(quad->tex_coord_rect); |
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); | |
478 | 474 |
479 const SkBitmap* content = lock.sk_bitmap(); | 475 const SkBitmap* content = lock.sk_bitmap(); |
480 | 476 |
481 sk_sp<SkImage> filter_image; | 477 sk_sp<SkImage> filter_image; |
482 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); | 478 const FilterOperations* filters = FiltersForPass(quad->render_pass_id); |
483 if (filters) { | 479 if (filters) { |
484 DCHECK(!filters->IsEmpty()); | 480 DCHECK(!filters->IsEmpty()); |
485 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( | 481 sk_sp<SkImageFilter> image_filter = RenderSurfaceFilters::BuildImageFilter( |
486 *filters, gfx::SizeF(content_texture->size())); | 482 *filters, gfx::SizeF(content_texture->size())); |
487 if (image_filter) { | 483 if (image_filter) { |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 724 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
729 | 725 |
730 if (!filter_backdrop_image) | 726 if (!filter_backdrop_image) |
731 return nullptr; | 727 return nullptr; |
732 | 728 |
733 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 729 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
734 &filter_backdrop_transform); | 730 &filter_backdrop_transform); |
735 } | 731 } |
736 | 732 |
737 } // namespace cc | 733 } // namespace cc |
OLD | NEW |