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

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

Issue 23619012: cc: Adopt new skia object when it's created to avoid memory leak. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/debug/trace_event.h" 7 #include "base/debug/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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 SkMatrix content_matrix; 309 SkMatrix content_matrix;
310 content_matrix.setRectToRect( 310 content_matrix.setRectToRect(
311 gfx::RectFToSkRect(quad->tex_coord_rect), 311 gfx::RectFToSkRect(quad->tex_coord_rect),
312 gfx::RectFToSkRect(QuadVertexRect()), 312 gfx::RectFToSkRect(QuadVertexRect()),
313 SkMatrix::kFill_ScaleToFit); 313 SkMatrix::kFill_ScaleToFit);
314 current_canvas_->concat(content_matrix); 314 current_canvas_->concat(content_matrix);
315 315
316 // TODO(aelias): This isn't correct in all cases. We should detect these 316 // TODO(aelias): This isn't correct in all cases. We should detect these
317 // cases and fall back to a persistent bitmap backing 317 // cases and fall back to a persistent bitmap backing
318 // (http://crbug.com/280374). 318 // (http://crbug.com/280374).
319 skia::RefPtr<SkDrawFilter> opacity_filter =
320 skia::AdoptRef(new skia::OpacityDrawFilter(quad->opacity(), true));
319 DCHECK(!current_canvas_->getDrawFilter()); 321 DCHECK(!current_canvas_->getDrawFilter());
320 current_canvas_->setDrawFilter(new skia::OpacityDrawFilter(quad->opacity(), 322 current_canvas_->setDrawFilter(opacity_filter.get());
321 true));
322 323
323 TRACE_EVENT0("cc", 324 TRACE_EVENT0("cc",
324 "SoftwareRenderer::DrawPictureQuad"); 325 "SoftwareRenderer::DrawPictureQuad");
325 quad->picture_pile->RasterDirect( 326 quad->picture_pile->RasterDirect(
326 current_canvas_, quad->content_rect, quad->contents_scale, NULL); 327 current_canvas_, quad->content_rect, quad->contents_scale, NULL);
327 328
328 current_canvas_->setDrawFilter(NULL); 329 current_canvas_->setDrawFilter(NULL);
329 } 330 }
330 331
331 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, 332 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame,
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 EnsureBackbuffer(); 546 EnsureBackbuffer();
546 else 547 else
547 DiscardBackbuffer(); 548 DiscardBackbuffer();
548 } 549 }
549 550
550 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) { 551 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) {
551 // The software renderer always discards the backbuffer when not visible. 552 // The software renderer always discards the backbuffer when not visible.
552 } 553 }
553 554
554 } // namespace cc 555 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698