lockPixels before calling getColorTable.
Fixes a bug where we try to dereference a NULL pointer. Update the comment for SkBitmap::getColorTable, telling the client that pixels must be locked for it to return non-NULL. R=edisonn@google.com Review URL: https://codereview.chromium.org/15002002 git-svn-id: http://skia.googlecode.com/svn/trunk@9018 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
1335264fce
commit
665b2cca88
@ -371,7 +371,9 @@ public:
|
||||
*/
|
||||
SkGpuTexture* getTexture() const;
|
||||
|
||||
/** Return the bitmap's colortable (if any). Does not affect the colortable's
|
||||
/** Return the bitmap's colortable, if it uses one (i.e. fConfig is
|
||||
kIndex8_Config or kRLE_Index8_Config) and the pixels are locked.
|
||||
Otherwise returns NULL. Does not affect the colortable's
|
||||
reference count.
|
||||
*/
|
||||
SkColorTable* getColorTable() const { return fColorTable; }
|
||||
|
@ -321,6 +321,7 @@ SkPDFImage::SkPDFImage(SkStream* imageData,
|
||||
insertName("ColorSpace", "DeviceGray");
|
||||
} else if (config == SkBitmap::kIndex8_Config ||
|
||||
config == SkBitmap::kRLE_Index8_Config) {
|
||||
SkAutoLockPixels alp(bitmap);
|
||||
insert("ColorSpace",
|
||||
makeIndexedColorSpace(bitmap.getColorTable()))->unref();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user