Closed Bug 986526 Opened 11 years ago Closed 10 years ago

Create a helper function to encode SourceSurfaces to PNG/JPEG/BMP/ICO

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

Attachments

(1 file, 1 obsolete file)

We currently have methods on gfxASurface to encode the surface to PNG/JPEG/BMP/ICO and write out the encoded data to file, stdout or to the clipboard. We don't want to create a gfxASurface in order to do these things for a SourceSurface though. We should create separate helpers for SourceSurface then start to migrate code over to these new helpers.
Attached patch WIP (obsolete) (deleted) — Splinter Review
Attached patch patch (deleted) — Splinter Review
I've made this fairly general because I have more WIP code to make other parts of the codebase use these helpers rather than create their own encoder. I keep getting bitrotted though, so I'd like to get this part out of my queue. This is prerequisite work to getting rid of various Thebes backed gfxContexts.
Attachment #8394836 - Attachment is obsolete: true
Attachment #8446794 - Flags: review?(matt.woodrow)
Comment on attachment 8446794 [details] [diff] [review] patch Review of attachment 8446794 [details] [diff] [review]: ----------------------------------------------------------------- ::: gfx/thebes/gfxUtils.h @@ +269,5 @@ > +#ifdef DEBUG > + static void WriteAsPNG(nsIPresShell* aShell, const char* aFile); > +#endif > + > +#if defined(DEBUG) || defined(MOZ_DUMP_PAINTING) Let's just make these always defined. There shouldn't be any runtime overhead for having them around, and they can be useful in opt builds. ::: layout/reftests/svg/as-image/lime100x100-noSVGDimensions.svg @@ +1,3 @@ > <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> > <rect width="100" height="100" fill="lime"/> > + <circle cx="50" cy="50" r="50" fill="red"/> I assume this change wasn't meant to be here?
Attachment #8446794 - Flags: review?(matt.woodrow) → review+
Blocks: 1031055
Blocks: 1031079
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33

Please do not use fopen(NS_ConvertUTF16toUTF8(mIconPath), ...). It will break if mIconPath contains a non-ASCII character. Use _wfopen(mIconPath, ...) instead.

Depends on: 1529902
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: