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

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

Issue 2007553002: Retire setGradientSpaceTransform, setPatternSpaceTransform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fmalita discovers SkMatrix::I() Created 4 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const FloatSize& repeatSpacing) 43 const FloatSize& repeatSpacing)
44 { 44 {
45 FloatRect tileRect = srcRect; 45 FloatRect tileRect = srcRect;
46 tileRect.expand(FloatSize(repeatSpacing)); 46 tileRect.expand(FloatSize(repeatSpacing));
47 47
48 SkPictureBuilder builder(tileRect, nullptr, &destContext); 48 SkPictureBuilder builder(tileRect, nullptr, &destContext);
49 builder.context().beginRecording(tileRect); 49 builder.context().beginRecording(tileRect);
50 drawTile(builder.context(), srcRect); 50 drawTile(builder.context(), srcRect);
51 RefPtr<SkPicture> tilePicture = builder.endRecording(); 51 RefPtr<SkPicture> tilePicture = builder.endRecording();
52 52
53 AffineTransform patternTransform; 53 SkMatrix patternMatrix = SkMatrix::MakeTrans(phase.x(), phase.y());
54 patternTransform.translate(phase.x(), phase.y()); 54 patternMatrix.preScale(scale.width(), scale.height());
55 patternTransform.scale(scale.width(), scale.height()); 55 patternMatrix.preTranslate(tileRect.x(), tileRect.y());
56 patternTransform.translate(tileRect.x(), tileRect.y());
57 56
58 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture.r elease()); 57 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture.r elease());
59 picturePattern->setPatternSpaceTransform(patternTransform);
60 58
61 SkPaint fillPaint = destContext.fillPaint(); 59 SkPaint fillPaint = destContext.fillPaint();
62 picturePattern->applyToPaint(fillPaint); 60 picturePattern->applyToPaint(fillPaint, patternMatrix);
63 fillPaint.setColor(SK_ColorBLACK); 61 fillPaint.setColor(SK_ColorBLACK);
64 fillPaint.setXfermodeMode(compositeOp); 62 fillPaint.setXfermodeMode(compositeOp);
65 63
66 destContext.drawRect(destRect, fillPaint); 64 destContext.drawRect(destRect, fillPaint);
67 } 65 }
68 66
69 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame() 67 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame()
70 { 68 {
71 return nullptr; 69 return nullptr;
72 } 70 }
73 71
74 } // namespace blink 72 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasStyle.cpp ('k') | third_party/WebKit/Source/platform/graphics/Gradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698