| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkDrawFilter.h" | 10 #include "SkDrawFilter.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 SkScalar dz; | 142 SkScalar dz; |
| 143 void draw(SkCanvas* c, const SkMatrix&) { | 143 void draw(SkCanvas* c, const SkMatrix&) { |
| 144 #ifdef SK_EXPERIMENTAL_SHADOWING | 144 #ifdef SK_EXPERIMENTAL_SHADOWING |
| 145 c->translateZ(dz); | 145 c->translateZ(dz); |
| 146 #endif | 146 #endif |
| 147 } | 147 } |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 struct ClipPath final : Op { | 150 struct ClipPath final : Op { |
| 151 static const auto kType = Type::ClipPath; | 151 static const auto kType = Type::ClipPath; |
| 152 ClipPath(const SkPath& path, SkRegion::Op op, bool aa) : path(path), op(
op), aa(aa) {} | 152 ClipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) : path(path),
op(op), aa(aa) {} |
| 153 SkPath path; | 153 SkPath path; |
| 154 SkRegion::Op op; | 154 SkCanvas::ClipOp op; |
| 155 bool aa; | 155 bool aa; |
| 156 void draw(SkCanvas* c, const SkMatrix&) { c->clipPath(path, op, aa); } | 156 void draw(SkCanvas* c, const SkMatrix&) { c->clipPath(path, op, aa); } |
| 157 void makeThreadsafe() { make_threadsafe(&path, nullptr); } | 157 void makeThreadsafe() { make_threadsafe(&path, nullptr); } |
| 158 }; | 158 }; |
| 159 struct ClipRect final : Op { | 159 struct ClipRect final : Op { |
| 160 static const auto kType = Type::ClipRect; | 160 static const auto kType = Type::ClipRect; |
| 161 ClipRect(const SkRect& rect, SkRegion::Op op, bool aa) : rect(rect), op(
op), aa(aa) {} | 161 ClipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) : rect(rect),
op(op), aa(aa) {} |
| 162 SkRect rect; | 162 SkRect rect; |
| 163 SkRegion::Op op; | 163 SkCanvas::ClipOp op; |
| 164 bool aa; | 164 bool aa; |
| 165 void draw(SkCanvas* c, const SkMatrix&) { c->clipRect(rect, op, aa); } | 165 void draw(SkCanvas* c, const SkMatrix&) { c->clipRect(rect, op, aa); } |
| 166 }; | 166 }; |
| 167 struct ClipRRect final : Op { | 167 struct ClipRRect final : Op { |
| 168 static const auto kType = Type::ClipRRect; | 168 static const auto kType = Type::ClipRRect; |
| 169 ClipRRect(const SkRRect& rrect, SkRegion::Op op, bool aa) : rrect(rrect)
, op(op), aa(aa) {} | 169 ClipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) : rrect(rr
ect), op(op), aa(aa) {} |
| 170 SkRRect rrect; | 170 SkRRect rrect; |
| 171 SkRegion::Op op; | 171 SkCanvas::ClipOp op; |
| 172 bool aa; | 172 bool aa; |
| 173 void draw(SkCanvas* c, const SkMatrix&) { c->clipRRect(rrect, op, aa); } | 173 void draw(SkCanvas* c, const SkMatrix&) { c->clipRRect(rrect, op, aa); } |
| 174 }; | 174 }; |
| 175 struct ClipRegion final : Op { | 175 struct ClipRegion final : Op { |
| 176 static const auto kType = Type::ClipRegion; | 176 static const auto kType = Type::ClipRegion; |
| 177 ClipRegion(const SkRegion& region, SkRegion::Op op) : region(region), op
(op) {} | 177 ClipRegion(const SkRegion& region, SkCanvas::ClipOp op) : region(region)
, op(op) {} |
| 178 SkRegion region; | 178 SkRegion region; |
| 179 SkRegion::Op op; | 179 SkCanvas::ClipOp op; |
| 180 void draw(SkCanvas* c, const SkMatrix&) { c->clipRegion(region, op); } | 180 void draw(SkCanvas* c, const SkMatrix&) { c->clipRegion(region, op); } |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 struct DrawPaint final : Op { | 183 struct DrawPaint final : Op { |
| 184 static const auto kType = Type::DrawPaint; | 184 static const auto kType = Type::DrawPaint; |
| 185 DrawPaint(const SkPaint& paint) : paint(paint) {} | 185 DrawPaint(const SkPaint& paint) : paint(paint) {} |
| 186 SkPaint paint; | 186 SkPaint paint; |
| 187 void draw(SkCanvas* c, const SkMatrix&) { c->drawPaint(paint); } | 187 void draw(SkCanvas* c, const SkMatrix&) { c->drawPaint(paint); } |
| 188 }; | 188 }; |
| 189 struct DrawPath final : Op { | 189 struct DrawPath final : Op { |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 void SkLiteDL::saveLayer(const SkRect* bounds, const SkPaint* paint, | 590 void SkLiteDL::saveLayer(const SkRect* bounds, const SkPaint* paint, |
| 591 const SkImageFilter* backdrop, SkCanvas::SaveLayerFlags
flags) { | 591 const SkImageFilter* backdrop, SkCanvas::SaveLayerFlags
flags) { |
| 592 this->push<SaveLayer>(0, bounds, paint, backdrop, flags); | 592 this->push<SaveLayer>(0, bounds, paint, backdrop, flags); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void SkLiteDL:: concat(const SkMatrix& matrix) { this->push <Concat>(0, ma
trix); } | 595 void SkLiteDL:: concat(const SkMatrix& matrix) { this->push <Concat>(0, ma
trix); } |
| 596 void SkLiteDL::setMatrix(const SkMatrix& matrix) { this->push<SetMatrix>(0, ma
trix); } | 596 void SkLiteDL::setMatrix(const SkMatrix& matrix) { this->push<SetMatrix>(0, ma
trix); } |
| 597 void SkLiteDL::translate(SkScalar dx, SkScalar dy) { this->push<Translate>(0, dx
, dy); } | 597 void SkLiteDL::translate(SkScalar dx, SkScalar dy) { this->push<Translate>(0, dx
, dy); } |
| 598 void SkLiteDL::translateZ(SkScalar dz) { this->push<TranslateZ>(0, dz); } | 598 void SkLiteDL::translateZ(SkScalar dz) { this->push<TranslateZ>(0, dz); } |
| 599 | 599 |
| 600 void SkLiteDL::clipPath(const SkPath& path, SkRegion::Op op, bool aa) { | 600 void SkLiteDL::clipPath(const SkPath& path, SkCanvas::ClipOp op, bool aa) { |
| 601 this->push<ClipPath>(0, path, op, aa); | 601 this->push<ClipPath>(0, path, op, aa); |
| 602 } | 602 } |
| 603 void SkLiteDL::clipRect(const SkRect& rect, SkRegion::Op op, bool aa) { | 603 void SkLiteDL::clipRect(const SkRect& rect, SkCanvas::ClipOp op, bool aa) { |
| 604 this->push<ClipRect>(0, rect, op, aa); | 604 this->push<ClipRect>(0, rect, op, aa); |
| 605 } | 605 } |
| 606 void SkLiteDL::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool aa) { | 606 void SkLiteDL::clipRRect(const SkRRect& rrect, SkCanvas::ClipOp op, bool aa) { |
| 607 this->push<ClipRRect>(0, rrect, op, aa); | 607 this->push<ClipRRect>(0, rrect, op, aa); |
| 608 } | 608 } |
| 609 void SkLiteDL::clipRegion(const SkRegion& region, SkRegion::Op op) { | 609 void SkLiteDL::clipRegion(const SkRegion& region, SkCanvas::ClipOp op) { |
| 610 this->push<ClipRegion>(0, region, op); | 610 this->push<ClipRegion>(0, region, op); |
| 611 } | 611 } |
| 612 | 612 |
| 613 void SkLiteDL::drawPaint(const SkPaint& paint) { | 613 void SkLiteDL::drawPaint(const SkPaint& paint) { |
| 614 this->push<DrawPaint>(0, paint); | 614 this->push<DrawPaint>(0, paint); |
| 615 } | 615 } |
| 616 void SkLiteDL::drawPath(const SkPath& path, const SkPaint& paint) { | 616 void SkLiteDL::drawPath(const SkPath& path, const SkPaint& paint) { |
| 617 this->push<DrawPath>(0, path, paint); | 617 this->push<DrawPath>(0, path, paint); |
| 618 } | 618 } |
| 619 void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) { | 619 void SkLiteDL::drawRect(const SkRect& rect, const SkPaint& paint) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 SkRect bounds = this->getBounds(); | 822 SkRect bounds = this->getBounds(); |
| 823 canvas->saveLayer(&bounds, paint); | 823 canvas->saveLayer(&bounds, paint); |
| 824 this->draw(canvas, matrix); | 824 this->draw(canvas, matrix); |
| 825 canvas->restore(); | 825 canvas->restore(); |
| 826 }; | 826 }; |
| 827 | 827 |
| 828 // TODO: single-draw specializations | 828 // TODO: single-draw specializations |
| 829 | 829 |
| 830 return fallback_plan(); | 830 return fallback_plan(); |
| 831 } | 831 } |
| OLD | NEW |