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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/skia/PathSkia.cpp

Issue 17633: Push drawPath() call into PlatformContextSkia to avoid juggling two copies of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // 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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return result.stripWhiteSpace(); 267 return result.stripWhiteSpace();
268 } 268 }
269 269
270 // Computes the bounding box for the stroke and style currently selected into 270 // Computes the bounding box for the stroke and style currently selected into
271 // the given bounding box. This also takes into account the stroke width. 271 // the given bounding box. This also takes into account the stroke width.
272 static FloatRect boundingBoxForCurrentStroke(const GraphicsContext* context) 272 static FloatRect boundingBoxForCurrentStroke(const GraphicsContext* context)
273 { 273 {
274 SkPaint paint; 274 SkPaint paint;
275 context->platformContext()->setupPaintForStroking(&paint, 0, 0); 275 context->platformContext()->setupPaintForStroking(&paint, 0, 0);
276 SkPath boundingPath; 276 SkPath boundingPath;
277 paint.getFillPath( 277 paint.getFillPath(context->platformContext()->currentPath(), &boundingPath);
278 context->platformContext()->currentPathInLocalCoordinates(),
279 &boundingPath);
280 SkRect r; 278 SkRect r;
281 boundingPath.computeBounds(&r, SkPath::kExact_BoundsType); 279 boundingPath.computeBounds(&r, SkPath::kExact_BoundsType);
282 return r; 280 return r;
283 } 281 }
284 282
285 FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) 283 FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
286 { 284 {
287 GraphicsContext* scratch = scratchContext(); 285 GraphicsContext* scratch = scratchContext();
288 scratch->save(); 286 scratch->save();
289 scratch->beginPath(); 287 scratch->beginPath();
290 scratch->addPath(*this); 288 scratch->addPath(*this);
291 289
292 if (applier) 290 if (applier)
293 applier->strokeStyle(scratch); 291 applier->strokeStyle(scratch);
294 292
295 FloatRect r = boundingBoxForCurrentStroke(scratch); 293 FloatRect r = boundingBoxForCurrentStroke(scratch);
296 scratch->restore(); 294 scratch->restore();
297 return r; 295 return r;
298 } 296 }
299 297
300 } // namespace WebCore 298 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698