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

Unified Diff: src/utils/SkPaintFilterCanvas.cpp

Issue 1576183002: SkTCopyOnFirstWrite-based SkPaintFilterCanvas API (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: minor cleanup Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkPaintFilterCanvas.cpp
diff --git a/src/utils/SkPaintFilterCanvas.cpp b/src/utils/SkPaintFilterCanvas.cpp
index 0a5b7e66295fb6b6510c0760eea71b5cb492aab1..ea94068cb6e754ef913e0c6755eddfc564a6948c 100644
--- a/src/utils/SkPaintFilterCanvas.cpp
+++ b/src/utils/SkPaintFilterCanvas.cpp
@@ -13,23 +13,20 @@
class SkPaintFilterCanvas::AutoPaintFilter {
public:
AutoPaintFilter(const SkPaintFilterCanvas* canvas, Type type, const SkPaint* paint)
- : fOrigPaint(paint) {
- fShouldDraw = canvas->onFilter(fOrigPaint, type, &fFilteredPaint);
+ : fPaint(paint) {
+ fShouldDraw = canvas->onFilter(&fPaint, type);
}
AutoPaintFilter(const SkPaintFilterCanvas* canvas, Type type, const SkPaint& paint)
: AutoPaintFilter(canvas, type, &paint) { }
- const SkPaint* paint() const {
- return fFilteredPaint.isValid() ? fFilteredPaint.get() : fOrigPaint;
- }
+ const SkPaint* paint() const { return fPaint; }
bool shouldDraw() const { return fShouldDraw; }
private:
- const SkPaint* fOrigPaint;
- SkTLazy<SkPaint> fFilteredPaint;
- bool fShouldDraw;
+ SkTCopyOnFirstWrite<SkPaint> fPaint;
+ bool fShouldDraw;
};
SkPaintFilterCanvas::SkPaintFilterCanvas(int width, int height) : INHERITED(width, height) { }
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698