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

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

Issue 771563003: use SkClipOps where we can, legacyClip where we need to rework Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/resources/clip_display_item.cc » ('j') | 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void SoftwareRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { 176 void SoftwareRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) {
177 is_scissor_enabled_ = true; 177 is_scissor_enabled_ = true;
178 scissor_rect_ = scissor_rect; 178 scissor_rect_ = scissor_rect;
179 SetClipRect(scissor_rect); 179 SetClipRect(scissor_rect);
180 } 180 }
181 181
182 void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) { 182 void SoftwareRenderer::SetClipRect(const gfx::Rect& rect) {
183 // Skia applies the current matrix to clip rects so we reset it temporary. 183 // Skia applies the current matrix to clip rects so we reset it temporary.
184 SkMatrix current_matrix = current_canvas_->getTotalMatrix(); 184 SkMatrix current_matrix = current_canvas_->getTotalMatrix();
185 current_canvas_->resetMatrix(); 185 current_canvas_->resetMatrix();
186 current_canvas_->clipRect(gfx::RectToSkRect(rect), SkRegion::kReplace_Op); 186 current_canvas_->legacyClipRect(gfx::RectToSkRect(rect),
187 SkRegion::kReplace_Op);
187 current_canvas_->setMatrix(current_matrix); 188 current_canvas_->setMatrix(current_matrix);
188 } 189 }
189 190
190 void SoftwareRenderer::ClearCanvas(SkColor color) { 191 void SoftwareRenderer::ClearCanvas(SkColor color) {
191 // SkCanvas::clear doesn't respect the current clipping region 192 // SkCanvas::clear doesn't respect the current clipping region
192 // so we SkCanvas::drawColor instead if scissoring is active. 193 // so we SkCanvas::drawColor instead if scissoring is active.
193 if (is_scissor_enabled_) 194 if (is_scissor_enabled_)
194 current_canvas_->drawColor(color, SkXfermode::kSrc_Mode); 195 current_canvas_->drawColor(color, SkXfermode::kSrc_Mode);
195 else 196 else
196 current_canvas_->clear(color); 197 current_canvas_->clear(color);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 608 }
608 609
609 void SoftwareRenderer::DidChangeVisibility() { 610 void SoftwareRenderer::DidChangeVisibility() {
610 if (visible()) 611 if (visible())
611 EnsureBackbuffer(); 612 EnsureBackbuffer();
612 else 613 else
613 DiscardBackbuffer(); 614 DiscardBackbuffer();
614 } 615 }
615 616
616 } // namespace cc 617 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/clip_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698