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

Side by Side Diff: third_party/WebKit/Source/platform/DragImage.cpp

Issue 1855273002: Update new Surface callsites (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: software_output_device was indirectly including skia::refptr, switch to sk_sp<> 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if (size.isEmpty()) 89 if (size.isEmpty())
90 return nullptr; 90 return nullptr;
91 91
92 if (transform.isIdentity() && opacity == 1) { 92 if (transform.isIdentity() && opacity == 1) {
93 // Nothing to adjust, just use the original. 93 // Nothing to adjust, just use the original.
94 ASSERT(image->width() == size.width()); 94 ASSERT(image->width() == size.width());
95 ASSERT(image->height() == size.height()); 95 ASSERT(image->height() == size.height());
96 return image; 96 return image;
97 } 97 }
98 98
99 RefPtr<SkSurface> surface = adoptRef(SkSurface::NewRasterN32Premul(size.widt h(), size.height())); 99 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(size.width(), size .height());
100 if (!surface) 100 if (!surface)
101 return nullptr; 101 return nullptr;
102 102
103 SkPaint paint; 103 SkPaint paint;
104 ASSERT(opacity >= 0 && opacity <= 1); 104 ASSERT(opacity >= 0 && opacity <= 1);
105 paint.setAlpha(opacity * 255); 105 paint.setAlpha(opacity * 255);
106 paint.setFilterQuality(interpolationQuality == InterpolationNone 106 paint.setFilterQuality(interpolationQuality == InterpolationNone
107 ? kNone_SkFilterQuality : kHigh_SkFilterQuality); 107 ? kNone_SkFilterQuality : kHigh_SkFilterQuality);
108 108
109 SkCanvas* canvas = surface->getCanvas(); 109 SkCanvas* canvas = surface->getCanvas();
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 268
269 void DragImage::scale(float scaleX, float scaleY) 269 void DragImage::scale(float scaleX, float scaleY)
270 { 270 {
271 skia::ImageOperations::ResizeMethod resizeMethod = m_interpolationQuality == InterpolationNone ? skia::ImageOperations::RESIZE_BOX : skia::ImageOperations:: RESIZE_LANCZOS3; 271 skia::ImageOperations::ResizeMethod resizeMethod = m_interpolationQuality == InterpolationNone ? skia::ImageOperations::RESIZE_BOX : skia::ImageOperations:: RESIZE_LANCZOS3;
272 int imageWidth = scaleX * m_bitmap.width(); 272 int imageWidth = scaleX * m_bitmap.width();
273 int imageHeight = scaleY * m_bitmap.height(); 273 int imageHeight = scaleY * m_bitmap.height();
274 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, imageHeight); 274 m_bitmap = skia::ImageOperations::Resize(m_bitmap, resizeMethod, imageWidth, imageHeight);
275 } 275 }
276 276
277 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698