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

Unified Diff: ui/gfx/color_profile.h

Issue 2092533002: Clean up gfx::ColorProfile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl try Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/color_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_profile.h
diff --git a/ui/gfx/color_profile.h b/ui/gfx/color_profile.h
index 7bd5d443eccb2315b911bc3e85817aad67043a88..be9c3830c97d67fbfdb8f9aec13b31ca0d3f64f5 100644
--- a/ui/gfx/color_profile.h
+++ b/ui/gfx/color_profile.h
@@ -17,44 +17,35 @@
namespace gfx {
-static const size_t kMinProfileLength = 128;
-static const size_t kMaxProfileLength = 4 * 1024 * 1024;
-
class GFX_EXPORT ColorProfile {
public:
- // On Windows, this reads a file from disk so it should not be run on the UI
- // or IO thread.
ColorProfile();
+ ColorProfile(ColorProfile&& other);
+ ColorProfile(const ColorProfile& other);
+ ColorProfile& operator=(const ColorProfile& other);
~ColorProfile();
const std::vector<char>& profile() const { return profile_; }
+#if defined(OS_WIN)
+ // This will read color profile information from disk and cache the results
+ // for the other functions to read. This should not be called on the UI or IO
+ // thread.
+ static void UpdateCachedProfilesOnBackgroundThread();
+ static bool CachedProfilesNeedUpdate();
+#endif
+
+ // Returns the color profile of the monitor that can best represent color.
+ // This profile should be used for creating content that does not know on
+ // which monitor it will be displayed.
+ static ColorProfile GetFromBestMonitor();
+
+ static bool IsValidProfileLength(size_t length);
+
private:
std::vector<char> profile_;
-
- DISALLOW_COPY_AND_ASSIGN(ColorProfile);
};
-inline bool InvalidColorProfileLength(size_t length) {
- return (length < kMinProfileLength) || (length > kMaxProfileLength);
-}
-
-// Return the color profile of the display nearest the screen bounds. On Win32,
-// this may read a file from disk so it should not be run on the UI/IO threads.
-// If the given bounds are empty, or are off-screen, return false meaning there
-// is no color profile associated with the bounds. Otherwise return true after
-// storing the display's color profile in |profile|, which will be empty if the
-// standard sRGB color profile should be assumed.
-GFX_EXPORT bool GetDisplayColorProfile(const gfx::Rect& bounds,
- std::vector<char>* profile);
-#if defined(OS_MACOSX)
-// Return the color profile of the native window. If the window is null, or has
-// empty bounds, return false meaning there is no color profile associated with
-// the window. Otherwise return true after storing the window color profile in
-// |profile|, which will be empty if the sRGB color profile should be assumed.
-GFX_EXPORT bool GetDisplayColorProfile(gfx::NativeWindow window,
- std::vector<char>* profile);
-#endif
} // namespace gfx
#endif // UI_GFX_COLOR_PROFILE_H_
« no previous file with comments | « ui/gfx/BUILD.gn ('k') | ui/gfx/color_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698