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

Side by Side Diff: ui/gfx/color_profile.cc

Issue 1796293003: Image decode color: Push color profile from browser to renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leave empty check Created 4 years, 5 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 | « ui/gfx/color_profile.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 #include "ui/gfx/color_profile.h" 6 #include "ui/gfx/color_profile.h"
7 7
8 namespace gfx { 8 namespace gfx {
9 9
10 namespace { 10 namespace {
11 static const size_t kMinProfileLength = 128; 11 static const size_t kMinProfileLength = 128;
12 static const size_t kMaxProfileLength = 4 * 1024 * 1024; 12 static const size_t kMaxProfileLength = 4 * 1024 * 1024;
13 } 13 }
14 14
15 ColorProfile::ColorProfile(const std::vector<char>& profile)
16 : profile_(profile) {
17 if (!IsValidProfileLength(profile_.size()))
18 profile_.clear();
19 }
20
15 ColorProfile::ColorProfile() = default; 21 ColorProfile::ColorProfile() = default;
16 ColorProfile::ColorProfile(ColorProfile&& other) = default; 22 ColorProfile::ColorProfile(ColorProfile&& other) = default;
17 ColorProfile::ColorProfile(const ColorProfile& other) = default; 23 ColorProfile::ColorProfile(const ColorProfile& other) = default;
18 ColorProfile& ColorProfile::operator=(const ColorProfile& other) = default; 24 ColorProfile& ColorProfile::operator=(const ColorProfile& other) = default;
19 ColorProfile::~ColorProfile() = default; 25 ColorProfile::~ColorProfile() = default;
20 26
21 #if !defined(OS_WIN) && !defined(OS_MACOSX) 27 #if !defined(OS_WIN) && !defined(OS_MACOSX)
22 // static 28 // static
23 ColorProfile ColorProfile::GetFromBestMonitor() { 29 ColorProfile ColorProfile::GetFromBestMonitor() {
24 return ColorProfile(); 30 return ColorProfile();
25 } 31 }
26 #endif 32 #endif
27 33
28 // static 34 // static
29 bool ColorProfile::IsValidProfileLength(size_t length) { 35 bool ColorProfile::IsValidProfileLength(size_t length) {
30 return length >= kMinProfileLength && length <= kMaxProfileLength; 36 return length >= kMinProfileLength && length <= kMaxProfileLength;
31 } 37 }
32 38
33 } // namespace gfx 39 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/color_profile.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698