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

Side by Side Diff: skia/ext/analysis_canvas.cc

Issue 492943002: AnalysisCanvas is missing an override for virtual void onClipRegion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/debug/trace_event.h" 5 #include "base/debug/trace_event.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "skia/ext/analysis_canvas.h" 7 #include "skia/ext/analysis_canvas.h"
8 #include "third_party/skia/include/core/SkDraw.h" 8 #include "third_party/skia/include/core/SkDraw.h"
9 #include "third_party/skia/include/core/SkRRect.h" 9 #include "third_party/skia/include/core/SkRRect.h"
10 #include "third_party/skia/include/core/SkShader.h" 10 #include "third_party/skia/include/core/SkShader.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (draw_op_count_ > 1) { 324 if (draw_op_count_ > 1) {
325 // We have to reset solid/transparent state to false since we don't 325 // We have to reset solid/transparent state to false since we don't
326 // know whether consequent operations will make this false. 326 // know whether consequent operations will make this false.
327 is_solid_color_ = false; 327 is_solid_color_ = false;
328 is_transparent_ = false; 328 is_transparent_ = false;
329 return true; 329 return true;
330 } 330 }
331 return false; 331 return false;
332 } 332 }
333 333
334 void AnalysisCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, 334 void AnalysisCanvas::OnComplexClip() {
335 ClipEdgeStyle edge_style) { 335 // complex clips can make our calls to IsFullQuad invalid (ie have false
336
337 INHERITED::onClipRect(rect, op, edge_style);
338 }
339
340 void AnalysisCanvas::onClipPath(const SkPath& path, SkRegion::Op op,
341 ClipEdgeStyle edge_style) {
342 // clipPaths can make our calls to IsFullQuad invalid (ie have false
343 // positives). As a precaution, force the setting to be non-solid 336 // positives). As a precaution, force the setting to be non-solid
344 // and non-transparent until we pop this 337 // and non-transparent until we pop this
345 if (force_not_solid_stack_level_ == kNoLayer) { 338 if (force_not_solid_stack_level_ == kNoLayer) {
346 force_not_solid_stack_level_ = saved_stack_size_; 339 force_not_solid_stack_level_ = saved_stack_size_;
347 SetForceNotSolid(true); 340 SetForceNotSolid(true);
348 } 341 }
349 if (force_not_transparent_stack_level_ == kNoLayer) { 342 if (force_not_transparent_stack_level_ == kNoLayer) {
350 force_not_transparent_stack_level_ = saved_stack_size_; 343 force_not_transparent_stack_level_ = saved_stack_size_;
351 SetForceNotTransparent(true); 344 SetForceNotTransparent(true);
352 } 345 }
346 }
353 347
348 void AnalysisCanvas::onClipRect(const SkRect& rect,
349 SkRegion::Op op,
350 ClipEdgeStyle edge_style) {
351 INHERITED::onClipRect(rect, op, edge_style);
352 }
353
354 void AnalysisCanvas::onClipPath(const SkPath& path,
355 SkRegion::Op op,
356 ClipEdgeStyle edge_style) {
357 OnComplexClip();
354 INHERITED::onClipRect(path.getBounds(), op, edge_style); 358 INHERITED::onClipRect(path.getBounds(), op, edge_style);
355 } 359 }
356 360
357 void AnalysisCanvas::onClipRRect(const SkRRect& rrect, 361 void AnalysisCanvas::onClipRRect(const SkRRect& rrect,
358 SkRegion::Op op, 362 SkRegion::Op op,
359 ClipEdgeStyle edge_style) { 363 ClipEdgeStyle edge_style) {
360 // clipRRect can make our calls to IsFullQuad invalid (ie have false 364 OnComplexClip();
361 // positives). As a precaution, force the setting to be non-solid 365 INHERITED::onClipRect(rrect.getBounds(), op, edge_style);
362 // and non-transparent until we pop this 366 }
363 if (force_not_solid_stack_level_ == kNoLayer) { 367
364 force_not_solid_stack_level_ = saved_stack_size_; 368 void AnalysisCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
365 SetForceNotSolid(true); 369 const ClipEdgeStyle edge_style = kHard_ClipEdgeStyle;
370 if (deviceRgn.isRect()) {
371 onClipRect(SkRect::MakeFromIRect(deviceRgn.getBounds()), op, edge_style);
372 return;
366 } 373 }
367 if (force_not_transparent_stack_level_ == kNoLayer) { 374 OnComplexClip();
368 force_not_transparent_stack_level_ = saved_stack_size_; 375 INHERITED::onClipRect(
369 SetForceNotTransparent(true); 376 SkRect::MakeFromIRect(deviceRgn.getBounds()), op, edge_style);
370 }
371
372 INHERITED::onClipRect(rrect.getBounds(), op, edge_style);
373 } 377 }
374 378
375 void AnalysisCanvas::willSave() { 379 void AnalysisCanvas::willSave() {
376 ++saved_stack_size_; 380 ++saved_stack_size_;
377 INHERITED::willSave(); 381 INHERITED::willSave();
378 } 382 }
379 383
380 SkCanvas::SaveLayerStrategy AnalysisCanvas::willSaveLayer( 384 SkCanvas::SaveLayerStrategy AnalysisCanvas::willSaveLayer(
381 const SkRect* bounds, 385 const SkRect* bounds,
382 const SkPaint* paint, 386 const SkPaint* paint,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 force_not_transparent_stack_level_ = kNoLayer; 435 force_not_transparent_stack_level_ = kNoLayer;
432 } 436 }
433 } 437 }
434 438
435 INHERITED::willRestore(); 439 INHERITED::willRestore();
436 } 440 }
437 441
438 } // namespace skia 442 } // namespace skia
439 443
440 444
OLDNEW
« no previous file with comments | « skia/ext/analysis_canvas.h ('k') | skia/ext/analysis_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698