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

Unified Diff: Source/core/page/Page.cpp

Issue 352873002: [wip] image color correction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/core/page/Page.cpp
diff --git a/Source/core/page/Page.cpp b/Source/core/page/Page.cpp
index 38062ea89b384ce3888f78fa34ab4b64ce0b2be5..826b74b9be78325dc09ee213c39520c33db47625 100644
--- a/Source/core/page/Page.cpp
+++ b/Source/core/page/Page.cpp
@@ -57,6 +57,8 @@
#include "core/rendering/RenderView.h"
#include "core/rendering/TextAutosizer.h"
#include "core/storage/StorageNamespace.h"
+#include "platform/graphics/BitmapImage.h"
+#include "platform/graphics/GraphicsScreen.h"
#include "platform/plugins/PluginData.h"
#include "wtf/HashMap.h"
#include "wtf/RefCountedLeakCounter.h"
@@ -555,6 +557,38 @@ void Page::updateAcceleratedCompositingSettings()
}
}
+void Page::deviceColorProfileChanged(const char* profile, size_t size)
+{
+ HashSet<ImageResource*> colorProfiledImages;
+
+ setScreenColorProfile(reinterpret_cast<long long>(this), profile, size);
+
+ for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ // FIXME: How do OOPIF intend to co-ordinate their repaints with the page when high
+ // dpi and color profile changes update to the page()s screen? See crbug.com/239624
+ // to see what happens when paint does not co-ordinate with the screen updates sent
+ // by the Browser::RWH::WasResized IPC.
+ if (!frame->isLocalFrame())
+ continue;
+ const ResourceFetcher::DocumentResourceMap& resources = toLocalFrame(frame)->document()->fetcher()->allResources();
+ for (ResourceFetcher::DocumentResourceMap::const_iterator it = resources.begin(); it != resources.end(); ++it) {
+ Resource* resource = it->value.get();
+ if (!resource->isImage())
+ continue;
+ ImageResource* imageResource = toImageResource(resource);
+ if (!imageResource->image()->isBitmapImage())
+ continue;
+ if (imageResource->errorOccurred())
+ continue;
+ if (toBitmapImage(imageResource->image())->hasColorProfile())
+ colorProfiledImages.add(imageResource);
+ }
+ }
+
+ if (!colorProfiledImages.isEmpty())
+ ImageResource::updateBitmapImages(colorProfiledImages);
+}
+
void Page::didCommitLoad(LocalFrame* frame)
{
lifecycleNotifier().notifyDidCommitLoad(frame);
@@ -616,6 +650,8 @@ void Page::willBeDestroyed()
toRemoteFrame(m_mainFrame.get())->setView(nullptr);
}
+ removeScreenColorProfile(reinterpret_cast<long long>(this));
+
allPages().remove(this);
if (ordinaryPages().contains(this))
ordinaryPages().remove(this);

Powered by Google App Engine
This is Rietveld 408576698