| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 spacing); | 217 spacing); |
| 218 } | 218 } |
| 219 | 219 |
| 220 startAnimation(); | 220 startAnimation(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 namespace { | 223 namespace { |
| 224 | 224 |
| 225 sk_sp<PaintShader> createPatternShader(const SkImage* image, | 225 sk_sp<PaintShader> createPatternShader(const SkImage* image, |
| 226 const SkMatrix& shaderMatrix, | 226 const SkMatrix& shaderMatrix, |
| 227 const SkPaint& paint, | 227 const PaintFlags& paint, |
| 228 const FloatSize& spacing, | 228 const FloatSize& spacing, |
| 229 SkShader::TileMode tmx, | 229 SkShader::TileMode tmx, |
| 230 SkShader::TileMode tmy) { | 230 SkShader::TileMode tmy) { |
| 231 if (spacing.isZero()) | 231 if (spacing.isZero()) |
| 232 return MakePaintShaderImage(image, tmx, tmy, &shaderMatrix); | 232 return MakePaintShaderImage(image, tmx, tmy, &shaderMatrix); |
| 233 | 233 |
| 234 // Arbitrary tiling is currently only supported for SkPictureShader, so we use | 234 // Arbitrary tiling is currently only supported for SkPictureShader, so we use |
| 235 // that instead of a plain bitmap shader to implement spacing. | 235 // that instead of a plain bitmap shader to implement spacing. |
| 236 const SkRect tileRect = SkRect::MakeWH(image->width() + spacing.width(), | 236 const SkRect tileRect = SkRect::MakeWH(image->width() + spacing.width(), |
| 237 image->height() + spacing.height()); | 237 image->height() + spacing.height()); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 FloatRect subset = dest; | 380 FloatRect subset = dest; |
| 381 subset.setX((dest.x() - tile.x()) / scale.width()); | 381 subset.setX((dest.x() - tile.x()) / scale.width()); |
| 382 subset.setY((dest.y() - tile.y()) / scale.height()); | 382 subset.setY((dest.y() - tile.y()) / scale.height()); |
| 383 subset.setWidth(dest.width() / scale.width()); | 383 subset.setWidth(dest.width() / scale.width()); |
| 384 subset.setHeight(dest.height() / scale.height()); | 384 subset.setHeight(dest.height() / scale.height()); |
| 385 | 385 |
| 386 return subset; | 386 return subset; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace blink | 389 } // namespace blink |
| OLD | NEW |