forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
405 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2022 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef SkManagedIDChangeListener_h | ||
#define SkManagedIDChangeListener_h | ||
|
||
#include "include/private/SkIDChangeListener.h" | ||
#include "include/core/SkTypes.h" | ||
|
||
class SkIDChangeListener; | ||
|
||
class SK_API SkManagedIDChangeListener; | ||
|
||
// delegate declarations | ||
|
||
// managed Allocator | ||
class SkManagedIDChangeListener : public SkIDChangeListener { | ||
public: | ||
SkManagedIDChangeListener(void* context); | ||
|
||
~SkManagedIDChangeListener() override; | ||
|
||
public: | ||
typedef void (*ChangedProc) (SkManagedIDChangeListener* d, void* context); | ||
typedef void (*DestroyProc) (SkManagedIDChangeListener* d, void* context); | ||
|
||
struct Procs { | ||
ChangedProc fChanged = nullptr; | ||
DestroyProc fDestroy = nullptr; | ||
}; | ||
|
||
static void setProcs(Procs procs); | ||
|
||
protected: | ||
void changed() override; | ||
|
||
private: | ||
void* fContext; | ||
static Procs fProcs; | ||
|
||
typedef SkIDChangeListener INHERITED; | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2022 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef SkManagedIDChangeListenerList_h | ||
#define SkManagedIDChangeListenerList_h | ||
|
||
#include "include/private/SkIDChangeListener.h" | ||
#include "include/core/SkTypes.h" | ||
|
||
class SK_API SkManagedIDChangeListenerList; | ||
|
||
// delegate declarations | ||
|
||
// managed Allocator | ||
class SkManagedIDChangeListenerList : public SkIDChangeListener::List { | ||
public: | ||
SkManagedIDChangeListenerList(void* context); | ||
|
||
~SkManagedIDChangeListenerList(); | ||
|
||
typedef void (*DestroyProc)(SkManagedIDChangeListenerList* d, void* context); | ||
|
||
struct Procs { | ||
DestroyProc fDestroy = nullptr; | ||
}; | ||
|
||
static void setProcs(Procs procs); | ||
|
||
private: | ||
void* fContext; | ||
static Procs fProcs; | ||
|
||
typedef SkIDChangeListener::List INHERITED; | ||
}; | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2014 Google Inc. | ||
* Copyright 2015 Xamarin Inc. | ||
* Copyright 2017 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef sk_managedidchangelistener_DEFINED | ||
#define sk_managedidchangelistener_DEFINED | ||
|
||
#include "sk_xamarin.h" | ||
|
||
#include "include/c/sk_types.h" | ||
|
||
SK_C_PLUS_PLUS_BEGIN_GUARD | ||
|
||
typedef void (*sk_idchangelistener_changed_proc)(sk_idchangelistener_t* d, void* context); | ||
typedef void (*sk_idchangelistener_destroy_proc)(sk_idchangelistener_t* d, void* context); | ||
|
||
typedef struct { | ||
sk_idchangelistener_changed_proc fChanged; | ||
sk_idchangelistener_destroy_proc fDestroy; | ||
} sk_idchangelistener_procs_t; | ||
|
||
SK_X_API sk_idchangelistener_t* sk_managedidchangelistener_new(void* context); | ||
SK_X_API void sk_managedidchangelistener_delete(sk_idchangelistener_t*); | ||
SK_X_API void sk_managedidchangelistener_mark_should_deregister(sk_idchangelistener_t*); | ||
SK_X_API bool sk_managedidchangelistener_should_deregister(sk_idchangelistener_t*); | ||
SK_X_API void sk_managedidchangelistener_set_procs(sk_idchangelistener_procs_t procs); | ||
|
||
SK_C_PLUS_PLUS_END_GUARD | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2014 Google Inc. | ||
* Copyright 2015 Xamarin Inc. | ||
* Copyright 2017 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef sk_managedidchangelistenerlist_DEFINED | ||
#define sk_managedidchangelistenerlist_DEFINED | ||
|
||
#include "sk_xamarin.h" | ||
|
||
#include "include/c/sk_types.h" | ||
|
||
SK_C_PLUS_PLUS_BEGIN_GUARD | ||
|
||
typedef void (*sk_idchangelistenerlist_destroy_proc)(sk_idchangelistenerlist_t* d, void* context); | ||
|
||
typedef struct { | ||
sk_idchangelistenerlist_destroy_proc fDestroy; | ||
} sk_idchangelistenerlist_procs_t; | ||
|
||
SK_X_API sk_idchangelistenerlist_t* sk_managedidchangelistenerlist_new(void* context); | ||
SK_X_API void sk_managedidchangelistenerlist_delete(sk_idchangelistenerlist_t*); | ||
SK_X_API void sk_managedidchangelistenerlist_add(sk_idchangelistenerlist_t*, sk_idchangelistener_t*, bool single_threaded); | ||
SK_X_API int32_t sk_managedidchangelistenerlist_count(sk_idchangelistenerlist_t*); | ||
SK_X_API void sk_managedidchangelistenerlist_changed(sk_idchangelistenerlist_t*, bool single_threaded); | ||
SK_X_API void sk_managedidchangelistenerlist_reset(sk_idchangelistenerlist_t*, bool single_threaded); | ||
SK_X_API void sk_managedidchangelistenerlist_set_procs(sk_idchangelistenerlist_procs_t procs); | ||
|
||
SK_C_PLUS_PLUS_END_GUARD | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2014 Google Inc. | ||
* Copyright 2015 Xamarin Inc. | ||
* Copyright 2017 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#ifndef sk_idchangelistener_DEFINED | ||
#define sk_idchangelistener_DEFINED | ||
|
||
#include "include/c/sk_idchangelistener.h" | ||
#include "src/c/sk_types_priv.h" | ||
|
||
static inline SkIDChangeListener* AsSkIDChangeListener(sk_idchangelistener_t* d) { | ||
return reinterpret_cast<SkIDChangeListener*>(d); | ||
} | ||
|
||
static sk_idchangelistener_procs_t gProcs; | ||
|
||
void changed(SkIDChangeListener* d, void* context) { | ||
if (gProcs.fChanged) { | ||
gProcs.fChanged(ToSkIDChangeListener(d), context); | ||
} | ||
} | ||
|
||
sk_idchangelistener_t* sk_idchangelistener_new(void* context) { | ||
return ToSKIDChangeListener(new SkIDChangeListener(context)); | ||
} | ||
|
||
void sk_idchangelistener_delete(sk_idchangelistener_t* d) { delete AsManagedAllocator(d); } | ||
|
||
void sk_idchangelistener_set_procs(sk_idchangelistener_procs_t procs) { | ||
gProcs = procs; | ||
|
||
SkManagedAllocator::Procs p; | ||
p.fAllocPixelRef = allocPixelRef; | ||
|
||
SkManagedAllocator::setProcs(p); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2022 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#include "include/xamarin/SkManagedIDChangeListener.h" | ||
|
||
SkManagedIDChangeListener::Procs SkManagedIDChangeListener::fProcs; | ||
|
||
void SkManagedIDChangeListener::setProcs(SkManagedIDChangeListener::Procs procs) { | ||
fProcs = procs; | ||
} | ||
|
||
SkManagedIDChangeListener::SkManagedIDChangeListener(void* context) { | ||
fContext = context; | ||
} | ||
|
||
SkManagedIDChangeListener::~SkManagedIDChangeListener() { | ||
if (fProcs.fDestroy) { | ||
fProcs.fDestroy(this, fContext); | ||
} | ||
} | ||
|
||
void SkManagedIDChangeListener::changed() { | ||
if (fProcs.fChanged) { | ||
fProcs.fChanged(this, fContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright 2022 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
#include "include/xamarin/SkManagedIDChangeListenerList.h" | ||
|
||
SkManagedIDChangeListenerList::Procs SkManagedIDChangeListenerList::fProcs; | ||
|
||
void SkManagedIDChangeListenerList::setProcs(SkManagedIDChangeListenerList::Procs procs) { | ||
fProcs = procs; | ||
} | ||
|
||
SkManagedIDChangeListenerList::SkManagedIDChangeListenerList(void* context) { | ||
fContext = context; | ||
} | ||
|
||
SkManagedIDChangeListenerList::~SkManagedIDChangeListenerList() { | ||
if (fProcs.fDestroy) { | ||
fProcs.fDestroy(this, fContext); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright 2022 Microsoft Corporation. All rights reserved. | ||
* | ||
* Use of this source code is governed by a BSD-style license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
|
||
#include "include/xamarin/sk_managedidchangelistener.h" | ||
#include "include/xamarin/SkManagedIDChangeListener.h" | ||
|
||
#include "src/c/sk_types_priv.h" | ||
|
||
static inline SkManagedIDChangeListener* AsSkManagedIDChangeListener(sk_idchangelistener_t* d) { | ||
return reinterpret_cast<SkManagedIDChangeListener*>(d); | ||
} | ||
static inline sk_idchangelistener_t* ToSkManagedIDChangeListener(SkManagedIDChangeListener* d) { | ||
return reinterpret_cast<sk_idchangelistener_t*>(d); | ||
} | ||
|
||
static sk_idchangelistener_procs_t gProcs; | ||
|
||
void changed(SkManagedIDChangeListener* d, void* context) { | ||
if (gProcs.fChanged) { | ||
gProcs.fChanged(ToSkManagedIDChangeListener(d), context); | ||
} | ||
} | ||
|
||
void destroy(SkManagedIDChangeListener* d, void* context) { | ||
if (gProcs.fDestroy) { | ||
gProcs.fDestroy(ToSkManagedIDChangeListener(d), context); | ||
} | ||
} | ||
|
||
sk_idchangelistener_t* sk_managedidchangelistener_new(void* context) { | ||
return ToSkManagedIDChangeListener(new SkManagedIDChangeListener(context)); | ||
} | ||
|
||
void sk_managedidchangelistener_delete(sk_idchangelistener_t* d) { | ||
delete AsSkManagedIDChangeListener(d); | ||
} | ||
|
||
void sk_managedidchangelistener_mark_should_deregister(sk_idchangelistener_t* d) { | ||
AsSkManagedIDChangeListener(d)->markShouldDeregister(); | ||
} | ||
|
||
bool sk_managedidchangelistener_should_deregister(sk_idchangelistener_t* d) { | ||
return AsSkManagedIDChangeListener(d)->shouldDeregister(); | ||
} | ||
|
||
void sk_managedidchangelistener_set_procs(sk_idchangelistener_procs_t procs) { | ||
gProcs = procs; | ||
|
||
SkManagedIDChangeListener::Procs p; | ||
p.fChanged = changed; | ||
p.fDestroy = destroy; | ||
|
||
SkManagedIDChangeListener::setProcs(p); | ||
} |
Oops, something went wrong.