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

Side by Side Diff: third_party/WebKit/Source/core/layout/shapes/Shape.cpp

Issue 1732563007: [NOT FOR COMMIT] Pass defaultObjectSize to get image size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(m arginRect.height(), -marginRect.y())); 196 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(m arginRect.height(), -marginRect.y()));
197 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size()); 197 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageRect.size());
198 198
199 if (image && imageBuffer) { 199 if (image && imageBuffer) {
200 // FIXME: This is not totally correct but it is needed to prevent shapes 200 // FIXME: This is not totally correct but it is needed to prevent shapes
201 // that loads SVG Images during paint invalidations to mark layoutObject s for 201 // that loads SVG Images during paint invalidations to mark layoutObject s for
202 // layout, which is not allowed. See https://crbug.com/429346 202 // layout, which is not allowed. See https://crbug.com/429346
203 ImageObserverDisabler disabler(image); 203 ImageObserverDisabler disabler(image);
204 SkPaint paint; 204 SkPaint paint;
205 IntRect imageSourceRect(IntPoint(), image->size()); 205 IntRect imageSourceRect(IntPoint(), image->defaultConcreteObjectSize());
206 IntRect imageDestRect(IntPoint(), imageRect.size()); 206 IntRect imageDestRect(IntPoint(), imageRect.size());
207 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect , DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect); 207 image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect , DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect);
208 208
209 WTF::ArrayBufferContents contents; 209 WTF::ArrayBufferContents contents;
210 imageBuffer->getImageData(Unmultiplied, IntRect(IntPoint(), imageRect.si ze()), contents); 210 imageBuffer->getImageData(Unmultiplied, IntRect(IntPoint(), imageRect.si ze()), contents);
211 RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(contents); 211 RefPtr<DOMArrayBuffer> arrayBuffer = DOMArrayBuffer::create(contents);
212 RefPtr<DOMUint8ClampedArray> pixelArray = DOMUint8ClampedArray::create(a rrayBuffer, 0, arrayBuffer->byteLength()); 212 RefPtr<DOMUint8ClampedArray> pixelArray = DOMUint8ClampedArray::create(a rrayBuffer, 0, arrayBuffer->byteLength());
213 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. 213 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA.
214 uint8_t alphaPixelThreshold = threshold * 255; 214 uint8_t alphaPixelThreshold = threshold * 255;
215 215
(...skipping 29 matching lines...) Expand all
245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height() ); 245 FloatRect rect(0, 0, roundedRect.rect().width(), roundedRect.rect().height() );
246 FloatRoundedRect bounds(rect, roundedRect.radii()); 246 FloatRoundedRect bounds(rect, roundedRect.radii());
247 OwnPtr<Shape> shape = createInsetShape(bounds); 247 OwnPtr<Shape> shape = createInsetShape(bounds);
248 shape->m_writingMode = writingMode; 248 shape->m_writingMode = writingMode;
249 shape->m_margin = margin; 249 shape->m_margin = margin;
250 250
251 return shape.release(); 251 return shape.release();
252 } 252 }
253 253
254 } // namespace blink 254 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698