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/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/compositor_frame_ack.h" | 10 #include "cc/output/compositor_frame_ack.h" |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 635 |
636 SkImageInfo dst_info = | 636 SkImageInfo dst_info = |
637 SkImageInfo::MakeN32Premul(to_filter->width(), to_filter->height()); | 637 SkImageInfo::MakeN32Premul(to_filter->width(), to_filter->height()); |
638 skia::RefPtr<SkSurface> surface = | 638 skia::RefPtr<SkSurface> surface = |
639 skia::AdoptRef(SkSurface::NewRaster(dst_info)); | 639 skia::AdoptRef(SkSurface::NewRaster(dst_info)); |
640 | 640 |
641 SkMatrix localM; | 641 SkMatrix localM; |
642 localM.setTranslate(SkIntToScalar(-quad->rect.origin().x()), | 642 localM.setTranslate(SkIntToScalar(-quad->rect.origin().x()), |
643 SkIntToScalar(-quad->rect.origin().y())); | 643 SkIntToScalar(-quad->rect.origin().y())); |
644 localM.preScale(quad->filters_scale.x(), quad->filters_scale.y()); | 644 localM.preScale(quad->filters_scale.x(), quad->filters_scale.y()); |
645 skia::RefPtr<SkImageFilter> localIMF = | |
646 skia::AdoptRef(filter->newWithLocalMatrix(localM)); | |
647 | 645 |
648 SkPaint paint; | 646 SkPaint paint; |
649 paint.setImageFilter(localIMF.get()); | 647 paint.setImageFilter(filter->makeWithLocalMatrix(localM)); |
650 surface->getCanvas()->drawBitmap(*to_filter, 0, 0, &paint); | 648 surface->getCanvas()->drawBitmap(*to_filter, 0, 0, &paint); |
651 | 649 |
652 return skia::AdoptRef(surface->newImageSnapshot()); | 650 return skia::AdoptRef(surface->newImageSnapshot()); |
653 } | 651 } |
654 | 652 |
655 SkBitmap SoftwareRenderer::GetBackdropBitmap( | 653 SkBitmap SoftwareRenderer::GetBackdropBitmap( |
656 const gfx::Rect& bounding_rect) const { | 654 const gfx::Rect& bounding_rect) const { |
657 SkBitmap bitmap; | 655 SkBitmap bitmap; |
658 bitmap.setInfo(SkImageInfo::MakeN32Premul(bounding_rect.width(), | 656 bitmap.setInfo(SkImageInfo::MakeN32Premul(bounding_rect.width(), |
659 bounding_rect.height())); | 657 bounding_rect.height())); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 ApplyImageFilter(filter.get(), quad, &backdrop_bitmap); | 714 ApplyImageFilter(filter.get(), quad, &backdrop_bitmap); |
717 | 715 |
718 if (!filter_backdrop_image) | 716 if (!filter_backdrop_image) |
719 return nullptr; | 717 return nullptr; |
720 | 718 |
721 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, | 719 return filter_backdrop_image->makeShader(content_tile_mode, content_tile_mode, |
722 &filter_backdrop_transform); | 720 &filter_backdrop_transform); |
723 } | 721 } |
724 | 722 |
725 } // namespace cc | 723 } // namespace cc |
OLD | NEW |