diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 22:24:42 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-09 22:24:42 +0000 |
commit | 6487f72254a606f3b08b836398feef933830d71b (patch) | |
tree | 73a15d240b2f1adefef5f90f7e7d1ac85f49f261 /pdf/out_of_process_instance.cc | |
parent | 25063816c83ae8d9d2d31d706a1a9453032731ae (diff) | |
download | chromium_src-6487f72254a606f3b08b836398feef933830d71b.zip chromium_src-6487f72254a606f3b08b836398feef933830d71b.tar.gz chromium_src-6487f72254a606f3b08b836398feef933830d71b.tar.bz2 |
Fixes for re-enabling more MSVC level 4 warnings: pdf/ edition
This contains fixes for the following sorts of issues:
* Signedness mismatch
This relies on https://codereview.chromium.org/376003003 to make FPDF_FillRect()
take a 32-bit value for the color in order to make the changes here as simple
and clean as possible.
This also contains a few other cleanups to make code simpler or more consistent.
BUG=81439
TEST=none
Review URL: https://codereview.chromium.org/372273005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'pdf/out_of_process_instance.cc')
-rw-r--r-- | pdf/out_of_process_instance.cc | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index a08f8b0..6f728b7 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -629,11 +629,7 @@ void OutOfProcessInstance::OnPaint( if (first_paint_) { first_paint_ = false; pp::Rect rect = pp::Rect(pp::Point(), image_data_.size()); - unsigned int color = kBackgroundColorA << 24 | - kBackgroundColorR << 16 | - kBackgroundColorG << 8 | - kBackgroundColorB; - FillRect(rect, color); + FillRect(rect, kBackgroundColor); ready->push_back(PaintManager::ReadyRect(rect, image_data_, true)); } @@ -724,12 +720,10 @@ void OutOfProcessInstance::CalculateBackgroundParts() { // Add the left, right, and bottom rectangles. Note: we assume only // horizontal centering. - BackgroundPart part; - part.color = kBackgroundColorA << 24 | - kBackgroundColorR << 16 | - kBackgroundColorG << 8 | - kBackgroundColorB; - part.location = pp::Rect(0, 0, left_width, bottom); + BackgroundPart part = { + pp::Rect(0, 0, left_width, bottom), + kBackgroundColor + }; if (!part.location.IsEmpty()) background_parts_.push_back(part); part.location = pp::Rect(right_start, 0, right_width, bottom); @@ -750,11 +744,11 @@ int OutOfProcessInstance::GetDocumentPixelHeight() const { ceil(document_size_.height() * zoom_ * device_scale_)); } -void OutOfProcessInstance::FillRect(const pp::Rect& rect, unsigned int color) { +void OutOfProcessInstance::FillRect(const pp::Rect& rect, uint32 color) { DCHECK(!image_data_.is_null() || rect.IsEmpty()); - unsigned int* buffer_start = static_cast<unsigned int*>(image_data_.data()); + uint32* buffer_start = static_cast<uint32*>(image_data_.data()); int stride = image_data_.stride(); - unsigned int* ptr = buffer_start + rect.y() * stride / 4 + rect.x(); + uint32* ptr = buffer_start + rect.y() * stride / 4 + rect.x(); int height = rect.height(); int width = rect.width(); for (int y = 0; y < height; ++y) { |