diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-10 15:14:26 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-10 19:28:59 +0000 |
commit | 92e2276a8be492fd2be8e44a5d62e8a5879644d8 (patch) | |
tree | 0945f5edda0fbfb461ca1cae89a20adb583242e4 /core/fxge/ge/cfx_cliprgn.cpp | |
parent | 1437643bfaca635d52f4cb9ec41e3075cf893f79 (diff) | |
download | pdfium-92e2276a8be492fd2be8e44a5d62e8a5879644d8.tar.xz |
Move core/fxge/ge to core/fxge.
This brings the cpp and h files together and removes the
redundant ge/ path.
Change-Id: I36594b8ae719d362768ba4c2e4ce173e287363eb
Reviewed-on: https://pdfium-review.googlesource.com/7452
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/ge/cfx_cliprgn.cpp')
-rw-r--r-- | core/fxge/ge/cfx_cliprgn.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/core/fxge/ge/cfx_cliprgn.cpp b/core/fxge/ge/cfx_cliprgn.cpp deleted file mode 100644 index e00cb7c3ad..0000000000 --- a/core/fxge/ge/cfx_cliprgn.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fxge/ge/cfx_cliprgn.h" - -#include <utility> - -#include "core/fxge/dib/cfx_dibitmap.h" -#include "third_party/base/logging.h" - -CFX_ClipRgn::CFX_ClipRgn(int width, int height) - : m_Type(RectI), m_Box(0, 0, width, height) {} - -CFX_ClipRgn::CFX_ClipRgn(const CFX_ClipRgn& src) { - m_Type = src.m_Type; - m_Box = src.m_Box; - m_Mask = src.m_Mask; -} - -CFX_ClipRgn::~CFX_ClipRgn() {} - -void CFX_ClipRgn::Reset(const FX_RECT& rect) { - m_Type = RectI; - m_Box = rect; - m_Mask = nullptr; -} - -void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { - if (m_Type == RectI) { - m_Box.Intersect(rect); - return; - } - if (m_Type == MaskF) { - IntersectMaskRect(rect, m_Box, m_Mask); - return; - } -} - -void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, - FX_RECT mask_rect, - const CFX_RetainPtr<CFX_DIBitmap>& pMask) { - m_Type = MaskF; - m_Box = rect; - m_Box.Intersect(mask_rect); - if (m_Box.IsEmpty()) { - m_Type = RectI; - return; - } - if (m_Box == mask_rect) { - m_Mask = pMask; - return; - } - CFX_RetainPtr<CFX_DIBitmap> pOldMask(pMask); - m_Mask = pdfium::MakeRetain<CFX_DIBitmap>(); - m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); - for (int row = m_Box.top; row < m_Box.bottom; row++) { - uint8_t* dest_scan = - m_Mask->GetBuffer() + m_Mask->GetPitch() * (row - m_Box.top); - uint8_t* src_scan = - pOldMask->GetBuffer() + pOldMask->GetPitch() * (row - mask_rect.top); - for (int col = m_Box.left; col < m_Box.right; col++) - dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; - } -} - -void CFX_ClipRgn::IntersectMaskF(int left, - int top, - const CFX_RetainPtr<CFX_DIBitmap>& pMask) { - ASSERT(pMask->GetFormat() == FXDIB_8bppMask); - FX_RECT mask_box(left, top, left + pMask->GetWidth(), - top + pMask->GetHeight()); - if (m_Type == RectI) { - IntersectMaskRect(m_Box, mask_box, pMask); - return; - } - if (m_Type == MaskF) { - FX_RECT new_box = m_Box; - new_box.Intersect(mask_box); - if (new_box.IsEmpty()) { - m_Type = RectI; - m_Mask = nullptr; - m_Box = new_box; - return; - } - auto new_dib = pdfium::MakeRetain<CFX_DIBitmap>(); - new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); - for (int row = new_box.top; row < new_box.bottom; row++) { - uint8_t* old_scan = - m_Mask->GetBuffer() + (row - m_Box.top) * m_Mask->GetPitch(); - uint8_t* mask_scan = pMask->GetBuffer() + (row - top) * pMask->GetPitch(); - uint8_t* new_scan = - new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); - for (int col = new_box.left; col < new_box.right; col++) { - new_scan[col - new_box.left] = - old_scan[col - m_Box.left] * mask_scan[col - left] / 255; - } - } - m_Box = new_box; - m_Mask = std::move(new_dib); - return; - } - NOTREACHED(); -} |