diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-10-29 10:24:51 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-01 05:26:08 +0100 |
commit | 2e29906567cef053e608588830ddfb013cb53682 (patch) | |
tree | cae4aa3aaf9f318ceb6f0a80953d6174e494a394 /vcl/source/helper/canvasbitmap.cxx | |
parent | 1be268f3ec7661be232b8f5dc18546d1410dfd52 (diff) |
Prepare for removal of non-const operator[] from Sequence in vcl
Change-Id: I65f411affcf0340c054d09426483d57c530edb0f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124411
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/helper/canvasbitmap.cxx')
-rw-r--r-- | vcl/source/helper/canvasbitmap.cxx | 92 |
1 files changed, 37 insertions, 55 deletions
diff --git a/vcl/source/helper/canvasbitmap.cxx b/vcl/source/helper/canvasbitmap.cxx index 68bef1b79b77..2eaa16223789 100644 --- a/vcl/source/helper/canvasbitmap.cxx +++ b/vcl/source/helper/canvasbitmap.cxx @@ -173,19 +173,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::ALPHA; - pTags[1] = rendering::ColorComponentTag::RGB_BLUE; - pTags[2] = rendering::ColorComponentTag::RGB_GREEN; - pTags[3] = rendering::ColorComponentTag::RGB_RED; - - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::ALPHA, + /* 1 */ rendering::ColorComponentTag::RGB_BLUE, + /* 2 */ rendering::ColorComponentTag::RGB_GREEN, + /* 3 */ rendering::ColorComponentTag::RGB_RED }; + + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 3; m_nGreenIndex = 2; @@ -200,19 +196,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::ALPHA; - pTags[1] = rendering::ColorComponentTag::RGB_RED; - pTags[2] = rendering::ColorComponentTag::RGB_GREEN; - pTags[3] = rendering::ColorComponentTag::RGB_BLUE; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::ALPHA, + /* 1 */ rendering::ColorComponentTag::RGB_RED, + /* 2 */ rendering::ColorComponentTag::RGB_GREEN, + /* 3 */ rendering::ColorComponentTag::RGB_BLUE }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 1; m_nGreenIndex = 2; @@ -227,19 +219,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::RGB_BLUE; - pTags[1] = rendering::ColorComponentTag::RGB_GREEN; - pTags[2] = rendering::ColorComponentTag::RGB_RED; - pTags[3] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::RGB_BLUE, + /* 1 */ rendering::ColorComponentTag::RGB_GREEN, + /* 2 */ rendering::ColorComponentTag::RGB_RED, + /* 3 */ rendering::ColorComponentTag::ALPHA }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 2; m_nGreenIndex = 1; @@ -254,19 +242,15 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : m_nBitsPerInputPixel = 32; m_aLayout.IsMsbFirst = false; // doesn't matter - m_aComponentTags.realloc(4); - sal_Int8* pTags = m_aComponentTags.getArray(); - pTags[0] = rendering::ColorComponentTag::RGB_RED; - pTags[1] = rendering::ColorComponentTag::RGB_GREEN; - pTags[2] = rendering::ColorComponentTag::RGB_BLUE; - pTags[3] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags = { /* 0 */ rendering::ColorComponentTag::RGB_RED, + /* 1 */ rendering::ColorComponentTag::RGB_GREEN, + /* 2 */ rendering::ColorComponentTag::RGB_BLUE, + /* 3 */ rendering::ColorComponentTag::ALPHA }; - m_aComponentBitCounts.realloc(4); - sal_Int32* pCounts = m_aComponentBitCounts.getArray(); - pCounts[0] = 8; - pCounts[1] = 8; - pCounts[2] = 8; - pCounts[3] = 8; + m_aComponentBitCounts = { /* 0 */ 8, + /* 1 */ 8, + /* 2 */ 8, + /* 3 */ 8 }; m_nRedIndex = 0; m_nGreenIndex = 1; @@ -291,11 +275,9 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : if( m_bPalette ) { - m_aComponentTags.realloc(1); - m_aComponentTags[0] = rendering::ColorComponentTag::INDEX; + m_aComponentTags = { rendering::ColorComponentTag::INDEX }; - m_aComponentBitCounts.realloc(1); - m_aComponentBitCounts[0] = m_nBitsPerInputPixel; + m_aComponentBitCounts = { m_nBitsPerInputPixel }; m_nIndexIndex = 0; } @@ -318,10 +300,10 @@ VclCanvasBitmap::VclCanvasBitmap( const BitmapEx& rBitmap ) : // BMP_FORMAT_32BIT_XX_ARGB formats, duplicate alpha // channels might happen! m_aComponentTags.realloc(m_aComponentTags.getLength()+1); - m_aComponentTags[m_aComponentTags.getLength()-1] = rendering::ColorComponentTag::ALPHA; + m_aComponentTags.getArray()[m_aComponentTags.getLength()-1] = rendering::ColorComponentTag::ALPHA; m_aComponentBitCounts.realloc(m_aComponentBitCounts.getLength()+1); - m_aComponentBitCounts[m_aComponentBitCounts.getLength()-1] = m_aBmpEx.IsAlpha() ? 8 : 1; + m_aComponentBitCounts.getArray()[m_aComponentBitCounts.getLength()-1] = m_aBmpEx.IsAlpha() ? 8 : 1; // always add a full byte to the pixel size, otherwise // pixel packing hell breaks loose. |