| 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/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 | 671 |
| 672 SkImageInfo dst_info = | 672 SkImageInfo dst_info = |
| 673 SkImageInfo::MakeN32Premul(dst_rect.width(), dst_rect.height()); | 673 SkImageInfo::MakeN32Premul(dst_rect.width(), dst_rect.height()); |
| 674 sk_sp<SkSurface> surface = SkSurface::MakeRaster(dst_info); | 674 sk_sp<SkSurface> surface = SkSurface::MakeRaster(dst_info); |
| 675 | 675 |
| 676 if (!surface) { | 676 if (!surface) { |
| 677 return nullptr; | 677 return nullptr; |
| 678 } | 678 } |
| 679 | 679 |
| 680 SkPaint paint; | 680 SkPaint paint; |
| 681 // Treat subnormal float values as zero for performance. |
| 682 ScopedSubnormalFloatDisabler disabler; |
| 681 paint.setImageFilter(filter->makeWithLocalMatrix(local_matrix)); | 683 paint.setImageFilter(filter->makeWithLocalMatrix(local_matrix)); |
| 682 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y()); | 684 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y()); |
| 683 surface->getCanvas()->drawBitmap(to_filter, quad->rect.x(), quad->rect.y(), | 685 surface->getCanvas()->drawBitmap(to_filter, quad->rect.x(), quad->rect.y(), |
| 684 &paint); | 686 &paint); |
| 685 | 687 |
| 686 return surface->makeImageSnapshot(); | 688 return surface->makeImageSnapshot(); |
| 687 } | 689 } |
| 688 | 690 |
| 689 SkBitmap SoftwareRenderer::GetBackdropBitmap( | 691 SkBitmap SoftwareRenderer::GetBackdropBitmap( |
| 690 const gfx::Rect& bounding_rect) const { | 692 const gfx::Rect& bounding_rect) const { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); | 753 ApplyImageFilter(filter.get(), quad, backdrop_bitmap, nullptr); |
| 752 | 754 |
| 753 if (!filter_backdrop_image) | 755 if (!filter_backdrop_image) |
| 754 return nullptr; | 756 return nullptr; |
| 755 | 757 |
| 756 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 758 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
| 757 &filter_backdrop_transform); | 759 &filter_backdrop_transform); |
| 758 } | 760 } |
| 759 | 761 |
| 760 } // namespace cc | 762 } // namespace cc |
| OLD | NEW |