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

Side by Side Diff: fpdfsdk/pdfwindow/PWL_ScrollBar.cpp

Issue 2340513002: Remove more strcmp/memcmp usage. (Closed)
Patch Set: Nit Created 4 years, 3 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
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_ScrollBar.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "fpdfsdk/pdfwindow/PWL_ScrollBar.h" 7 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
8 8
9 #include "core/fxge/include/cfx_pathdata.h" 9 #include "core/fxge/include/cfx_pathdata.h"
10 #include "core/fxge/include/cfx_renderdevice.h" 10 #include "core/fxge/include/cfx_renderdevice.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 811
812 if (pWnd == m_pMaxButton) { 812 if (pWnd == m_pMaxButton) {
813 OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam); 813 OnMaxButtonMouseMove(*(CFX_FloatPoint*)lParam);
814 } 814 }
815 815
816 if (pWnd == m_pPosButton) { 816 if (pWnd == m_pPosButton) {
817 OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam); 817 OnPosButtonMouseMove(*(CFX_FloatPoint*)lParam);
818 } 818 }
819 break; 819 break;
820 case PNM_SETSCROLLINFO: { 820 case PNM_SETSCROLLINFO: {
821 if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { 821 PWL_SCROLL_INFO* pInfo = reinterpret_cast<PWL_SCROLL_INFO*>(lParam);
822 if (FXSYS_memcmp(&m_OriginInfo, pInfo, sizeof(PWL_SCROLL_INFO)) != 0) { 822 if (pInfo && *pInfo != m_OriginInfo) {
823 m_OriginInfo = *pInfo; 823 m_OriginInfo = *pInfo;
824 FX_FLOAT fMax = 824 FX_FLOAT fMax =
825 pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth; 825 pInfo->fContentMax - pInfo->fContentMin - pInfo->fPlateWidth;
826 fMax = fMax > 0.0f ? fMax : 0.0f; 826 fMax = fMax > 0.0f ? fMax : 0.0f;
827 SetScrollRange(0, fMax, pInfo->fPlateWidth); 827 SetScrollRange(0, fMax, pInfo->fPlateWidth);
828 SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep); 828 SetScrollStep(pInfo->fBigStep, pInfo->fSmallStep);
829 }
830 } 829 }
831 } break; 830 } break;
832 case PNM_SETSCROLLPOS: { 831 case PNM_SETSCROLLPOS: {
833 FX_FLOAT fPos = *(FX_FLOAT*)lParam; 832 FX_FLOAT fPos = *(FX_FLOAT*)lParam;
834 switch (m_sbType) { 833 switch (m_sbType) {
835 case SBT_HSCROLL: 834 case SBT_HSCROLL:
836 fPos = fPos - m_OriginInfo.fContentMin; 835 fPos = fPos - m_OriginInfo.fContentMin;
837 break; 836 break;
838 case SBT_VSCROLL: 837 case SBT_VSCROLL:
839 fPos = m_OriginInfo.fContentMax - fPos; 838 fPos = m_OriginInfo.fContentMax - fPos;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1175
1177 return fTrue; 1176 return fTrue;
1178 } 1177 }
1179 1178
1180 void CPWL_ScrollBar::CreateChildWnd(const PWL_CREATEPARAM& cp) { 1179 void CPWL_ScrollBar::CreateChildWnd(const PWL_CREATEPARAM& cp) {
1181 CreateButtons(cp); 1180 CreateButtons(cp);
1182 } 1181 }
1183 1182
1184 void CPWL_ScrollBar::TimerProc() { 1183 void CPWL_ScrollBar::TimerProc() {
1185 PWL_SCROLL_PRIVATEDATA sTemp = m_sData; 1184 PWL_SCROLL_PRIVATEDATA sTemp = m_sData;
1186
1187 if (m_bMinOrMax) 1185 if (m_bMinOrMax)
1188 m_sData.SubSmall(); 1186 m_sData.SubSmall();
1189 else 1187 else
1190 m_sData.AddSmall(); 1188 m_sData.AddSmall();
1191 1189
1192 if (FXSYS_memcmp(&m_sData, &sTemp, sizeof(PWL_SCROLL_PRIVATEDATA)) != 0) { 1190 if (sTemp != m_sData) {
1193 MovePosButton(TRUE); 1191 MovePosButton(TRUE);
1194 NotifyScrollWindow(); 1192 NotifyScrollWindow();
1195 } 1193 }
1196 } 1194 }
OLDNEW
« no previous file with comments | « fpdfsdk/pdfwindow/PWL_ScrollBar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698