Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 1849213002: Remove SK_SUPPORT_LEGACY_XFERMODE_PTR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adopt the pointer but don't ref it Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/output/software_renderer.cc » ('j') | cc/output/software_renderer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 skia::RefPtr<SkSurface> surface = skia::AdoptRef(SkSurface::NewRenderTarget( 642 skia::RefPtr<SkSurface> surface = skia::AdoptRef(SkSurface::NewRenderTarget(
643 use_gr_context->context(), SkBudgeted::kYes, dst_info, 0)); 643 use_gr_context->context(), SkBudgeted::kYes, dst_info, 0));
644 if (!surface) { 644 if (!surface) {
645 TRACE_EVENT_INSTANT0("cc", "ApplyImageFilter surface allocation failed", 645 TRACE_EVENT_INSTANT0("cc", "ApplyImageFilter surface allocation failed",
646 TRACE_EVENT_SCOPE_THREAD); 646 TRACE_EVENT_SCOPE_THREAD);
647 return skia::RefPtr<SkImage>(); 647 return skia::RefPtr<SkImage>();
648 } 648 }
649 649
650 SkMatrix local_matrix; 650 SkMatrix local_matrix;
651 local_matrix.setScale(scale.x(), scale.y()); 651 local_matrix.setScale(scale.x(), scale.y());
652 skia::RefPtr<SkImageFilter> filter_with_local_scale = 652 sk_sp<SkImageFilter> filter_with_local_scale =
653 skia::AdoptRef(filter->newWithLocalMatrix(local_matrix)); 653 filter->makeWithLocalMatrix(local_matrix);
654 654
655 SkPaint paint; 655 SkPaint paint;
656 paint.setImageFilter(filter_with_local_scale.get()); 656 paint.setImageFilter(filter_with_local_scale);
f(malita) 2016/04/01 18:16:00 std::move(filter_with_local_scale) or inline.
657 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y()); 657 surface->getCanvas()->translate(-dst_rect.x(), -dst_rect.y());
658 surface->getCanvas()->drawImage(srcImage.get(), src_rect.x(), src_rect.y(), 658 surface->getCanvas()->drawImage(srcImage.get(), src_rect.x(), src_rect.y(),
659 &paint); 659 &paint);
660 // Flush the drawing before source texture read lock goes out of scope. 660 // Flush the drawing before source texture read lock goes out of scope.
661 // Skia API does not guarantee that when the SkImage goes out of scope, 661 // Skia API does not guarantee that when the SkImage goes out of scope,
662 // its externally referenced resources would force the rendering to be 662 // its externally referenced resources would force the rendering to be
663 // flushed. 663 // flushed.
664 surface->getCanvas()->flush(); 664 surface->getCanvas()->flush();
665 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); 665 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot());
666 if (!image || !image->isTextureBacked()) { 666 if (!image || !image->isTextureBacked()) {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 // the surface and its replica. Apply filters to the contents texture. 992 // the surface and its replica. Apply filters to the contents texture.
993 skia::RefPtr<SkImage> filter_image; 993 skia::RefPtr<SkImage> filter_image;
994 GLuint filter_image_id = 0; 994 GLuint filter_image_id = 0;
995 SkScalar color_matrix[20]; 995 SkScalar color_matrix[20];
996 bool use_color_matrix = false; 996 bool use_color_matrix = false;
997 gfx::RectF rect = gfx::RectF(quad->rect); 997 gfx::RectF rect = gfx::RectF(quad->rect);
998 if (!quad->filters.IsEmpty()) { 998 if (!quad->filters.IsEmpty()) {
999 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 999 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
1000 quad->filters, gfx::SizeF(contents_texture->size())); 1000 quad->filters, gfx::SizeF(contents_texture->size()));
1001 if (filter) { 1001 if (filter) {
1002 skia::RefPtr<SkColorFilter> cf; 1002 SkColorFilter* colorfilter_rawptr = NULL;
1003 1003 filter->asColorFilter(&colorfilter_rawptr);
1004 { 1004 sk_sp<SkColorFilter> cf(colorfilter_rawptr);
1005 SkColorFilter* colorfilter_rawptr = NULL;
1006 filter->asColorFilter(&colorfilter_rawptr);
1007 cf = skia::AdoptRef(colorfilter_rawptr);
1008 }
1009 1005
1010 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) { 1006 if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) {
1011 // We have a single color matrix as a filter; apply it locally 1007 // We have a single color matrix as a filter; apply it locally
1012 // in the compositor. 1008 // in the compositor.
1013 use_color_matrix = true; 1009 use_color_matrix = true;
1014 } else { 1010 } else {
1015 gfx::Vector2dF scale = quad->filters_scale; 1011 gfx::Vector2dF scale = quad->filters_scale;
1016 SkMatrix scale_matrix; 1012 SkMatrix scale_matrix;
1017 scale_matrix.setScale(scale.x(), scale.y()); 1013 scale_matrix.setScale(scale.x(), scale.y());
1018 SkIRect result_rect = 1014 SkIRect result_rect =
(...skipping 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after
3599 texture_id = pending_overlay_resources_.back()->texture_id(); 3595 texture_id = pending_overlay_resources_.back()->texture_id();
3600 } 3596 }
3601 3597
3602 context_support_->ScheduleOverlayPlane( 3598 context_support_->ScheduleOverlayPlane(
3603 overlay.plane_z_order, overlay.transform, texture_id, 3599 overlay.plane_z_order, overlay.transform, texture_id,
3604 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3600 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3605 } 3601 }
3606 } 3602 }
3607 3603
3608 } // namespace cc 3604 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/software_renderer.cc » ('j') | cc/output/software_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698