summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Image.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-02 21:40:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-02 21:40:18 +0000
commit95340100f95f248defac47db8d63d6ce57b512d8 (patch)
treec83978ab7eb59bf85af228db4df5dc53ee8a2611 /core/fxcodec/jbig2/JBig2_Image.h
parent20e6688ab462d7ef749c1f97b83b5f325e88f698 (diff)
downloadpdfium-95340100f95f248defac47db8d63d6ce57b512d8.tar.xz
Tidy JBig2_Image.cppchromium/3511
Add checked/unchecked GetLine(y) methods and use them. Introduce BIT_INDEX_TO_ALIGNED_BYTE() to de-mystify some shifting. Move local declarations to spot of use. Remove spurious Fill(), as we initialize to 0s. Initialize members in header where possible. Add unit tests. Change-Id: I41ccb91b57320dbc790fd0f680f6d98571280343 Reviewed-on: https://pdfium-review.googlesource.com/39370 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Image.h')
-rw-r--r--core/fxcodec/jbig2/JBig2_Image.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Image.h b/core/fxcodec/jbig2/JBig2_Image.h
index 3cf28b0643..b1b1489506 100644
--- a/core/fxcodec/jbig2/JBig2_Image.h
+++ b/core/fxcodec/jbig2/JBig2_Image.h
@@ -34,11 +34,14 @@ class CJBig2_Image {
int32_t width() const { return m_nWidth; }
int32_t height() const { return m_nHeight; }
int32_t stride() const { return m_nStride; }
+
uint8_t* data() const { return m_pData.Get(); }
int GetPixel(int32_t x, int32_t y) const;
void SetPixel(int32_t x, int32_t y, int bVal);
+ uint8_t* GetLine(int32_t y) const;
+ uint8_t* GetLineUnsafe(int32_t y) const { return data() + y * m_nStride; }
void CopyLine(int32_t hTo, int32_t hFrom);
void Fill(bool v);
@@ -74,9 +77,9 @@ class CJBig2_Image {
const FX_RECT& rtSrc);
MaybeOwned<uint8_t, FxFreeDeleter> m_pData;
- int32_t m_nWidth; // 1-bit pixels
- int32_t m_nHeight; // lines
- int32_t m_nStride; // bytes
+ int32_t m_nWidth = 0; // 1-bit pixels
+ int32_t m_nHeight = 0; // lines
+ int32_t m_nStride = 0; // bytes, must be multiple of 4.
};
#endif // CORE_FXCODEC_JBIG2_JBIG2_IMAGE_H_