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

Side by Side Diff: Source/platform/graphics/GeneratedImage.cpp

Issue 1160183003: Use SkPictureBuilder in SVGShapePainter, and generalize SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 intrinsicRatio = FloatSize(); 44 intrinsicRatio = FloatSize();
45 } 45 }
46 46
47 void GeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale, 47 void GeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const FloatSize& scale,
48 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect, 48 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest Rect,
49 const IntSize& repeatSpacing) 49 const IntSize& repeatSpacing)
50 { 50 {
51 FloatRect tileRect = srcRect; 51 FloatRect tileRect = srcRect;
52 tileRect.expand(repeatSpacing); 52 tileRect.expand(repeatSpacing);
53 53
54 SkPictureBuilder builder(tileRect); 54 SkPictureBuilder builder(tileRect, nullptr, destContext);
55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) 55 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
56 builder.context().beginRecording(tileRect); 56 builder.context().beginRecording(tileRect);
57 drawTile(&builder.context(), srcRect); 57 drawTile(&builder.context(), srcRect);
58 RefPtr<const SkPicture> tilePicture = builder.endRecording(); 58 RefPtr<const SkPicture> tilePicture = builder.endRecording();
59 59
60 AffineTransform patternTransform; 60 AffineTransform patternTransform;
61 patternTransform.translate(phase.x(), phase.y()); 61 patternTransform.translate(phase.x(), phase.y());
62 patternTransform.scale(scale.width(), scale.height()); 62 patternTransform.scale(scale.width(), scale.height());
63 patternTransform.translate(tileRect.x(), tileRect.y()); 63 patternTransform.translate(tileRect.x(), tileRect.y());
64 64
65 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture); 65 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture);
66 picturePattern->setPatternSpaceTransform(patternTransform); 66 picturePattern->setPatternSpaceTransform(patternTransform);
67 67
68 GraphicsContextStateSaver saver(*destContext); 68 GraphicsContextStateSaver saver(*destContext);
69 destContext->setFillPattern(picturePattern); 69 destContext->setFillPattern(picturePattern);
70 destContext->fillRect(destRect, destContext->fillColor(), compositeOp); 70 destContext->fillRect(destRect, destContext->fillColor(), compositeOp);
71 } 71 }
72 72
73 } // namespace blink 73 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/blink_platform.gypi ('k') | Source/platform/graphics/paint/DisplayItemListContextRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698