Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/numerics/safe_math.h" | |
| 7 #include "skia/ext/skia_utils_base.h" | 8 #include "skia/ext/skia_utils_base.h" |
| 8 #include "third_party/skia/include/core/SkFontLCDConfig.h" | 9 #include "third_party/skia/include/core/SkFontLCDConfig.h" |
| 9 | 10 |
| 10 namespace skia { | 11 namespace skia { |
| 11 | 12 |
| 12 bool ReadSkString(base::PickleIterator* iter, SkString* str) { | 13 bool ReadSkString(base::PickleIterator* iter, SkString* str) { |
| 13 int reply_length; | 14 int reply_length; |
| 14 const char* reply_text; | 15 const char* reply_text; |
| 15 | 16 |
| 16 if (!iter->ReadData(&reply_text, &reply_length)) | 17 if (!iter->ReadData(&reply_text, &reply_length)) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 if (SkFontLCDConfig::kBGR_LCDOrder == order) { | 95 if (SkFontLCDConfig::kBGR_LCDOrder == order) { |
| 95 index |= 1; | 96 index |= 1; |
| 96 } | 97 } |
| 97 if (SkFontLCDConfig::kVertical_LCDOrientation == | 98 if (SkFontLCDConfig::kVertical_LCDOrientation == |
| 98 SkFontLCDConfig::GetSubpixelOrientation()) { | 99 SkFontLCDConfig::GetSubpixelOrientation()) { |
| 99 index |= 2; | 100 index |= 2; |
| 100 } | 101 } |
| 101 return gGeo[index]; | 102 return gGeo[index]; |
| 102 } | 103 } |
| 103 | 104 |
| 105 size_t SafeSizeOfImage(const SkImage* image) { | |
|
vmpstr
2017/02/17 19:08:49
Can you extract this as a separate patch and chang
Khushal
2017/02/17 19:10:29
Since I've already added it here, how about starti
| |
| 106 base::CheckedNumeric<size_t> checked_size = 4; | |
| 107 checked_size *= image->width(); | |
| 108 checked_size *= image->height(); | |
| 109 return checked_size.ValueOrDefault(std::numeric_limits<size_t>::max()); | |
| 110 } | |
| 111 | |
| 104 } // namespace skia | 112 } // namespace skia |
| 105 | 113 |
| OLD | NEW |