aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkAndroidCodec.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2016-02-04 06:14:24 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-04 06:14:24 -0800
commit7b5e5536a18123f568afca99dc8f89019eab2c77 (patch)
treefa3564d9cb1b551c8727c78b0f06dc48ffbb174b /include/codec/SkAndroidCodec.h
parentbf536af15f4c176d3bef65b77b7592718bfd9068 (diff)
Add SkAndroidCodec::getPixels
This is a synonym for the version of getAndroidPixels that accepts only three parameters (i.e. no AndroidOptions). It is very similar to SkCodec::getPixels, so I think the motivation for naming the version with options differently does not apply here. Add comments to the header describing defaults. Update the test to use a template, and delete a lot of redundant code. Rename a variable to stop shadowing another variable. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1647153002 Review URL: https://codereview.chromium.org/1647153002
Diffstat (limited to 'include/codec/SkAndroidCodec.h')
-rw-r--r--include/codec/SkAndroidCodec.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h
index c5578d3964..7fee5be255 100644
--- a/include/codec/SkAndroidCodec.h
+++ b/include/codec/SkAndroidCodec.h
@@ -143,6 +143,8 @@ public:
/**
* Indicates is destination pixel memory is zero initialized.
+ *
+ * The default is SkCodec::kNo_ZeroInitialized.
*/
SkCodec::ZeroInitialized fZeroInitialized;
@@ -153,6 +155,8 @@ public:
*
* If the EncodedFormat is kWEBP_SkEncodedFormat, the top and left
* values must be even.
+ *
+ * The default is NULL, meaning a decode of the entire image.
*/
SkIRect* fSubset;
@@ -166,6 +170,8 @@ public:
* If the client does not request kIndex8_SkColorType, then the last
* two parameters may be NULL. If fColorCount is not null, it will be
* set to 0.
+ *
+ * The default is NULL for both pointers.
*/
SkPMColor* fColorPtr;
int* fColorCount;
@@ -174,6 +180,8 @@ public:
* The client may provide an integer downscale factor for the decode.
* The codec may implement this downscaling by sampling or another
* method if it is more efficient.
+ *
+ * The default is 1, representing no downscaling.
*/
int fSampleSize;
};
@@ -207,7 +215,8 @@ public:
* be nullptr.
*
* The AndroidOptions object is also used to specify any requested scaling or subsetting
- * using options->fSampleSize and options->fSubset.
+ * using options->fSampleSize and options->fSubset. If NULL, the defaults (as specified above
+ * for AndroidOptions) are used.
*
* @return Result kSuccess, or another value explaining the type of failure.
*/
@@ -219,13 +228,18 @@ public:
const AndroidOptions* options);
/**
- * Simplified version of getAndroidPixels() where we supply the default AndroidOptions.
+ * Simplified version of getAndroidPixels() where we supply the default AndroidOptions as
+ * specified above for AndroidOptions.
*
* This will return an error if the info is kIndex_8_SkColorType and also will not perform
* any scaling or subsetting.
*/
SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes);
+ SkCodec::Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) {
+ return this->getAndroidPixels(info, pixels, rowBytes);
+ }
+
protected:
SkAndroidCodec(SkCodec*);