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

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

Issue 1823133002: Use sk_sp-based picture recording APIs in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 8 months 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const FloatSize& containerSize) 302 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const FloatSize& containerSize)
303 { 303 {
304 if (!m_page) 304 if (!m_page)
305 return nullptr; 305 return nullptr;
306 306
307 SkPictureRecorder recorder; 307 SkPictureRecorder recorder;
308 SkCanvas* canvas = recorder.beginRecording(width(), height()); 308 SkCanvas* canvas = recorder.beginRecording(width(), height());
309 drawForContainer(canvas, SkPaint(), containerSize, 1, rect(), rect(), url); 309 drawForContainer(canvas, SkPaint(), containerSize, 1, rect(), rect(), url);
310 RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
311 310
312 return adoptRef( 311 return fromSkSp(SkImage::MakeFromPicture(recorder.finishRecordingAsPicture() ,
313 SkImage::NewFromPicture(picture.get(), SkISize::Make(width(), height()), nullptr, nullptr)); 312 SkISize::Make(width(), height()), nullptr, nullptr));
314 } 313 }
315 314
316 static bool drawNeedsLayer(const SkPaint& paint) 315 static bool drawNeedsLayer(const SkPaint& paint)
317 { 316 {
318 if (SkColorGetA(paint.getColor()) < 255) 317 if (SkColorGetA(paint.getColor()) < 255)
319 return true; 318 return true;
320 319
321 SkXfermode::Mode xfermode; 320 SkXfermode::Mode xfermode;
322 if (SkXfermode::AsMode(paint.getXfermode(), &xfermode)) { 321 if (SkXfermode::AsMode(paint.getXfermode(), &xfermode)) {
323 if (xfermode != SkXfermode::kSrcOver_Mode) 322 if (xfermode != SkXfermode::kSrcOver_Mode)
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 536
538 return m_page; 537 return m_page;
539 } 538 }
540 539
541 String SVGImage::filenameExtension() const 540 String SVGImage::filenameExtension() const
542 { 541 {
543 return "svg"; 542 return "svg";
544 } 543 }
545 544
546 } // namespace blink 545 } // namespace blink
OLDNEW
« no previous file with comments | « skia/config/SkUserConfig.h ('k') | third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698