Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(329)

Side by Side Diff: core/fxge/ge/fx_ge_path.cpp

Issue 2045083003: Remove implicit CFX_CountedRef::operator T*() (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix mac build. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fxcrt/include/fx_system.h" 7 #include "core/fxcrt/include/fx_system.h"
8 #include "core/fxge/include/fx_ge.h" 8 #include "core/fxge/include/fx_ge.h"
9 #include "third_party/base/numerics/safe_math.h" 9 #include "third_party/base/numerics/safe_math.h"
10 10
(...skipping 24 matching lines...) Expand all
35 return; 35 return;
36 } 36 }
37 if (m_Type == MaskF) { 37 if (m_Type == MaskF) {
38 IntersectMaskRect(rect, m_Box, m_Mask); 38 IntersectMaskRect(rect, m_Box, m_Mask);
39 return; 39 return;
40 } 40 }
41 } 41 }
42 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, 42 void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect,
43 FX_RECT mask_rect, 43 FX_RECT mask_rect,
44 CFX_DIBitmapRef Mask) { 44 CFX_DIBitmapRef Mask) {
45 const CFX_DIBitmap* mask_dib = Mask; 45 const CFX_DIBitmap* mask_dib = Mask.GetObject();
46 m_Type = MaskF; 46 m_Type = MaskF;
47 m_Box = rect; 47 m_Box = rect;
48 m_Box.Intersect(mask_rect); 48 m_Box.Intersect(mask_rect);
49 if (m_Box.IsEmpty()) { 49 if (m_Box.IsEmpty()) {
50 m_Type = RectI; 50 m_Type = RectI;
51 return; 51 return;
52 } 52 }
53 if (m_Box == mask_rect) { 53 if (m_Box == mask_rect) {
54 m_Mask = Mask; 54 m_Mask = Mask;
55 return; 55 return;
56 } 56 }
57 CFX_DIBitmap* new_dib = m_Mask.New(); 57 CFX_DIBitmap* new_dib = m_Mask.New();
58 if (!new_dib) { 58 if (!new_dib) {
59 return; 59 return;
60 } 60 }
61 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); 61 new_dib->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask);
62 for (int row = m_Box.top; row < m_Box.bottom; row++) { 62 for (int row = m_Box.top; row < m_Box.bottom; row++) {
63 uint8_t* dest_scan = 63 uint8_t* dest_scan =
64 new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top); 64 new_dib->GetBuffer() + new_dib->GetPitch() * (row - m_Box.top);
65 uint8_t* src_scan = 65 uint8_t* src_scan =
66 mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top); 66 mask_dib->GetBuffer() + mask_dib->GetPitch() * (row - mask_rect.top);
67 for (int col = m_Box.left; col < m_Box.right; col++) { 67 for (int col = m_Box.left; col < m_Box.right; col++) {
68 dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left]; 68 dest_scan[col - m_Box.left] = src_scan[col - mask_rect.left];
69 } 69 }
70 } 70 }
71 } 71 }
72 void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) { 72 void CFX_ClipRgn::IntersectMaskF(int left, int top, CFX_DIBitmapRef Mask) {
73 const CFX_DIBitmap* mask_dib = Mask; 73 const CFX_DIBitmap* mask_dib = Mask.GetObject();
74 ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask); 74 ASSERT(mask_dib->GetFormat() == FXDIB_8bppMask);
75 FX_RECT mask_box(left, top, left + mask_dib->GetWidth(), 75 FX_RECT mask_box(left, top, left + mask_dib->GetWidth(),
76 top + mask_dib->GetHeight()); 76 top + mask_dib->GetHeight());
77 if (m_Type == RectI) { 77 if (m_Type == RectI) {
78 IntersectMaskRect(m_Box, mask_box, Mask); 78 IntersectMaskRect(m_Box, mask_box, Mask);
79 return; 79 return;
80 } 80 }
81 if (m_Type == MaskF) { 81 if (m_Type == MaskF) {
82 FX_RECT new_box = m_Box; 82 FX_RECT new_box = m_Box;
83 new_box.Intersect(mask_box); 83 new_box.Intersect(mask_box);
84 if (new_box.IsEmpty()) { 84 if (new_box.IsEmpty()) {
85 m_Type = RectI; 85 m_Type = RectI;
86 m_Mask.SetNull(); 86 m_Mask.SetNull();
87 m_Box = new_box; 87 m_Box = new_box;
88 return; 88 return;
89 } 89 }
90 CFX_DIBitmapRef new_mask; 90 CFX_DIBitmapRef new_mask;
91 CFX_DIBitmap* new_dib = new_mask.New(); 91 CFX_DIBitmap* new_dib = new_mask.New();
92 if (!new_dib) { 92 if (!new_dib) {
93 return; 93 return;
94 } 94 }
95 new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask); 95 new_dib->Create(new_box.Width(), new_box.Height(), FXDIB_8bppMask);
96 const CFX_DIBitmap* old_dib = m_Mask; 96 const CFX_DIBitmap* old_dib = m_Mask.GetObject();
97 for (int row = new_box.top; row < new_box.bottom; row++) { 97 for (int row = new_box.top; row < new_box.bottom; row++) {
98 uint8_t* old_scan = 98 uint8_t* old_scan =
99 old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch(); 99 old_dib->GetBuffer() + (row - m_Box.top) * old_dib->GetPitch();
100 uint8_t* mask_scan = 100 uint8_t* mask_scan =
101 mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch(); 101 mask_dib->GetBuffer() + (row - top) * mask_dib->GetPitch();
102 uint8_t* new_scan = 102 uint8_t* new_scan =
103 new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch(); 103 new_dib->GetBuffer() + (row - new_box.top) * new_dib->GetPitch();
104 for (int col = new_box.left; col < new_box.right; col++) { 104 for (int col = new_box.left; col < new_box.right; col++) {
105 new_scan[col - new_box.left] = 105 new_scan[col - new_box.left] =
106 old_scan[col - m_Box.left] * mask_scan[col - left] / 255; 106 old_scan[col - m_Box.left] * mask_scan[col - left] / 255;
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 649 }
650 void CFX_GraphStateData::SetDashCount(int count) { 650 void CFX_GraphStateData::SetDashCount(int count) {
651 FX_Free(m_DashArray); 651 FX_Free(m_DashArray);
652 m_DashArray = nullptr; 652 m_DashArray = nullptr;
653 m_DashCount = count; 653 m_DashCount = count;
654 if (count == 0) { 654 if (count == 0) {
655 return; 655 return;
656 } 656 }
657 m_DashArray = FX_Alloc(FX_FLOAT, count); 657 m_DashArray = FX_Alloc(FX_FLOAT, count);
658 } 658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698