Bug 704558 - Added encoder options in encodeImage and encodeScaledImage. r=bbondy
authorTim Abraldes <tabraldes@mozilla.com>
Fri, 16 Dec 2011 19:43:10 -0500
changeset 82838 ff70e251a0f4cf13de82b37e6ef0b118354186a6
parent 82837 67eb3827b7eb3a14771d3033759da2d6c1bce1aa
child 82839 4726e2ddf570828ddbd948e1ca062865a4f284a5
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbbondy
bugs704558
milestone11.0a1
Bug 704558 - Added encoder options in encodeImage and encodeScaledImage. r=bbondy
image/public/imgITools.idl
image/src/imgTools.cpp
image/test/unit/image4gif16x16bmp24bpp.ico
image/test/unit/image4gif16x16bmp32bpp.ico
image/test/unit/image4gif32x32bmp24bpp.ico
image/test/unit/image4gif32x32bmp32bpp.ico
image/test/unit/test_imgtools.js
widget/src/windows/JumpListBuilder.cpp
--- a/image/public/imgITools.idl
+++ b/image/public/imgITools.idl
@@ -36,17 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
 interface nsIInputStream;
 interface imgIContainer;
 
-[scriptable, uuid(c395d8f1-c616-4a1b-adfd-747b4b1b2cbe)]
+[scriptable, uuid(1f19a2ce-cf5c-4a6b-8ba7-63785b45053f)]
 interface imgITools : nsISupports
 {
     /**
      * decodeImageData
      * Caller provides an input stream and mimetype. We read from the stream
      * and decompress it (according to the specified mime type) and return
      * the resulting imgIContainer. (If the caller already has a container,
      * it can be provided as input to be reused).
@@ -69,30 +69,36 @@ interface imgITools : nsISupports
      * encodeImage
      * Caller provides an image container, and the mime type it should be
      * encoded to. We return an input stream for the encoded image data.
      *
      * @param aContainer
      *        An image container.
      * @param aMimeType
      *        Type of encoded image desired (eg "image/png").
+     * @param outputOptions
+     *        Encoder-specific output options.
      */
     nsIInputStream encodeImage(in imgIContainer aContainer,
-                               in ACString aMimeType);
+                               in ACString aMimeType,
+                               [optional] in AString outputOptions);
 
     /**
      * encodeScaledImage
      * Caller provides an image container, and the mime type it should be
      * encoded to. We return an input stream for the encoded image data.
      * The encoded image is scaled to the specified dimensions.
      *
      * @param aContainer
      *        An image container.
      * @param aMimeType
      *        Type of encoded image desired (eg "image/png").
      * @param aWidth, aHeight
      *        The size (in pixels) desired for the resulting image.
+     * @param outputOptions
+     *        Encoder-specific output options.
      */
     nsIInputStream encodeScaledImage(in imgIContainer aContainer,
                                      in ACString aMimeType,
                                      in long aWidth,
-                                     in long aHeight);
+                                     in long aHeight,
+                                     [optional] in AString outputOptions);
 };
--- a/image/src/imgTools.cpp
+++ b/image/src/imgTools.cpp
@@ -126,26 +126,32 @@ NS_IMETHODIMP imgTools::DecodeImageData(
 
   // All done
   return NS_OK;
 }
 
 
 NS_IMETHODIMP imgTools::EncodeImage(imgIContainer *aContainer,
                                     const nsACString& aMimeType,
+                                    const nsAString& aOutputOptions,
                                     nsIInputStream **aStream)
 {
-    return EncodeScaledImage(aContainer, aMimeType, 0, 0, aStream);
+    return EncodeScaledImage(aContainer,
+                             aMimeType,
+                             0,
+                             0,
+                             aOutputOptions,
+                             aStream);
 }
 
-
 NS_IMETHODIMP imgTools::EncodeScaledImage(imgIContainer *aContainer,
                                           const nsACString& aMimeType,
                                           PRInt32 aScaledWidth,
                                           PRInt32 aScaledHeight,
+                                          const nsAString& aOutputOptions,
                                           nsIInputStream **aStream)
 {
   nsresult rv;
   bool doScaling = true;
   PRUint8 *bitmapData;
   PRUint32 bitmapDataLength, strideSize;
 
   // If no scaled size is specified, we'll just encode the image at its
@@ -210,16 +216,20 @@ NS_IMETHODIMP imgTools::EncodeScaledImag
     ctx.Paint();
 
     bitmapData = dest->Data();
     strideSize = dest->Stride();
     bitmapDataLength = aScaledHeight * strideSize;
   }
 
   // Encode the bitmap
