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

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

Issue 19267024: cc: Don't leak a ref to SkColorFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: filterleak: caps Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | skia/ext/refptr.h » ('j') | skia/ext/refptr.h » ('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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (disable_blending) 745 if (disable_blending)
746 SetBlendEnabled(true); 746 SetBlendEnabled(true);
747 } 747 }
748 748
749 // TODO(senorblanco): Cache this value so that we don't have to do it for both 749 // TODO(senorblanco): Cache this value so that we don't have to do it for both
750 // the surface and its replica. Apply filters to the contents texture. 750 // the surface and its replica. Apply filters to the contents texture.
751 SkBitmap filter_bitmap; 751 SkBitmap filter_bitmap;
752 SkScalar color_matrix[20]; 752 SkScalar color_matrix[20];
753 bool use_color_matrix = false; 753 bool use_color_matrix = false;
754 if (quad->filter) { 754 if (quad->filter) {
755 SkColorFilter* cf; 755 skia::RefPtr<SkColorFilter> cf;
756 if ((quad->filter->asColorFilter(&cf)) && cf->asColorMatrix(color_matrix) && 756 quad->filter->asColorFilter(cf.ReceiveAndAdoptRef());
757 !quad->filter->getInput(0)) { 757
758 if (cf && cf->asColorMatrix(color_matrix) && !quad->filter->getInput(0)) {
758 // We have a single color matrix as a filter; apply it locally 759 // We have a single color matrix as a filter; apply it locally
759 // in the compositor. 760 // in the compositor.
760 use_color_matrix = true; 761 use_color_matrix = true;
761 } else { 762 } else {
762 filter_bitmap = 763 filter_bitmap =
763 ApplyImageFilter(this, quad->filter.get(), contents_texture); 764 ApplyImageFilter(this, quad->filter.get(), contents_texture);
764 } 765 }
765 } else if (!quad->filters.IsEmpty()) { 766 } else if (!quad->filters.IsEmpty()) {
766 FilterOperations optimized_filters = 767 FilterOperations optimized_filters =
767 RenderSurfaceFilters::Optimize(quad->filters); 768 RenderSurfaceFilters::Optimize(quad->filters);
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 std::string unique_context_name = base::StringPrintf( 3089 std::string unique_context_name = base::StringPrintf(
3089 "%s-Offscreen-%p", 3090 "%s-Offscreen-%p",
3090 Settings().compositor_name.c_str(), 3091 Settings().compositor_name.c_str(),
3091 context_); 3092 context_);
3092 resource_provider()->offscreen_context_provider()->Context3d()-> 3093 resource_provider()->offscreen_context_provider()->Context3d()->
3093 pushGroupMarkerEXT(unique_context_name.c_str()); 3094 pushGroupMarkerEXT(unique_context_name.c_str());
3094 } 3095 }
3095 3096
3096 3097
3097 } // namespace cc 3098 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | skia/ext/refptr.h » ('j') | skia/ext/refptr.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698