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

Side by Side Diff: Source/core/rendering/shapes/Shape.cpp

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: mac+win build fix Created 7 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 | Annotate | Revision Log
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 return shape.release(); 204 return shape.release();
205 } 205 }
206 206
207 PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float thresho ld, const LayoutSize&, WritingMode writingMode, Length margin, Length padding) 207 PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float thresho ld, const LayoutSize&, WritingMode writingMode, Length margin, Length padding)
208 { 208 {
209 ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImag e() && styleImage->cachedImage()->image()); 209 ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImag e() && styleImage->cachedImage()->image());
210 210
211 Image* image = styleImage->cachedImage()->image(); 211 Image* image = styleImage->cachedImage()->image();
212 const IntSize& imageSize = image->size(); 212 const IntSize& imageSize = image->size();
213 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(i mageSize.height()));
213 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize); 214 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize);
214
215 OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals(i mageSize.height()));
216
217 if (imageBuffer) { 215 if (imageBuffer) {
218 GraphicsContext* graphicsContext = imageBuffer->context(); 216 GraphicsContext* graphicsContext = imageBuffer->context();
219 graphicsContext->drawImage(image, IntPoint()); 217 graphicsContext->drawImage(image, IntPoint());
220 218
221 RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImage Data(IntRect(IntPoint(), imageSize)); 219 RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImage Data(IntRect(IntPoint(), imageSize));
222 unsigned pixelArrayLength = pixelArray->length(); 220 unsigned pixelArrayLength = pixelArray->length();
223 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. 221 unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA.
224 uint8_t alphaPixelThreshold = threshold * 255; 222 uint8_t alphaPixelThreshold = threshold * 255;
225 223
226 ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4) == pixelArrayLength); 224 ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4) == pixelArrayLength);
(...skipping 26 matching lines...) Expand all
253 251
254 OwnPtr<Shape> shape = createRectangleShape(bounds, radii); 252 OwnPtr<Shape> shape = createRectangleShape(bounds, radii);
255 shape->m_writingMode = writingMode; 253 shape->m_writingMode = writingMode;
256 shape->m_margin = floatValueForLength(margin, 0); 254 shape->m_margin = floatValueForLength(margin, 0);
257 shape->m_padding = floatValueForLength(padding, 0); 255 shape->m_padding = floatValueForLength(padding, 0);
258 256
259 return shape.release(); 257 return shape.release();
260 } 258 }
261 259
262 } // namespace WebCore 260 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698