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

Side by Side Diff: third_party/WebKit/Source/core/layout/shapes/Shape.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 ImageBuffer::create(imageRect.size()); 236 ImageBuffer::create(imageRect.size());
237 237
238 if (image && imageBuffer) { 238 if (image && imageBuffer) {
239 // FIXME: This is not totally correct but it is needed to prevent shapes 239 // FIXME: This is not totally correct but it is needed to prevent shapes
240 // that loads SVG Images during paint invalidations to mark layoutObjects 240 // that loads SVG Images during paint invalidations to mark layoutObjects
241 // for layout, which is not allowed. See https://crbug.com/429346 241 // for layout, which is not allowed. See https://crbug.com/429346
242 ImageObserverDisabler disabler(image); 242 ImageObserverDisabler disabler(image);
243 SkPaint paint; 243 SkPaint paint;
244 IntRect imageSourceRect(IntPoint(), image->size()); 244 IntRect imageSourceRect(IntPoint(), image->size());
245 IntRect imageDestRect(IntPoint(), imageRect.size()); 245 IntRect imageDestRect(IntPoint(), imageRect.size());
246 // TODO(ccameron): No color conversion is required here.
246 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect, 247 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect,
247 DoNotRespectImageOrientation, 248 DoNotRespectImageOrientation,
248 Image::DoNotClampImageToSourceRect); 249 Image::DoNotClampImageToSourceRect,
250 ColorBehavior::transformToGlobalTarget());
249 251
250 WTF::ArrayBufferContents contents; 252 WTF::ArrayBufferContents contents;
251 imageBuffer->getImageData(Unmultiplied, 253 imageBuffer->getImageData(Unmultiplied,
252 IntRect(IntPoint(), imageRect.size()), contents); 254 IntRect(IntPoint(), imageRect.size()), contents);
253 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents); 255 DOMArrayBuffer* arrayBuffer = DOMArrayBuffer::create(contents);
254 DOMUint8ClampedArray* pixelArray = 256 DOMUint8ClampedArray* pixelArray =
255 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength()); 257 DOMUint8ClampedArray::create(arrayBuffer, 0, arrayBuffer->byteLength());
256 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. 258 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA.
257 uint8_t alphaPixelThreshold = threshold * 255; 259 uint8_t alphaPixelThreshold = threshold * 255;
258 260
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height()); 298 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height());
297 FloatRoundedRect bounds(rect, roundedRect.getRadii()); 299 FloatRoundedRect bounds(rect, roundedRect.getRadii());
298 std::unique_ptr<Shape> shape = createInsetShape(bounds); 300 std::unique_ptr<Shape> shape = createInsetShape(bounds);
299 shape->m_writingMode = writingMode; 301 shape->m_writingMode = writingMode;
300 shape->m_margin = margin; 302 shape->m_margin = margin;
301 303
302 return shape; 304 return shape;
303 } 305 }
304 306
305 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698