static void setDelegates(const draw_delegate pDraw,
const getBounds_delegate pgetBounds,
const newPictureSnapshot_delegate pNewPictureSnapshot);
-
+
protected:
void onDraw(SkCanvas*) override;
SkRect onGetBounds() override;
SkPicture* onNewPictureSnapshot() override;
-
+
typedef SkDrawable INHERITED;
};
#include "sk_picture.h"
#include "sk_types_priv.h"
-
-void sk_drawable_unref(sk_drawable_t* drawable)
-{
- SkSafeUnref(AsDrawable(drawable));
+
+void sk_drawable_unref(sk_drawable_t* drawable)
+{
+ SkSafeUnref(AsDrawable(drawable));
}
-uint32_t sk_drawable_get_generation_id(sk_drawable_t* d)
-{
- return AsDrawable(d)->getGenerationID();
+uint32_t sk_drawable_get_generation_id(sk_drawable_t* d)
+{
+ return AsDrawable(d)->getGenerationID();
}
void sk_drawable_get_bounds(sk_drawable_t* d, sk_rect_t* rect)
-{
- *rect = ToRect(AsDrawable(d)->getBounds());
+{
+ *rect = ToRect(AsDrawable(d)->getBounds());
}
void sk_drawable_draw(sk_drawable_t* d, sk_canvas_t* c, sk_matrix_t* matrix)
{
- AsDrawable(d)->draw(AsCanvas(c), &AsMatrix(matrix));
+ SkMatrix m;
+ if (matrix) {
+ m = AsMatrix(matrix);
+ }
+ AsDrawable(d)->draw(AsCanvas(c), matrix ? &m : nullptr);
}
sk_picture_t* sk_drawable_new_picture_snapshot(sk_drawable_t* d)
-{
- return ToPicture(AsDrawable(d)->newPictureSnapshot());
+{
+ return ToPicture(AsDrawable(d)->newPictureSnapshot());
}
void sk_drawable_notify_drawing_changed(sk_drawable_t* d)
return reinterpret_cast<sk_manageddrawable_t*>(drawable);
}
-static inline const sk_manageddrawable_t* ToManagedDrawable(const SkManagedDrawable* drawable)
-{
- return reinterpret_cast<const sk_manageddrawable_t*>(drawable);
-}
-
void dDraw(SkManagedDrawable* managedDrawable, SkCanvas* canvas)
{
gDraw(ToManagedDrawable(managedDrawable), ToCanvas(canvas));
}
sk_manageddrawable_t* sk_manageddrawable_new() {
- return ToManagedDrawable(new SkManagedDrawable());
+ return ToManagedDrawable(new SkManagedDrawable());
}
void sk_manageddrawable_destroy(sk_manageddrawable_t* drawable)