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 26 matching lines...) Expand all Loading... |
37 #include "third_party/skia/include/core/SkPicture.h" | 37 #include "third_party/skia/include/core/SkPicture.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length&
intrinsicHeight, FloatSize& intrinsicRatio) | 41 void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length&
intrinsicHeight, FloatSize& intrinsicRatio) |
42 { | 42 { |
43 Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsic
Ratio); | 43 Image::computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsic
Ratio); |
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 FloatSize& repeatSpacing) | 49 const FloatSize& repeatSpacing) |
50 { | 50 { |
51 FloatRect tileRect = srcRect; | 51 FloatRect tileRect = srcRect; |
52 tileRect.expand(FloatSize(repeatSpacing)); | 52 tileRect.expand(FloatSize(repeatSpacing)); |
53 | 53 |
54 SkPictureBuilder builder(tileRect, nullptr, destContext); | 54 SkPictureBuilder builder(tileRect, nullptr, &destContext); |
55 builder.context().beginRecording(tileRect); | 55 builder.context().beginRecording(tileRect); |
56 drawTile(&builder.context(), srcRect); | 56 drawTile(builder.context(), srcRect); |
57 RefPtr<const SkPicture> tilePicture = builder.endRecording(); | 57 RefPtr<const SkPicture> tilePicture = builder.endRecording(); |
58 | 58 |
59 AffineTransform patternTransform; | 59 AffineTransform patternTransform; |
60 patternTransform.translate(phase.x(), phase.y()); | 60 patternTransform.translate(phase.x(), phase.y()); |
61 patternTransform.scale(scale.width(), scale.height()); | 61 patternTransform.scale(scale.width(), scale.height()); |
62 patternTransform.translate(tileRect.x(), tileRect.y()); | 62 patternTransform.translate(tileRect.x(), tileRect.y()); |
63 | 63 |
64 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture); | 64 RefPtr<Pattern> picturePattern = Pattern::createPicturePattern(tilePicture); |
65 picturePattern->setPatternSpaceTransform(patternTransform); | 65 picturePattern->setPatternSpaceTransform(patternTransform); |
66 | 66 |
67 SkPaint fillPaint = destContext->fillPaint(); | 67 SkPaint fillPaint = destContext.fillPaint(); |
68 picturePattern->applyToPaint(fillPaint); | 68 picturePattern->applyToPaint(fillPaint); |
69 fillPaint.setColor(SK_ColorBLACK); | 69 fillPaint.setColor(SK_ColorBLACK); |
70 fillPaint.setXfermodeMode(compositeOp); | 70 fillPaint.setXfermodeMode(compositeOp); |
71 | 71 |
72 destContext->drawRect(destRect, fillPaint); | 72 destContext.drawRect(destRect, fillPaint); |
73 } | 73 } |
74 | 74 |
75 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame() | 75 PassRefPtr<SkImage> GeneratedImage::imageForCurrentFrame() |
76 { | 76 { |
77 return nullptr; | 77 return nullptr; |
78 } | 78 } |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
OLD | NEW |