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

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/bmp/BMPImageReader.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 /* 1 /*
2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 // the image. 631 // the image.
632 const uint8_t count = readUint8(0); 632 const uint8_t count = readUint8(0);
633 const uint8_t code = readUint8(1); 633 const uint8_t code = readUint8(1);
634 if ((count || (code != 1)) && pastEndOfImage(0)) 634 if ((count || (code != 1)) && pastEndOfImage(0))
635 return Failure; 635 return Failure;
636 636
637 // Decode. 637 // Decode.
638 if (!count) { 638 if (!count) {
639 switch (code) { 639 switch (code) {
640 case 0: // Magic token: EOL 640 case 0: // Magic token: EOL
641 // Skip any remaining pixels in this row. 641 // Skip any remaining pixels in this row.
642 if (m_coord.x() < m_parent->size().width()) 642 if (m_coord.x() < m_parent->size().width())
643 m_buffer->setHasAlpha(true); 643 m_buffer->setHasAlpha(true);
644 moveBufferToNextRow(); 644 moveBufferToNextRow();
645 645
646 m_decodedOffset += 2; 646 m_decodedOffset += 2;
647 break; 647 break;
648 648
649 case 1: // Magic token: EOF 649 case 1: // Magic token: EOF
650 // Skip any remaining pixels in the image. 650 // Skip any remaining pixels in the image.
651 if ((m_coord.x() < m_parent->size().width()) || 651 if ((m_coord.x() < m_parent->size().width()) ||
652 (m_isTopDown ? (m_coord.y() < (m_parent->size().height() - 1)) 652 (m_isTopDown ? (m_coord.y() < (m_parent->size().height() - 1))
653 : (m_coord.y() > 0))) 653 : (m_coord.y() > 0)))
654 m_buffer->setHasAlpha(true); 654 m_buffer->setHasAlpha(true);
655 // There's no need to move |m_coord| here to trigger the caller 655 // There's no need to move |m_coord| here to trigger the caller
656 // to call setPixelsChanged(). If the only thing that's changed 656 // to call setPixelsChanged(). If the only thing that's changed
657 // is the alpha state, that will be properly written into the 657 // is the alpha state, that will be properly written into the
658 // underlying SkBitmap when we mark the frame complete. 658 // underlying SkBitmap when we mark the frame complete.
659 return Success; 659 return Success;
660 660
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 842
843 // Finished decoding whole image. 843 // Finished decoding whole image.
844 return Success; 844 return Success;
845 } 845 }
846 846
847 void BMPImageReader::moveBufferToNextRow() { 847 void BMPImageReader::moveBufferToNextRow() {
848 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1); 848 m_coord.move(-m_coord.x(), m_isTopDown ? 1 : -1);
849 } 849 }
850 850
851 } // namespace blink 851 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698