From afd0d1f488ea55da545b3310fd8f22e45522a695 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 4 Apr 2017 14:37:18 -0700 Subject: RefCount CPDF_StreamAcc all the time. Pass stream argument to constructor; it feels like a stream accessor should always be made from a stream rather than passing one in after the fact. Change-Id: Iaa46cb37677b81f0170f5d39bab76ad38ea4af44 Reviewed-on: https://pdfium-review.googlesource.com/3620 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fpdfapi/page/cpdf_meshstream.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/page/cpdf_meshstream.cpp') diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp index b0a21c627a..c173bc633a 100644 --- a/core/fpdfapi/page/cpdf_meshstream.cpp +++ b/core/fpdfapi/page/cpdf_meshstream.cpp @@ -107,14 +107,17 @@ CPDF_MeshStream::CPDF_MeshStream( m_xmin(0), m_xmax(0), m_ymin(0), - m_ymax(0) { + m_ymax(0), + m_pStream(pdfium::MakeRetain(pShadingStream)) { memset(&m_ColorMin, 0, sizeof(m_ColorMin)); memset(&m_ColorMax, 0, sizeof(m_ColorMax)); } +CPDF_MeshStream::~CPDF_MeshStream() {} + bool CPDF_MeshStream::Load() { - m_Stream.LoadAllData(m_pShadingStream); - m_BitStream.Init(m_Stream.GetData(), m_Stream.GetSize()); + m_pStream->LoadAllData(); + m_BitStream.Init(m_pStream->GetData(), m_pStream->GetSize()); CPDF_Dictionary* pDict = m_pShadingStream->GetDict(); m_nCoordBits = pDict->GetIntegerFor("BitsPerCoordinate"); m_nComponentBits = pDict->GetIntegerFor("BitsPerComponent"); -- cgit v1.2.3