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: src/core/SkRemote.cpp

Issue 1533953002: change signature for virtual related to saveLayer, passing SaveLayerRec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 #include "SkAnnotation.h" 8 #include "SkAnnotation.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 Encoder::CommonIDs fIDs; 156 Encoder::CommonIDs fIDs;
157 }; 157 };
158 158
159 template <typename T> 159 template <typename T>
160 AutoID id(const T& val) { return AutoID(fEncoder, val); } 160 AutoID id(const T& val) { return AutoID(fEncoder, val); }
161 161
162 AutoCommonIDs commonIDs(const SkPaint& paint) { return AutoCommonIDs(fEn coder, paint); } 162 AutoCommonIDs commonIDs(const SkPaint& paint) { return AutoCommonIDs(fEn coder, paint); }
163 163
164 void willSave() override { fEncoder-> save(); } 164 void willSave() override { fEncoder-> save(); }
165 void didRestore() override { fEncoder->restore(); } 165 void didRestore() override { fEncoder->restore(); }
166 SaveLayerStrategy willSaveLayer(const SkRect* bounds, 166 SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override {
167 const SkPaint* paint,
168 SaveFlags flags) override {
169 SkPath path; 167 SkPath path;
170 if (bounds) { 168 if (rec.fBounds) {
171 path.addRect(*bounds); 169 path.addRect(*rec.fBounds);
172 } 170 }
173 const SkPaint defaultPaint; 171 const SkPaint defaultPaint;
172 const SkPaint* paint = rec.fPaint;
174 if (!paint) { 173 if (!paint) {
175 paint = &defaultPaint; 174 paint = &defaultPaint;
176 } 175 }
177 fEncoder->saveLayer(this->id(path), this->commonIDs(*paint), flags); 176 // TODO: what to do with rec.fBackdrop?
177 fEncoder->saveLayer(this->id(path), this->commonIDs(*paint), rec.fSa veLayerFlags);
robertphillips 2015/12/17 19:53:57 ?
178 SkASSERT(false);
178 return kNoLayer_SaveLayerStrategy; 179 return kNoLayer_SaveLayerStrategy;
179 } 180 }
180 181
181 void didConcat(const SkMatrix&) override { this->didSetMatrix(this->g etTotalMatrix()); } 182 void didConcat(const SkMatrix&) override { this->didSetMatrix(this->g etTotalMatrix()); }
182 void didSetMatrix(const SkMatrix& matrix) override { 183 void didSetMatrix(const SkMatrix& matrix) override {
183 fEncoder->setMatrix(this->id(matrix)); 184 fEncoder->setMatrix(this->id(matrix));
184 } 185 }
185 186
186 void onDrawOval(const SkRect& oval, const SkPaint& paint) override { 187 void onDrawOval(const SkRect& oval, const SkPaint& paint) override {
187 SkPath path; 188 SkPath path;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 paint->setMaskFilter (fMaskFilter .find(common.maskfilter)); 494 paint->setMaskFilter (fMaskFilter .find(common.maskfilter));
494 paint->setColorFilter(fColorFilter.find(common.colorfilter)); 495 paint->setColorFilter(fColorFilter.find(common.colorfilter));
495 paint->setRasterizer (fRasterizer .find(common.rasterizer)); 496 paint->setRasterizer (fRasterizer .find(common.rasterizer));
496 paint->setLooper (fDrawLooper .find(common.looper)); 497 paint->setLooper (fDrawLooper .find(common.looper));
497 paint->setImageFilter(fImageFilter.find(common.imagefilter)); 498 paint->setImageFilter(fImageFilter.find(common.imagefilter));
498 paint->setAnnotation (fAnnotation .find(common.annotation)); 499 paint->setAnnotation (fAnnotation .find(common.annotation));
499 } 500 }
500 501
501 void save() override { fCanvas->save(); } 502 void save() override { fCanvas->save(); }
502 void restore() override { fCanvas->restore(); } 503 void restore() override { fCanvas->restore(); }
503 void saveLayer(ID bounds, CommonIDs common, SkCanvas::SaveFlags flags) o verride { 504 void saveLayer(ID bounds, CommonIDs common, uint32_t saveLayerFlags) ove rride {
504 SkPaint paint; 505 SkPaint paint;
505 this->applyCommon(common, &paint); 506 this->applyCommon(common, &paint);
506 SkRect rect; 507 SkRect rect;
robertphillips 2015/12/17 19:53:57 \n somewhere ?
reed1 2015/12/17 20:22:31 Done.
507 fCanvas->saveLayer(fPath.find(bounds).isRect(&rect) ? &rect : nullpt r, &paint, flags); 508
509 fCanvas->saveLayer({ fPath.find(bounds).isRect(&rect) ? &rect : null ptr, &paint, saveLayerFlags });
508 } 510 }
509 511
510 void setMatrix(ID matrix) override { fCanvas->setMatrix(fMatrix.find(mat rix)); } 512 void setMatrix(ID matrix) override { fCanvas->setMatrix(fMatrix.find(mat rix)); }
511 513
512 void clipPath(ID path, SkRegion::Op op, bool aa) override { 514 void clipPath(ID path, SkRegion::Op op, bool aa) override {
513 fCanvas->clipPath(fPath.find(path), op, aa); 515 fCanvas->clipPath(fPath.find(path), op, aa);
514 } 516 }
515 void fillPath(ID path, CommonIDs common) override { 517 void fillPath(ID path, CommonIDs common) override {
516 SkPaint paint; 518 SkPaint paint;
517 paint.setStyle(SkPaint::kFill_Style); 519 paint.setStyle(SkPaint::kFill_Style);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 ID define(SkColorFilter* v) override { return this->define(&fColorFil ter, v); } 679 ID define(SkColorFilter* v) override { return this->define(&fColorFil ter, v); }
678 ID define(SkRasterizer* v) override { return this->define(&fRasteriz er , v); } 680 ID define(SkRasterizer* v) override { return this->define(&fRasteriz er , v); }
679 ID define(SkDrawLooper* v) override { return this->define(&fDrawLoop er , v); } 681 ID define(SkDrawLooper* v) override { return this->define(&fDrawLoop er , v); }
680 ID define(SkImageFilter* v) override { return this->define(&fImageFil ter, v); } 682 ID define(SkImageFilter* v) override { return this->define(&fImageFil ter, v); }
681 ID define(SkAnnotation* v) override { return this->define(&fAnnotati on , v); } 683 ID define(SkAnnotation* v) override { return this->define(&fAnnotati on , v); }
682 684
683 void undefine(ID) override {} 685 void undefine(ID) override {}
684 686
685 void save() override { fWrapped-> save(); } 687 void save() override { fWrapped-> save(); }
686 void restore() override { fWrapped->restore(); } 688 void restore() override { fWrapped->restore(); }
687 void saveLayer(ID bounds, CommonIDs common, SkCanvas::SaveFlags flags) o verride { 689 void saveLayer(ID bounds, CommonIDs common, uint32_t saveLayerFlags) ove rride {
688 fWrapped->saveLayer(bounds, common, flags); 690 fWrapped->saveLayer(bounds, common, saveLayerFlags);
689 } 691 }
690 692
691 void setMatrix(ID matrix) override { fWrapped->setMatrix(matrix); } 693 void setMatrix(ID matrix) override { fWrapped->setMatrix(matrix); }
692 694
693 void clipPath(ID path, SkRegion::Op op, bool aa) override { 695 void clipPath(ID path, SkRegion::Op op, bool aa) override {
694 fWrapped->clipPath(path, op, aa); 696 fWrapped->clipPath(path, op, aa);
695 } 697 }
696 void fillPath(ID path, CommonIDs common) override { 698 void fillPath(ID path, CommonIDs common) override {
697 fWrapped->fillPath(path, common); 699 fWrapped->fillPath(path, common);
698 } 700 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 RefKeyMap<SkDrawLooper , Type::kDrawLooper > fDrawLooper; 751 RefKeyMap<SkDrawLooper , Type::kDrawLooper > fDrawLooper;
750 RefKeyMap<SkImageFilter , Type::kImageFilter> fImageFilter; 752 RefKeyMap<SkImageFilter , Type::kImageFilter> fImageFilter;
751 RefKeyMap<SkAnnotation , Type::kAnnotation > fAnnotation; 753 RefKeyMap<SkAnnotation , Type::kAnnotation > fAnnotation;
752 754
753 Encoder* fWrapped; 755 Encoder* fWrapped;
754 }; 756 };
755 757
756 Encoder* NewCachingEncoder(Encoder* wrapped) { return new CachingEncoder(wra pped); } 758 Encoder* NewCachingEncoder(Encoder* wrapped) { return new CachingEncoder(wra pped); }
757 759
758 } // namespace SkRemote 760 } // namespace SkRemote
OLDNEW
« src/core/SkPictureFlat.h ('K') | « src/core/SkRemote.h ('k') | src/pipe/SkGPipeWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698