aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-15 15:48:36 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-15 15:48:36 +0000
commit73cb15351f33459e0c861a96135c634dec77ef9d (patch)
treecf521a48286c5cd88354056e65a933cc63f8fbe1 /src/effects
parentbeb8b3a4da83ce30e313e72ae0e444870acecb7e (diff)
Make sure SkDrawLooper objects can only be allocated on the heap.
Make constructors of SkLayerDrawLooper and SkBlurDrawLooper non-public. Remove addLayer* methods from SkLayerDrawLooper. SkLayerDrawLooper::Builder is used to create new objects. Provide factory method for creating SkBlurDrawLooper. BUG=2141 R=scroggo@google.com, reed@google.com, djsollen@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/232913003 git-svn-id: http://skia.googlecode.com/svn/trunk@14200 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkBlurDrawLooper.cpp2
-rw-r--r--src/effects/SkLayerDrawLooper.cpp38
2 files changed, 2 insertions, 38 deletions
diff --git a/src/effects/SkBlurDrawLooper.cpp b/src/effects/SkBlurDrawLooper.cpp
index 2caa62e5ad..5cfb8d884d 100644
--- a/src/effects/SkBlurDrawLooper.cpp
+++ b/src/effects/SkBlurDrawLooper.cpp
@@ -17,10 +17,12 @@
#include "SkString.h"
#include "SkStringUtils.h"
+#ifdef SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS
SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy,
SkColor color, uint32_t flags) {
this->init(SkBlurMask::ConvertRadiusToSigma(radius), dx, dy, color, flags);
}
+#endif
SkBlurDrawLooper::SkBlurDrawLooper(SkColor color, SkScalar sigma,
SkScalar dx, SkScalar dy, uint32_t flags) {
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index 962ca293d8..5fbb550f75 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -36,44 +36,6 @@ SkLayerDrawLooper::~SkLayerDrawLooper() {
}
}
-SkPaint* SkLayerDrawLooper::addLayer(const LayerInfo& info) {
- fCount += 1;
-
- Rec* rec = SkNEW(Rec);
- rec->fNext = fRecs;
- rec->fInfo = info;
- fRecs = rec;
- if (NULL == fTopRec) {
- fTopRec = rec;
- }
-
- return &rec->fPaint;
-}
-
-void SkLayerDrawLooper::addLayer(SkScalar dx, SkScalar dy) {
- LayerInfo info;
-
- info.fOffset.set(dx, dy);
- (void)this->addLayer(info);
-}
-
-SkPaint* SkLayerDrawLooper::addLayerOnTop(const LayerInfo& info) {
- fCount += 1;
-
- Rec* rec = SkNEW(Rec);
- rec->fNext = NULL;
- rec->fInfo = info;
- if (NULL == fRecs) {
- fRecs = rec;
- } else {
- SkASSERT(NULL != fTopRec);
- fTopRec->fNext = rec;
- }
- fTopRec = rec;
-
- return &rec->fPaint;
-}
-
SkLayerDrawLooper::Context* SkLayerDrawLooper::createContext(SkCanvas* canvas, void* storage) const {
canvas->save(SkCanvas::kMatrix_SaveFlag);
return SkNEW_PLACEMENT_ARGS(storage, LayerDrawLooperContext, (this));