Move SkDecodingImageGenerator.h to include/
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 27 May 2014 14:59:47 +0000 (14:59 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 27 May 2014 14:59:47 +0000 (14:59 +0000)
This will allow Android to access it and remove SkImageRef.

Depends on https://codereview.chromium.org/293283002/

BUG=skia:2389
R=reed@google.com, djsollen@google.com, halcanary@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/228613003

git-svn-id: http://skia.googlecode.com/svn/trunk@14891 2bbb7eff-a529-9590-31e7-b0007b416f81

gyp/images.gyp
include/images/SkDecodingImageGenerator.h [new file with mode: 0644]
src/images/SkDecodingImageGenerator.h [deleted file]

index 415b8052d0a3e0c8d5f5182a30df1e7f8f8a871f..0062f24f1d1d56ab6102fd5e20c40da55ed4fd57 100644 (file)
@@ -31,6 +31,7 @@
         '../src/images/',
       ],
       'sources': [
+        '../include/images/SkDecodingImageGenerator.h',
         '../include/images/SkForceLinking.h',
         '../include/images/SkImageRef.h',
         '../include/images/SkImageRef_GlobalPool.h',
@@ -42,7 +43,6 @@
         '../src/images/bmpdecoderhelper.h',
 
         '../src/images/SkDecodingImageGenerator.cpp',
-        '../src/images/SkDecodingImageGenerator.h',
         '../src/images/SkForceLinking.cpp',
         '../src/images/SkImageDecoder.cpp',
         '../src/images/SkImageDecoder_FactoryDefault.cpp',
diff --git a/include/images/SkDecodingImageGenerator.h b/include/images/SkDecodingImageGenerator.h
new file mode 100644 (file)
index 0000000..6cb39be
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkDecodingImageGenerator_DEFINED
+#define SkDecodingImageGenerator_DEFINED
+
+#include "SkBitmap.h"
+#include "SkImageGenerator.h"
+
+class SkData;
+class SkStreamRewindable;
+
+/**
+ *  An implementation of SkImageGenerator that calls into
+ *  SkImageDecoder.
+ */
+namespace SkDecodingImageGenerator {
+    /**
+     *  These options will be passed on to the image decoder.  The
+     *  defaults are sensible.
+     *
+     *  @param fSampleSize If set to > 1, tells the decoder to return a
+     *         smaller than original bitmap, sampling 1 pixel for
+     *         every size pixels. e.g. if sample size is set to 3,
+     *         then the returned bitmap will be 1/3 as wide and high,
+     *         and will contain 1/9 as many pixels as the original.
+     *         Note: this is a hint, and the codec may choose to
+     *         ignore this, or only approximate the sample size.
+     *
+     *  @param fDitherImage Set to true if the the decoder should try to
+     *         dither the resulting image when decoding to a smaller
+     *         color-space.  The default is true.
+     *
+     *  @param fRequestedColorType If not given, then use whichever
+     *         config the decoder wants.  Else try to use this color
+     *         type.  If the decoder won't support this color type,
+     *         SkDecodingImageGenerator::Create will return
+     *         NULL. kIndex_8_SkColorType is not supported.
+     *
+     *  @param fRequireUnpremul If true, the decoder will attempt to
+     *         decode without premultiplying the alpha. If it cannot,
+     *         the pixels will be set to NULL.
+     */
+    struct Options {
+        Options()
+            : fSampleSize(1)
+            , fDitherImage(true)
+            , fUseRequestedColorType(false)
+            , fRequestedColorType()
+            , fRequireUnpremul(false) { }
+        Options(int sampleSize, bool dither)
+            : fSampleSize(sampleSize)
+            , fDitherImage(dither)
+            , fUseRequestedColorType(false)
+            , fRequestedColorType()
+            , fRequireUnpremul(false) { }
+        Options(int sampleSize, bool dither, SkColorType colorType)
+            : fSampleSize(sampleSize)
+            , fDitherImage(dither)
+            , fUseRequestedColorType(true)
+            , fRequestedColorType(colorType)
+            , fRequireUnpremul(false) { }
+         Options(int sampleSize, bool dither, SkColorType colorType,
+                 bool requireUnpremul)
+            : fSampleSize(sampleSize)
+            , fDitherImage(dither)
+            , fUseRequestedColorType(true)
+            , fRequestedColorType(colorType)
+            , fRequireUnpremul(requireUnpremul) { }
+        const int         fSampleSize;
+        const bool        fDitherImage;
+        const bool        fUseRequestedColorType;
+        const SkColorType fRequestedColorType;
+        const bool        fRequireUnpremul;
+    };
+
+    /**
+     *  These two functions return a SkImageGenerator that calls into
+     *  SkImageDecoder.  They return NULL on failure.
+     *
+     *  The SkData version of this function is preferred.  If the stream
+     *  has an underlying SkData (such as a SkMemoryStream) pass that in.
+     *
+     *  This object will unref the stream when done or on failure.  Since
+     *  streams have internal state (position), the caller should not pass
+     *  a shared stream in.  Pass either a new duplicated stream in or
+     *  transfer ownership of the stream.  This factory asserts
+     *  stream->unique().
+     *
+     *  For example:
+     *    SkStreamRewindable* stream;
+     *    ...
+     *    SkImageGenerator* gen
+     *        = SkDecodingImageGenerator::Create(
+     *            stream->duplicate(), SkDecodingImageGenerator::Options());
+     *    ...
+     *    SkDELETE(gen);
+     *
+     *  @param Options (see above)
+     *
+     *  @return NULL on failure, a new SkImageGenerator on success.
+     */
+    SkImageGenerator* Create(SkStreamRewindable* stream,
+                             const Options& opt);
+
+    /**
+     *  @param data Contains the encoded image data that will be used by
+     *         the SkDecodingImageGenerator.  Will be ref()ed by the
+     *         SkImageGenerator constructor and and unref()ed on deletion.
+     */
+    SkImageGenerator* Create(SkData* data, const Options& opt);
+};
+
+//  // Example of most basic use case:
+//
+//  bool install_data(SkData* data, SkBitmap* dst) {
+//     return SkInstallDiscardablePixelRef(
+//         SkDecodingImageGenerator::Create(
+//             data, SkDecodingImageGenerator::Options()), dst, NULL);
+//  }
+//  bool install_stream(SkStreamRewindable* stream, SkBitmap* dst) {
+//     return SkInstallDiscardablePixelRef(
+//         SkDecodingImageGenerator::Create(
+//             stream, SkDecodingImageGenerator::Options()), dst, NULL);
+//  }
+
+#endif  // SkDecodingImageGenerator_DEFINED
diff --git a/src/images/SkDecodingImageGenerator.h b/src/images/SkDecodingImageGenerator.h
deleted file mode 100644 (file)
index 6cb39be..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkDecodingImageGenerator_DEFINED
-#define SkDecodingImageGenerator_DEFINED
-
-#include "SkBitmap.h"
-#include "SkImageGenerator.h"
-
-class SkData;
-class SkStreamRewindable;
-
-/**
- *  An implementation of SkImageGenerator that calls into
- *  SkImageDecoder.
- */
-namespace SkDecodingImageGenerator {
-    /**
-     *  These options will be passed on to the image decoder.  The
-     *  defaults are sensible.
-     *
-     *  @param fSampleSize If set to > 1, tells the decoder to return a
-     *         smaller than original bitmap, sampling 1 pixel for
-     *         every size pixels. e.g. if sample size is set to 3,
-     *         then the returned bitmap will be 1/3 as wide and high,
-     *         and will contain 1/9 as many pixels as the original.
-     *         Note: this is a hint, and the codec may choose to
-     *         ignore this, or only approximate the sample size.
-     *
-     *  @param fDitherImage Set to true if the the decoder should try to
-     *         dither the resulting image when decoding to a smaller
-     *         color-space.  The default is true.
-     *
-     *  @param fRequestedColorType If not given, then use whichever
-     *         config the decoder wants.  Else try to use this color
-     *         type.  If the decoder won't support this color type,
-     *         SkDecodingImageGenerator::Create will return
-     *         NULL. kIndex_8_SkColorType is not supported.
-     *
-     *  @param fRequireUnpremul If true, the decoder will attempt to
-     *         decode without premultiplying the alpha. If it cannot,
-     *         the pixels will be set to NULL.
-     */
-    struct Options {
-        Options()
-            : fSampleSize(1)
-            , fDitherImage(true)
-            , fUseRequestedColorType(false)
-            , fRequestedColorType()
-            , fRequireUnpremul(false) { }
-        Options(int sampleSize, bool dither)
-            : fSampleSize(sampleSize)
-            , fDitherImage(dither)
-            , fUseRequestedColorType(false)
-            , fRequestedColorType()
-            , fRequireUnpremul(false) { }
-        Options(int sampleSize, bool dither, SkColorType colorType)
-            : fSampleSize(sampleSize)
-            , fDitherImage(dither)
-            , fUseRequestedColorType(true)
-            , fRequestedColorType(colorType)
-            , fRequireUnpremul(false) { }
-         Options(int sampleSize, bool dither, SkColorType colorType,
-                 bool requireUnpremul)
-            : fSampleSize(sampleSize)
-            , fDitherImage(dither)
-            , fUseRequestedColorType(true)
-            , fRequestedColorType(colorType)
-            , fRequireUnpremul(requireUnpremul) { }
-        const int         fSampleSize;
-        const bool        fDitherImage;
-        const bool        fUseRequestedColorType;
-        const SkColorType fRequestedColorType;
-        const bool        fRequireUnpremul;
-    };
-
-    /**
-     *  These two functions return a SkImageGenerator that calls into
-     *  SkImageDecoder.  They return NULL on failure.
-     *
-     *  The SkData version of this function is preferred.  If the stream
-     *  has an underlying SkData (such as a SkMemoryStream) pass that in.
-     *
-     *  This object will unref the stream when done or on failure.  Since
-     *  streams have internal state (position), the caller should not pass
-     *  a shared stream in.  Pass either a new duplicated stream in or
-     *  transfer ownership of the stream.  This factory asserts
-     *  stream->unique().
-     *
-     *  For example:
-     *    SkStreamRewindable* stream;
-     *    ...
-     *    SkImageGenerator* gen
-     *        = SkDecodingImageGenerator::Create(
-     *            stream->duplicate(), SkDecodingImageGenerator::Options());
-     *    ...
-     *    SkDELETE(gen);
-     *
-     *  @param Options (see above)
-     *
-     *  @return NULL on failure, a new SkImageGenerator on success.
-     */
-    SkImageGenerator* Create(SkStreamRewindable* stream,
-                             const Options& opt);
-
-    /**
-     *  @param data Contains the encoded image data that will be used by
-     *         the SkDecodingImageGenerator.  Will be ref()ed by the
-     *         SkImageGenerator constructor and and unref()ed on deletion.
-     */
-    SkImageGenerator* Create(SkData* data, const Options& opt);
-};
-
-//  // Example of most basic use case:
-//
-//  bool install_data(SkData* data, SkBitmap* dst) {
-//     return SkInstallDiscardablePixelRef(
-//         SkDecodingImageGenerator::Create(
-//             data, SkDecodingImageGenerator::Options()), dst, NULL);
-//  }
-//  bool install_stream(SkStreamRewindable* stream, SkBitmap* dst) {
-//     return SkInstallDiscardablePixelRef(
-//         SkDecodingImageGenerator::Create(
-//             stream, SkDecodingImageGenerator::Options()), dst, NULL);
-//  }
-
-#endif  // SkDecodingImageGenerator_DEFINED