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

Unified Diff: third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp

Issue 2559013002: Add ColorBehavior to blink::Image draw methods (Closed)
Patch Set: Rebase Created 4 years 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/modules/shapedetection/ShapeDetector.cpp
diff --git a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
index abfa2e3ddf937b308d08632890be87dd3294b2fc..31ab4ffd208a9b14092ea40e3efc019ff7a415c6 100644
--- a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
+++ b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
@@ -131,7 +131,9 @@ ScriptPromise ShapeDetector::detectShapesOnImageElement(
return promise;
}
- const sk_sp<SkImage> image = blinkImage->imageForCurrentFrame();
+ // TODO(ccameron): ShapeDetector can ignore color conversion.
+ const sk_sp<SkImage> image = blinkImage->imageForCurrentFrame(
+ ColorBehavior::transformToGlobalTarget());
DCHECK_EQ(img->naturalWidth(), static_cast<unsigned>(image->width()));
DCHECK_EQ(img->naturalHeight(), static_cast<unsigned>(image->height()));
@@ -224,7 +226,9 @@ ScriptPromise ShapeDetector::detectShapesOnImageBitmap(
WTF::CheckedNumeric<int> allocationSize = 0;
// Use |skImage|'s pixels if it has direct access to them, otherwise retrieve
// them from elsewhere via copyBitmapData().
- sk_sp<SkImage> skImage = imageBitmap->bitmapImage()->imageForCurrentFrame();
+ // TODO(ccameron): ShapeDetector can ignore color conversion.
+ sk_sp<SkImage> skImage = imageBitmap->bitmapImage()->imageForCurrentFrame(
+ ColorBehavior::transformToGlobalTarget());
if (skImage->peekPixels(&pixmap)) {
pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr());
allocationSize = pixmap.getSafeSize();
@@ -273,7 +277,9 @@ ScriptPromise ShapeDetector::detectShapesOnVideoElement(
uint8_t* pixelDataPtr = nullptr;
WTF::CheckedNumeric<int> allocationSize = 0;
// Use |skImage|'s pixels if it has direct access to them.
- sk_sp<SkImage> skImage = image->imageForCurrentFrame();
+ // TODO(ccameron): ShapeDetector can ignore color conversion.
+ sk_sp<SkImage> skImage =
+ image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget());
if (skImage->peekPixels(&pixmap)) {
pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr());
allocationSize = pixmap.getSafeSize();

Powered by Google App Engine
This is Rietveld 408576698