Refactor SkLiteDL to no longer extend SkDrawable.
Change-Id: Ieaa849bceba0e98e4c99491c721fe945a0694e68
Reviewed-on: https://skia-review.googlesource.com/9111
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index 330131f..7ffc22a 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -15,11 +15,13 @@
#include "SkRect.h"
#include "SkTDArray.h"
-class SkLiteDL final : public SkDrawable {
+class SkLiteDL final {
public:
- static sk_sp<SkLiteDL> New(SkRect);
- void reset(SkRect);
+ ~SkLiteDL();
+ void draw(SkCanvas* canvas);
+
+ void reset();
void makeThreadsafe();
bool empty() const { return fUsed == 0; }
@@ -27,13 +29,6 @@
void setDrawFilter(SkDrawFilter*);
#endif
- // Draws as if...
- // SkRect bounds = this->getBounds();
- // canvas->saveLayer(&bounds, paint);
- // this->draw(canvas, matrix);
- // canvas->restore();
- void drawAsLayer(SkCanvas*, const SkMatrix*, const SkPaint*);
-
void save();
void saveLayer(const SkRect*, const SkPaint*, const SkImageFilter*, SkCanvas::SaveLayerFlags);
void restore();
@@ -85,15 +80,7 @@
void drawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int,
SkBlendMode, const SkRect*, const SkPaint*);
- void setBounds(const SkRect& bounds);
-
private:
- SkLiteDL(SkRect);
- ~SkLiteDL();
-
- SkRect onGetBounds() override;
- void onDraw(SkCanvas*) override;
-
template <typename T, typename... Args>
void* push(size_t, Args&&...);
@@ -101,9 +88,8 @@
void map(const Fn[], Args...);
SkAutoTMalloc<uint8_t> fBytes;
- size_t fUsed;
- size_t fReserved;
- SkRect fBounds;
+ size_t fUsed = 0;
+ size_t fReserved = 0;
};
#endif//SkLiteDL_DEFINED