OLD | NEW |
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 30 matching lines...) Expand all Loading... |
41 void GeneratedImage::drawPattern(GraphicsContext& destContext, const FloatRect&
srcRect, const FloatSize& scale, | 41 void GeneratedImage::drawPattern(GraphicsContext& destContext, const FloatRect&
srcRect, const FloatSize& scale, |
42 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest
Rect, | 42 const FloatPoint& phase, SkXfermode::Mode compositeOp, const FloatRect& dest
Rect, |
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 sk_sp<SkPicture> tilePicture = builder.endRecording(); |
52 | 52 |
53 SkMatrix patternMatrix = SkMatrix::MakeTrans(phase.x(), phase.y()); | 53 SkMatrix patternMatrix = SkMatrix::MakeTrans(phase.x(), phase.y()); |
54 patternMatrix.preScale(scale.width(), scale.height()); | 54 patternMatrix.preScale(scale.width(), scale.height()); |
55 patternMatrix.preTranslate(tileRect.x(), tileRect.y()); | 55 patternMatrix.preTranslate(tileRect.x(), tileRect.y()); |
56 | 56 |
57 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture.r
elease()); | 57 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(std::move(til
ePicture)); |
58 | 58 |
59 SkPaint fillPaint = destContext.fillPaint(); | 59 SkPaint fillPaint = destContext.fillPaint(); |
60 picturePattern->applyToPaint(fillPaint, patternMatrix); | 60 picturePattern->applyToPaint(fillPaint, patternMatrix); |
61 fillPaint.setColor(SK_ColorBLACK); | 61 fillPaint.setColor(SK_ColorBLACK); |
62 fillPaint.setXfermodeMode(compositeOp); | 62 fillPaint.setXfermodeMode(compositeOp); |
63 | 63 |
64 destContext.drawRect(destRect, fillPaint); | 64 destContext.drawRect(destRect, fillPaint); |
65 } | 65 } |
66 | 66 |
67 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame() | 67 sk_sp<SkImage> GeneratedImage::imageForCurrentFrame() |
68 { | 68 { |
69 return nullptr; | 69 return nullptr; |
70 } | 70 } |
71 | 71 |
72 } // namespace blink | 72 } // namespace blink |
OLD | NEW |