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

Side by Side Diff: skia/ext/skia_utils_base.cc

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: addressed comments 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 // 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
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
OLDNEW
« cc/tiles/image_controller_unittest.cc ('K') | « skia/ext/skia_utils_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698