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

Side by Side Diff: include/utils/SkNoSaveLayerCanvas.h

Issue 554033003: Revert of allow canvas to force conservative clips (for speed) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkNoSaveLayerCanvas_DEFINED 8 #ifndef SkNoSaveLayerCanvas_DEFINED
9 #define SkNoSaveLayerCanvas_DEFINED 9 #define SkNoSaveLayerCanvas_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkRRect.h" 12 #include "SkRRect.h"
13 13
14 // The NoSaveLayerCanvas is used to play back SkPictures when the saveLayer 14 // The NoSaveLayerCanvas is used to play back SkPictures when the saveLayer
15 // functionality isn't required (e.g., during analysis of the draw calls). 15 // functionality isn't required (e.g., during analysis of the draw calls).
16 // It also simplifies the clipping calls to only use rectangles. 16 // It also simplifies the clipping calls to only use rectangles.
17 class SK_API SkNoSaveLayerCanvas : public SkCanvas { 17 class SK_API SkNoSaveLayerCanvas : public SkCanvas {
18 public: 18 public:
19 SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device, kConservativeR asterClip_InitFlag) 19 SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
20 {}
21 20
22 protected: 21 protected:
23 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint, 22 virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
24 SaveFlags flags) SK_OVERRIDE { 23 SaveFlags flags) SK_OVERRIDE {
25 this->INHERITED::willSaveLayer(bounds, paint, flags); 24 this->INHERITED::willSaveLayer(bounds, paint, flags);
26 return kNoLayer_SaveLayerStrategy; 25 return kNoLayer_SaveLayerStrategy;
27 } 26 }
28 27
28 // disable aa for speed
29 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
30 this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
31 }
32
33 // for speed, just respect the bounds, and disable AA. May give us a few
34 // false positives and negatives.
35 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
36 this->updateClipConservativelyUsingBounds(path.getBounds(), op,
37 path.isInverseFillType());
38 }
39 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl e) SK_OVERRIDE {
40 this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
41 }
42
29 private: 43 private:
30 typedef SkCanvas INHERITED; 44 typedef SkCanvas INHERITED;
31 }; 45 };
32 46
33 #endif // SkNoSaveLayerCanvas_DEFINED 47 #endif // SkNoSaveLayerCanvas_DEFINED
OLDNEW
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698