-  rv = encoder->InitFromData(bitmapData, bitmapDataLength,
-                             aScaledWidth, aScaledHeight, strideSize,
-                             imgIEncoder::INPUT_FORMAT_HOSTARGB, EmptyString());
+  rv = encoder->InitFromData(bitmapData,
+                             bitmapDataLength,
+                             aScaledWidth,
+                             aScaledHeight,
+                             strideSize,
+                             imgIEncoder::INPUT_FORMAT_HOSTARGB,
+                             aOutputOptions);
 
   NS_ENSURE_SUCCESS(rv, rv);
 
   return CallQueryInterface(encoder, aStream);
 }
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..890c81c272331dceccaeca6057f040d60fe801ac
GIT binary patch
literal 894
zc${NkU<5(|0R|u`!H~hsz#zuJz@P!dKp_SN28cKqFf(9)KmY#z{`=?ezdwI}|9kWL
z*W88Yk~4OA`mgklULRe$Y39mfmmj|V`RCuSKmY#x{|iLF{{mJ2{`KR}id9$DjOTHP
zE#;Bj$R)X!Lu)&a%TB4H^JeY)T2}0P|LrG4J<$9=fBsCHdqq%rF^}RdW~pt$_9sOB
zF3ZN<l+C%zR(e-t$y4>+_cNDmd-we(&~PBwcle2*!76c&Q&KV4B{OeJ7v0w>yJ=8)
zQ?Kf_Z1HWjysJvb-dmn|KI6dYU;qAm|MAZ;biG*2WyykvqJ<CS3LYq@9n>+&bW?QD
z6gSiK?NYA2DY)dh|I^=L`_Dc8{Q20KSCYPaMDjt3xl$eo2A$^B>5(<6R1ncqW9L-k
z6fpI#)L3&>efOKxr$5%8y4*bZgmV5h>B0v>G1pnW&#R@Lb12^CRK7o;{y=C%njsgP
zfq-zt^p#3G-@07<+OqpxOyfD_%6rnq_jw$)^BArOO>CP`kua+|d}ec6XR?i}7=yJC
zOJds;@zt+XPJYZic&~WLL)Dsl62<qVvu+DGtaXfTpVX4KZA#3JDG|N#T48Do(K_5Q
zewKPG&-y(4;k5F6^VY}ebvGqT?nxHimn*(!)o>-hp?Ur6gdNj;ikt*<Z20FCId$f{
zxUD+kd-r$fx>LvReKKsiC0Tk8s0HXM*}NNx{b#FNYIZM)-8(n9Cs}Ln%;4n{<IVe4
z*d6;g@6w}BfBv}EpHZv0rCM=IqvD1_#-7%x{cBfNT-aA~bzlCu?RhIYd`fC!j5b~M
z*z@H0gJ(bf{Y#v1!>wXRUdMvW2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P?&%I)D}C(_r$=(pJxv~wdM1tDR?h>x8CNMn`iVC{=-DXA2wWaMc&ZvpFbbGSA^d)
zKI{Fb)%Q_9A1)rmcTs+ti8^=3i0|s&s0!X?K98Sn|Npt)jh#KMspaE6b=dDu(<lE&
I;EVnFKNBh~3jhEB
--- a/image/test/unit/test_imgtools.js
+++ b/image/test/unit/test_imgtools.js
@@ -337,16 +337,104 @@ outParam = { value: null };
 imgTools.decodeImageData(istream, inMimeType, outParam);
 container = outParam.value;
 
 // It's not easy to look at the pixel values from JS, so just
 // check the container's size.
 do_check_eq(container.width, 32);
 do_check_eq(container.height, 32);
 
