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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp

Issue 1309393007: [poc] redecode Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: resetColorProfileForTesting rename Created 5 years, 1 month 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: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
index 584246d45217a8a56b6e7f97b623e6d22ae042d7..c1262e95ff19a16f0cdb9d7064a2190cbe2fc4a5 100644
--- a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
@@ -5,6 +5,8 @@
#include "config.h"
#include "platform/graphics/ImagePattern.h"
+#include "platform/graphics/BitmapImage.h"
+#include "platform/graphics/GraphicsScreen.h"
#include "platform/graphics/Image.h"
#include "platform/graphics/skia/SkiaUtils.h"
#include "third_party/skia/include/core/SkCanvas.h"
@@ -21,8 +23,18 @@ PassRefPtr<ImagePattern> ImagePattern::create(PassRefPtr<Image> image, RepeatMod
ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode)
: Pattern(repeatMode)
- , m_tileImage(image->imageForCurrentFrame())
{
+ // Patterns of tagged images (those that have a color profile) are drawn to sRGB
+ // on supported platforms. Note the only allowed caller is the <canvas> element.
+
+ if (image && imageColorProfilesEnabled() && image->isBitmapImage()) {
+ if (toBitmapImage(image.get())->hasColorProfile())
+ toBitmapImage(image.get())->notifyDeviceProfile(screenColorProfile(currentScreenId()).get());
+ RELEASE_ASSERT(!currentScreenId()); // Check the caller is an HTML <canvas>.
+ }
+
+ m_tileImage = image->imageForCurrentFrame();
+
if (m_tileImage) {
// TODO(fmalita): mechanism to extract the actual SkImageInfo from an SkImage?
const SkImageInfo info =
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageObserver.h ('k') | third_party/WebKit/Source/platform/graphics/ImageSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698