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

Side by Side Diff: core/fxge/dib/fx_dib_transform.cpp

Issue 2382443004: Replace a few more std::unique_ptr.reset() with WrapUnique assignments. (Closed)
Patch Set: Created 4 years, 2 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 | « core/fxge/dib/fx_dib_main.cpp ('k') | core/fxge/ge/cfx_font.cpp » ('j') | 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 "core/fxge/dib/dib_int.h" 7 #include "core/fxge/dib/dib_int.h"
8 8
9 #include "core/fxge/include/fx_dib.h" 9 #include "core/fxge/include/fx_dib.h"
10 10
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 m_result = result_clip; 357 m_result = result_clip;
358 if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 && 358 if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 &&
359 FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 && 359 FXSYS_fabs(m_pMatrix->d) < FXSYS_fabs(m_pMatrix->c) / 20 &&
360 FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) { 360 FXSYS_fabs(m_pMatrix->a) < 0.5f && FXSYS_fabs(m_pMatrix->d) < 0.5f) {
361 int dest_width = result_rect.Width(); 361 int dest_width = result_rect.Width();
362 int dest_height = result_rect.Height(); 362 int dest_height = result_rect.Height();
363 result_clip.Offset(-result_rect.left, -result_rect.top); 363 result_clip.Offset(-result_rect.left, -result_rect.top);
364 result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height, 364 result_clip = FXDIB_SwapClipBox(result_clip, dest_width, dest_height,
365 m_pMatrix->c > 0, m_pMatrix->b < 0); 365 m_pMatrix->c > 0, m_pMatrix->b < 0);
366 m_Stretcher.reset(new CFX_ImageStretcher(&m_Storer, m_pSrc, dest_height, 366 m_Stretcher = WrapUnique(new CFX_ImageStretcher(
367 dest_width, result_clip, m_Flags)); 367 &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags));
368 m_Stretcher->Start(); 368 m_Stretcher->Start();
369 m_Status = 1; 369 m_Status = 1;
370 return TRUE; 370 return TRUE;
371 } 371 }
372 if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 && 372 if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 &&
373 FXSYS_fabs(m_pMatrix->c) < FIX16_005) { 373 FXSYS_fabs(m_pMatrix->c) < FIX16_005) {
374 int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a) 374 int dest_width = m_pMatrix->a > 0 ? (int)FXSYS_ceil(m_pMatrix->a)
375 : (int)FXSYS_floor(m_pMatrix->a); 375 : (int)FXSYS_floor(m_pMatrix->a);
376 int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d) 376 int dest_height = m_pMatrix->d > 0 ? (int)-FXSYS_ceil(m_pMatrix->d)
377 : (int)-FXSYS_floor(m_pMatrix->d); 377 : (int)-FXSYS_floor(m_pMatrix->d);
378 result_clip.Offset(-result_rect.left, -result_rect.top); 378 result_clip.Offset(-result_rect.left, -result_rect.top);
379 m_Stretcher.reset(new CFX_ImageStretcher( 379 m_Stretcher = WrapUnique(new CFX_ImageStretcher(
380 &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags)); 380 &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags));
381 m_Stretcher->Start(); 381 m_Stretcher->Start();
382 m_Status = 2; 382 m_Status = 2;
383 return TRUE; 383 return TRUE;
384 } 384 }
385 int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); 385 int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b));
386 int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); 386 int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d));
387 CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 387 CFX_Matrix stretch2dest(1.0f, 0.0f, 0.0f, -1.0f, 0.0f,
388 (FX_FLOAT)(stretch_height)); 388 (FX_FLOAT)(stretch_height));
389 stretch2dest.Concat( 389 stretch2dest.Concat(
390 m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width, 390 m_pMatrix->a / stretch_width, m_pMatrix->b / stretch_width,
391 m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height, 391 m_pMatrix->c / stretch_height, m_pMatrix->d / stretch_height,
392 m_pMatrix->e, m_pMatrix->f); 392 m_pMatrix->e, m_pMatrix->f);
393 m_dest2stretch.SetReverse(stretch2dest); 393 m_dest2stretch.SetReverse(stretch2dest);
394 CFX_FloatRect clip_rect_f(result_clip); 394 CFX_FloatRect clip_rect_f(result_clip);
395 clip_rect_f.Transform(&m_dest2stretch); 395 clip_rect_f.Transform(&m_dest2stretch);
396 m_StretchClip = clip_rect_f.GetOuterRect(); 396 m_StretchClip = clip_rect_f.GetOuterRect();
397 m_StretchClip.Intersect(0, 0, stretch_width, stretch_height); 397 m_StretchClip.Intersect(0, 0, stretch_width, stretch_height);
398 m_Stretcher.reset(new CFX_ImageStretcher(&m_Storer, m_pSrc, stretch_width, 398 m_Stretcher = WrapUnique(new CFX_ImageStretcher(&m_Storer, m_pSrc,
399 stretch_height, m_StretchClip, 399 stretch_width, stretch_height,
400 m_Flags)); 400 m_StretchClip, m_Flags));
401 m_Stretcher->Start(); 401 m_Stretcher->Start();
402 m_Status = 3; 402 m_Status = 3;
403 return TRUE; 403 return TRUE;
404 } 404 }
405 405
406 FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { 406 FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
407 if (m_Status == 1) { 407 if (m_Status == 1) {
408 if (m_Stretcher->Continue(pPause)) 408 if (m_Stretcher->Continue(pPause))
409 return TRUE; 409 return TRUE;
410 410
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 } 946 }
947 } 947 }
948 } 948 }
949 m_Storer.Replace(std::move(pTransformed)); 949 m_Storer.Replace(std::move(pTransformed));
950 return FALSE; 950 return FALSE;
951 } 951 }
952 952
953 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { 953 std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() {
954 return m_Storer.Detach(); 954 return m_Storer.Detach();
955 } 955 }
OLDNEW
« no previous file with comments | « core/fxge/dib/fx_dib_main.cpp ('k') | core/fxge/ge/cfx_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698