+/* ========== 11 ========== */
+testnum++;
+testdesc = "test encoding an unscaled ICO with format options " +
+           "(format=bmp;bpp=32)";
+
+// we'll reuse the container from the previous test
+istream = imgTools.encodeImage(container,
+                               "image/vnd.microsoft.icon",
+                               "format=bmp;bpp=32");
+encodedBytes = streamToArray(istream);
+
+// Get bytes for exected result
+refName = "image4gif32x32bmp32bpp.ico";
+refFile = do_get_file(refName);
+istream = getFileInputStream(refFile);
+do_check_eq(istream.available(), 4286);
+referenceBytes = streamToArray(istream);
+
+// compare the encoder's output to the reference file.
+compareArrays(encodedBytes, referenceBytes);
+
+/* ========== 12 ========== */
+testnum++;
+testdesc = "test encoding a scaled ICO with format options " +
+           "(format=bmp;bpp=32)";
+
+// we'll reuse the container from the previous test
+istream = imgTools.encodeScaledImage(container,
+                                     "image/vnd.microsoft.icon",
+                                     16,
+                                     16,
+                                     "format=bmp;bpp=32");
+encodedBytes = streamToArray(istream);
+
+// Get bytes for exected result
+refName = "image4gif16x16bmp32bpp.ico";
+refFile = do_get_file(refName);
+istream = getFileInputStream(refFile);
+do_check_eq(istream.available(), 1150);
+referenceBytes = streamToArray(istream);
+
+// compare the encoder's output to the reference file.
+compareArrays(encodedBytes, referenceBytes);
+
+/* ========== 13 ========== */
+testnum++;
+testdesc = "test encoding an unscaled ICO with format options " +
+           "(format=bmp;bpp=24)";
+
+// we'll reuse the container from the previous test
+istream = imgTools.encodeImage(container,
+                               "image/vnd.microsoft.icon",
+                               "format=bmp;bpp=24");
+encodedBytes = streamToArray(istream);
+
+// Get bytes for exected result
+refName = "image4gif32x32bmp24bpp.ico";
+refFile = do_get_file(refName);
+istream = getFileInputStream(refFile);
+do_check_eq(istream.available(), 3262);
+referenceBytes = streamToArray(istream);
+
+// compare the encoder's output to the reference file.
+compareArrays(encodedBytes, referenceBytes);
+
+/* ========== 14 ========== */
+testnum++;
+testdesc = "test encoding a scaled ICO with format options " +
+           "(format=bmp;bpp=24)";
+
+// we'll reuse the container from the previous test
+istream = imgTools.encodeScaledImage(container,
+                                     "image/vnd.microsoft.icon",
+                                     16,
+                                     16,
+                                     "format=bmp;bpp=24");
+encodedBytes = streamToArray(istream);
+
+// Get bytes for exected result
+refName = "image4gif16x16bmp24bpp.ico";
+refFile = do_get_file(refName);
+istream = getFileInputStream(refFile);
+do_check_eq(istream.available(), 894);
+referenceBytes = streamToArray(istream);
+
+// compare the encoder's output to the reference file.
+compareArrays(encodedBytes, referenceBytes);
+
 
 /* ========== bug 363986 ========== */
 testnum = 363986;
 testdesc = "test PNG and JPEG encoders' Read/ReadSegments methods";
 
 var testData = 
     [{preImage: "image3.ico",
       preImageMimeType: "image/x-icon",
--- a/widget/src/windows/JumpListBuilder.cpp
+++ b/widget/src/windows/JumpListBuilder.cpp
@@ -632,16 +632,17 @@ NS_IMETHODIMP AsyncWriteIconToDisk::Run(
     systemIconHeight = 16;
   }
   // Scale the image to the needed size and in ICO format
   mMimeTypeOfInputData.AssignLiteral("image/vnd.microsoft.icon");
   nsCOMPtr<nsIInputStream> iconStream;
   rv = imgtool->EncodeScaledImage(container, mMimeTypeOfInputData,
                                   systemIconWidth,
                                   systemIconHeight,
+                                  EmptyString(),
                                   getter_AddRefs(iconStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsILocalFile> icoFile
     = do_CreateInstance("@mozilla.org/file/local;1");
   NS_ENSURE_TRUE(icoFile, NS_ERROR_FAILURE);
   rv = icoFile->InitWithPath(mIconPath);