forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 62
add png chunk reader, expose more of codec and bitmap #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mgood7123
wants to merge
13
commits into
mono:xamarin-mobile-bindings
Choose a base branch
from
mgood7123:png_chunk_reader_codec_bitmap
base: xamarin-mobile-bindings
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ec8d84c
add png chunk reader, expose more of codec and bitmap
mgood7123 7223d03
replace // with #
mgood7123 99d4501
remove seperation comments
mgood7123 4d840a0
move get_dimensions to C# land
mgood7123 6609362
apply suggestion
mgood7123 f07800c
original C api must be kept
mgood7123 56e7c42
move read_pixels to C# land
mgood7123 f17efc6
rename to match naming convention
mgood7123 a5e40b9
rename to match naming convention
mgood7123 8daaac1
rename to match
mgood7123 9a34bca
undo renamed skia selection policy
mgood7123 e08263f
add enum guard
mgood7123 84d1952
Merge branch 'xamarin-mobile-bindings' into pr/mgood7123/88
mattleibow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,46 @@ | ||
/* | ||
* 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 SkManagedPngChunkReader_h | ||
#define SkManagedPngChunkReader_h | ||
|
||
#include "include/core/SkPngChunkReader.h" | ||
#include "include/core/SkTypes.h" | ||
|
||
class SK_API SkManagedPngChunkReader; | ||
|
||
// delegate declarations | ||
|
||
class SkManagedPngChunkReader : public SkPngChunkReader { | ||
public: | ||
SkManagedPngChunkReader(void* context); | ||
|
||
~SkManagedPngChunkReader() override; | ||
|
||
public: | ||
typedef bool (*ReadChunkProc) (SkManagedPngChunkReader* d, void* context, const char* tag, const void* data, size_t length); | ||
typedef void (*DestroyProc) (SkManagedPngChunkReader* d, void* context); | ||
|
||
struct Procs { | ||
ReadChunkProc fReadChunk = nullptr; | ||
DestroyProc fDestroy = nullptr; | ||
}; | ||
|
||
static void setProcs(Procs procs); | ||
|
||
protected: | ||
bool readChunk(const char tag[], const void* data, size_t length) override; | ||
|
||
private: | ||
void* fContext; | ||
static Procs fProcs; | ||
|
||
typedef SkPngChunkReader INHERITED; | ||
}; | ||
|
||
|
||
#endif |
This file contains hidden or 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,33 @@ | ||
/* | ||
* 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 sk_managedpngchunkreader_DEFINED | ||
#define sk_managedpngchunkreader_DEFINED | ||
|
||
#include "sk_xamarin.h" | ||
|
||
#include "include/c/sk_types.h" | ||
|
||
SK_C_PLUS_PLUS_BEGIN_GUARD | ||
|
||
typedef struct sk_managedpngchunkreader_t sk_managedpngchunkreader_t; | ||
|
||
typedef bool (*sk_managedpngchunkreader_read_chunk_proc) (sk_managedpngchunkreader_t* d, void* context, const char tag[], const void* data, size_t length); | ||
typedef void (*sk_managedpngchunkreader_destroy_proc) (sk_managedpngchunkreader_t* d, void* context); | ||
|
||
typedef struct { | ||
sk_managedpngchunkreader_read_chunk_proc fReadChunk; | ||
sk_managedpngchunkreader_destroy_proc fDestroy; | ||
} sk_managedpngchunkreader_procs_t; | ||
|
||
SK_X_API sk_managedpngchunkreader_t* sk_managedpngchunkreader_new(void* context); | ||
SK_X_API void sk_managedpngchunkreader_delete(sk_managedpngchunkreader_t*); | ||
SK_X_API void sk_managedpngchunkreader_set_procs(sk_managedpngchunkreader_procs_t procs); | ||
|
||
SK_C_PLUS_PLUS_END_GUARD | ||
|
||
#endif |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
/* | ||
* 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/SkManagedPngChunkReader.h" | ||
|
||
SkManagedPngChunkReader::Procs SkManagedPngChunkReader::fProcs; | ||
|
||
void SkManagedPngChunkReader::setProcs(SkManagedPngChunkReader::Procs procs) { | ||
fProcs = procs; | ||
} | ||
|
||
SkManagedPngChunkReader::SkManagedPngChunkReader(void* context) { | ||
fContext = context; | ||
} | ||
|
||
SkManagedPngChunkReader::~SkManagedPngChunkReader() { | ||
if (!fProcs.fDestroy) return; | ||
fProcs.fDestroy(this, fContext); | ||
} | ||
|
||
bool SkManagedPngChunkReader::readChunk(const char tag[], const void* data, size_t length) { | ||
if (!fProcs.fReadChunk) return false; | ||
return fProcs.fReadChunk(this, fContext, tag, data, length); | ||
} |
This file contains hidden or 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 hidden or 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,48 @@ | ||
/* | ||
* 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/SkManagedPngChunkReader.h" | ||
|
||
#include "include/xamarin/sk_managedpngchunkreader.h" | ||
#include "src/c/sk_types_priv.h" | ||
|
||
static inline SkManagedPngChunkReader* AsManagedPngChunkReader(sk_managedpngchunkreader_t* d) { | ||
return reinterpret_cast<SkManagedPngChunkReader*>(d); | ||
} | ||
static inline sk_managedpngchunkreader_t* ToManagedPngChunkReader(SkManagedPngChunkReader* d) { | ||
return reinterpret_cast<sk_managedpngchunkreader_t*>(d); | ||
} | ||
|
||
static sk_managedpngchunkreader_procs_t gProcs; | ||
|
||
bool readChunk(SkManagedPngChunkReader* d, void* context, const char tag[], const void* data, size_t length) { | ||
if (!gProcs.fReadChunk) return false; | ||
return gProcs.fReadChunk(ToManagedPngChunkReader(d), context, tag, data, length); | ||
} | ||
|
||
void destroy(SkManagedPngChunkReader* d, void* context) { | ||
if (!gProcs.fDestroy) return; | ||
gProcs.fDestroy(ToManagedPngChunkReader(d), context); | ||
} | ||
|
||
sk_managedpngchunkreader_t* sk_managedpngchunkreader_new(void* context) { | ||
return ToManagedPngChunkReader(new SkManagedPngChunkReader(context)); | ||
} | ||
|
||
void sk_managedpngchunkreader_delete(sk_managedpngchunkreader_t* d) { | ||
delete AsManagedPngChunkReader(d); | ||
} | ||
|
||
void sk_managedpngchunkreader_set_procs(sk_managedpngchunkreader_procs_t procs) { | ||
gProcs = procs; | ||
|
||
SkManagedPngChunkReader::Procs p; | ||
p.fReadChunk = readChunk; | ||
p.fDestroy = destroy; | ||
|
||
SkManagedPngChunkReader::setProcs(p); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.