Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1422493003: Change Widget subclasses to use a CullRect instead of an IntRect for painting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/svg/animation/SMILTimeContainer.h" 48 #include "core/svg/animation/SMILTimeContainer.h"
49 #include "core/svg/graphics/SVGImageChromeClient.h" 49 #include "core/svg/graphics/SVGImageChromeClient.h"
50 #include "platform/EventDispatchForbiddenScope.h" 50 #include "platform/EventDispatchForbiddenScope.h"
51 #include "platform/LengthFunctions.h" 51 #include "platform/LengthFunctions.h"
52 #include "platform/TraceEvent.h" 52 #include "platform/TraceEvent.h"
53 #include "platform/geometry/IntRect.h" 53 #include "platform/geometry/IntRect.h"
54 #include "platform/graphics/GraphicsContext.h" 54 #include "platform/graphics/GraphicsContext.h"
55 #include "platform/graphics/ImageBuffer.h" 55 #include "platform/graphics/ImageBuffer.h"
56 #include "platform/graphics/ImageObserver.h" 56 #include "platform/graphics/ImageObserver.h"
57 #include "platform/graphics/paint/ClipRecorder.h" 57 #include "platform/graphics/paint/ClipRecorder.h"
58 #include "platform/graphics/paint/CullRect.h"
58 #include "platform/graphics/paint/DrawingRecorder.h" 59 #include "platform/graphics/paint/DrawingRecorder.h"
59 #include "platform/graphics/paint/SkPictureBuilder.h" 60 #include "platform/graphics/paint/SkPictureBuilder.h"
60 #include "third_party/skia/include/core/SkPicture.h" 61 #include "third_party/skia/include/core/SkPicture.h"
61 #include "wtf/PassRefPtr.h" 62 #include "wtf/PassRefPtr.h"
62 63
63 namespace blink { 64 namespace blink {
64 65
65 SVGImage::SVGImage(ImageObserver* observer) 66 SVGImage::SVGImage(ImageObserver* observer)
66 : Image(observer) 67 : Image(observer)
67 { 68 {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // We can only draw the entire frame, clipped to the rect we want. So co mpute where the top left 300 // We can only draw the entire frame, clipped to the rect we want. So co mpute where the top left
300 // of the image would be if we were drawing without clipping, and transl ate accordingly. 301 // of the image would be if we were drawing without clipping, and transl ate accordingly.
301 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr cRect.height()); 302 FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / sr cRect.height());
302 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect. location().y() * scale.height()); 303 FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect. location().y() * scale.height());
303 FloatPoint destOffset = dstRect.location() - topLeftOffset; 304 FloatPoint destOffset = dstRect.location() - topLeftOffset;
304 AffineTransform transform = AffineTransform::translation(destOffset.x(), destOffset.y()); 305 AffineTransform transform = AffineTransform::translation(destOffset.x(), destOffset.y());
305 transform.scale(scale.width(), scale.height()); 306 transform.scale(scale.width(), scale.height());
306 TransformRecorder transformRecorder(imagePicture.context(), *this, trans form); 307 TransformRecorder transformRecorder(imagePicture.context(), *this, trans form);
307 308
308 view->updateAllLifecyclePhases(); 309 view->updateAllLifecyclePhases();
309 view->paint(&imagePicture.context(), enclosingIntRect(srcRect)); 310 view->paint(&imagePicture.context(), CullRect(enclosingIntRect(srcRect)) );
310 ASSERT(!view->needsLayout()); 311 ASSERT(!view->needsLayout());
311 } 312 }
312 313
313 { 314 {
314 SkAutoCanvasRestore ar(canvas, false); 315 SkAutoCanvasRestore ar(canvas, false);
315 if (drawNeedsLayer(paint)) { 316 if (drawNeedsLayer(paint)) {
316 SkRect layerRect = dstRect; 317 SkRect layerRect = dstRect;
317 canvas->saveLayer(&layerRect, &paint); 318 canvas->saveLayer(&layerRect, &paint);
318 } 319 }
319 RefPtr<const SkPicture> recording = imagePicture.endRecording(); 320 RefPtr<const SkPicture> recording = imagePicture.endRecording();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 500
500 return m_page; 501 return m_page;
501 } 502 }
502 503
503 String SVGImage::filenameExtension() const 504 String SVGImage::filenameExtension() const
504 { 505 {
505 return "svg"; 506 return "svg";
506 } 507 }
507 508
508 } 509 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp ('k') | third_party/WebKit/Source/platform/Widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698