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

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

Issue 1779833002: Switch Blink SkShader clients to sk_sp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after MakePictureShader constness change Created 4 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Gradient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 SkPictureBuilder patternPicture(spacedTile, nullptr, &context); 280 SkPictureBuilder patternPicture(spacedTile, nullptr, &context);
281 if (!DrawingRecorder::useCachedDrawingIfPossible(patternPicture.context(), * this, DisplayItem::Type::SVGImage)) { 281 if (!DrawingRecorder::useCachedDrawingIfPossible(patternPicture.context(), * this, DisplayItem::Type::SVGImage)) {
282 DrawingRecorder patternPictureRecorder(patternPicture.context(), *this, DisplayItem::Type::SVGImage, spacedTile); 282 DrawingRecorder patternPictureRecorder(patternPicture.context(), *this, DisplayItem::Type::SVGImage, spacedTile);
283 // When generating an expanded tile, make sure we don't draw into the sp acing area. 283 // When generating an expanded tile, make sure we don't draw into the sp acing area.
284 if (tile != spacedTile) 284 if (tile != spacedTile)
285 patternPicture.context().clip(tile); 285 patternPicture.context().clip(tile);
286 SkPaint paint; 286 SkPaint paint;
287 drawForContainer(patternPicture.context().canvas(), paint, containerSize , zoom, tile, srcRect, url); 287 drawForContainer(patternPicture.context().canvas(), paint, containerSize , zoom, tile, srcRect, url);
288 } 288 }
289 RefPtr<const SkPicture> tilePicture = patternPicture.endRecording(); 289 // TODO(fmalita): convert SkPictureBuilder to return sk_sp<SkPicture>
290 sk_sp<SkPicture> tilePicture(const_cast<SkPicture*>(patternPicture.endRecord ing().leakRef()));
290 291
291 SkMatrix patternTransform; 292 SkMatrix patternTransform;
292 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced Tile.y()); 293 patternTransform.setTranslate(phase.x() + spacedTile.x(), phase.y() + spaced Tile.y());
293 RefPtr<SkShader> patternShader = adoptRef(SkShader::CreatePictureShader(
294 tilePicture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMod e,
295 &patternTransform, nullptr));
296 294
297 SkPaint paint; 295 SkPaint paint;
298 paint.setShader(patternShader.get()); 296 paint.setShader(SkShader::MakePictureShader(std::move(tilePicture),
297 SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &patternTransfor m, nullptr));
299 paint.setXfermodeMode(compositeOp); 298 paint.setXfermodeMode(compositeOp);
300 paint.setColorFilter(context.colorFilter()); 299 paint.setColorFilter(context.colorFilter());
301 context.drawRect(dstRect, paint); 300 context.drawRect(dstRect, paint);
302 } 301 }
303 302
304 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const FloatSize& containerSize) 303 PassRefPtr<SkImage> SVGImage::imageForCurrentFrameForContainer(const KURL& url, const FloatSize& containerSize)
305 { 304 {
306 if (!m_page) 305 if (!m_page)
307 return nullptr; 306 return nullptr;
308 307
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 538
540 return m_page; 539 return m_page;
541 } 540 }
542 541
543 String SVGImage::filenameExtension() const 542 String SVGImage::filenameExtension() const
544 { 543 {
545 return "svg"; 544 return "svg";
546 } 545 }
547 546
548 } // namespace blink 547 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Gradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698