OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> | 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> |
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // We can only draw the entire frame, clipped to the rect we want. So co
mpute where the top left | 309 // We can only draw the entire frame, clipped to the rect we want. So co
mpute where the top left |
310 // of the image would be if we were drawing without clipping, and transl
ate accordingly. | 310 // of the image would be if we were drawing without clipping, and transl
ate accordingly. |
311 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); | 311 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr
cRect.height()); |
312 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); | 312 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.
location().y() * scale.height()); |
313 FloatPoint destOffset = dstRect.location() - topLeftOffset; | 313 FloatPoint destOffset = dstRect.location() - topLeftOffset; |
314 AffineTransform transform = AffineTransform::translation(destOffset.x(),
destOffset.y()); | 314 AffineTransform transform = AffineTransform::translation(destOffset.x(),
destOffset.y()); |
315 transform.scale(scale.width(), scale.height()); | 315 transform.scale(scale.width(), scale.height()); |
316 TransformRecorder transformRecorder(imagePicture.context(), *this, trans
form); | 316 TransformRecorder transformRecorder(imagePicture.context(), *this, trans
form); |
317 | 317 |
318 view->updateAllLifecyclePhases(); | 318 view->updateAllLifecyclePhases(); |
319 view->paint(&imagePicture.context(), CullRect(enclosingIntRect(srcRect))
); | 319 view->paint(imagePicture.context(), CullRect(enclosingIntRect(srcRect)))
; |
320 ASSERT(!view->needsLayout()); | 320 ASSERT(!view->needsLayout()); |
321 } | 321 } |
322 | 322 |
323 { | 323 { |
324 SkAutoCanvasRestore ar(canvas, false); | 324 SkAutoCanvasRestore ar(canvas, false); |
325 if (drawNeedsLayer(paint)) { | 325 if (drawNeedsLayer(paint)) { |
326 SkRect layerRect = dstRect; | 326 SkRect layerRect = dstRect; |
327 canvas->saveLayer(&layerRect, &paint); | 327 canvas->saveLayer(&layerRect, &paint); |
328 } | 328 } |
329 RefPtr<const SkPicture> recording = imagePicture.endRecording(); | 329 RefPtr<const SkPicture> recording = imagePicture.endRecording(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 | 509 |
510 return m_page; | 510 return m_page; |
511 } | 511 } |
512 | 512 |
513 String SVGImage::filenameExtension() const | 513 String SVGImage::filenameExtension() const |
514 { | 514 { |
515 return "svg"; | 515 return "svg"; |
516 } | 516 } |
517 | 517 |
518 } | 518 } |
OLD | NEW |