| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 bool Image::applyShader(SkPaint& paint, const SkMatrix& localMatrix) | 266 bool Image::applyShader(SkPaint& paint, const SkMatrix& localMatrix) |
| 267 { | 267 { |
| 268 // Default shader impl: attempt to build a shader based on the current frame
SkImage. | 268 // Default shader impl: attempt to build a shader based on the current frame
SkImage. |
| 269 sk_sp<SkImage> image = imageForCurrentFrame(); | 269 sk_sp<SkImage> image = imageForCurrentFrame(); |
| 270 if (!image) | 270 if (!image) |
| 271 return false; | 271 return false; |
| 272 | 272 |
| 273 paint.setShader( | 273 paint.setShader( |
| 274 image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode
, &localMatrix)); | 274 image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode
, &localMatrix)); |
| 275 | 275 |
| 276 // Animation is normally refreshed in draw() impls, which we don't call when
painting via shaders. |
| 277 startAnimation(); |
| 278 |
| 276 return true; | 279 return true; |
| 277 } | 280 } |
| 278 | 281 |
| 279 FloatRect Image::computeTileContaining(const FloatPoint& point, | 282 FloatRect Image::computeTileContaining(const FloatPoint& point, |
| 280 const FloatSize& tileSize, const FloatPoint& tilePhase, const FloatSize& til
eSpacing) | 283 const FloatSize& tileSize, const FloatPoint& tilePhase, const FloatSize& til
eSpacing) |
| 281 { | 284 { |
| 282 const FloatSize actualTileSize(tileSize + tileSpacing); | 285 const FloatSize actualTileSize(tileSize + tileSpacing); |
| 283 return FloatRect( | 286 return FloatRect( |
| 284 FloatPoint( | 287 FloatPoint( |
| 285 point.x() + fmodf(fmodf(-tilePhase.x(), actualTileSize.width()) - ac
tualTileSize.width(), actualTileSize.width()), | 288 point.x() + fmodf(fmodf(-tilePhase.x(), actualTileSize.width()) - ac
tualTileSize.width(), actualTileSize.width()), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 298 FloatRect subset = dest; | 301 FloatRect subset = dest; |
| 299 subset.setX((dest.x() - tile.x()) / scale.width()); | 302 subset.setX((dest.x() - tile.x()) / scale.width()); |
| 300 subset.setY((dest.y() - tile.y()) / scale.height()); | 303 subset.setY((dest.y() - tile.y()) / scale.height()); |
| 301 subset.setWidth(dest.width() / scale.width()); | 304 subset.setWidth(dest.width() / scale.width()); |
| 302 subset.setHeight(dest.height() / scale.height()); | 305 subset.setHeight(dest.height() / scale.height()); |
| 303 | 306 |
| 304 return subset; | 307 return subset; |
| 305 } | 308 } |
| 306 | 309 |
| 307 } // namespace blink | 310 } // namespace blink |
| OLD | NEW |