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

Side by Side Diff: src/core/SkPaint.cpp

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « src/c/sk_surface.cpp ('k') | src/effects/SkBlurDrawLooper.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAutoKern.h" 9 #include "SkAutoKern.h"
10 #include "SkChecksum.h" 10 #include "SkChecksum.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 #endif 379 #endif
380 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR 380 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR
381 SET_PTR(ColorFilter) 381 SET_PTR(ColorFilter)
382 #endif 382 #endif
383 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR 383 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
384 SET_PTR(Xfermode) 384 SET_PTR(Xfermode)
385 #endif 385 #endif
386 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR 386 #ifdef SK_SUPPORT_LEGACY_PATHEFFECT_PTR
387 SET_PTR(PathEffect) 387 SET_PTR(PathEffect)
388 #endif 388 #endif
389 #ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR
389 SET_PTR(MaskFilter) 390 SET_PTR(MaskFilter)
391 #endif
390 #undef SET_PTR 392 #undef SET_PTR
391 393
392 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR 394 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR
393 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { 395 SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) {
394 fLooper.reset(SkSafeRef(looper)); 396 fLooper.reset(SkSafeRef(looper));
395 return looper; 397 return looper;
396 } 398 }
397 #endif 399 #endif
398 400
399 SkXfermode* SkPaint::setXfermodeMode(SkXfermode::Mode mode) { 401 SkXfermode* SkPaint::setXfermodeMode(SkXfermode::Mode mode) {
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 2250
2249 SkPaint::Style style = SkPaint::kFill_Style; 2251 SkPaint::Style style = SkPaint::kFill_Style;
2250 sk_sp<SkPathEffect> pe; 2252 sk_sp<SkPathEffect> pe;
2251 2253
2252 if (!applyStrokeAndPathEffects) { 2254 if (!applyStrokeAndPathEffects) {
2253 style = paint.getStyle(); // restore 2255 style = paint.getStyle(); // restore
2254 pe = sk_ref_sp(paint.getPathEffect()); // restore 2256 pe = sk_ref_sp(paint.getPathEffect()); // restore
2255 } 2257 }
2256 fPaint.setStyle(style); 2258 fPaint.setStyle(style);
2257 fPaint.setPathEffect(pe); 2259 fPaint.setPathEffect(pe);
2258 fPaint.setMaskFilter(paint.getMaskFilter()); // restore 2260 fPaint.setMaskFilter(sk_ref_sp(paint.getMaskFilter())); // restore
2259 2261
2260 // now compute fXOffset if needed 2262 // now compute fXOffset if needed
2261 2263
2262 SkScalar xOffset = 0; 2264 SkScalar xOffset = 0;
2263 if (paint.getTextAlign() != SkPaint::kLeft_Align) { // need to measure first 2265 if (paint.getTextAlign() != SkPaint::kLeft_Align) { // need to measure first
2264 int count; 2266 int count;
2265 SkScalar width = SkScalarMul(fPaint.measure_text(fCache, text, length, 2267 SkScalar width = SkScalarMul(fPaint.measure_text(fCache, text, length,
2266 &count, nullptr), fScal e); 2268 &count, nullptr), fScal e);
2267 if (paint.getTextAlign() == SkPaint::kCenter_Align) { 2269 if (paint.getTextAlign() == SkPaint::kCenter_Align) {
2268 width = SkScalarHalf(width); 2270 width = SkScalarHalf(width);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2357 } 2359 }
2358 2360
2359 uint32_t SkPaint::getHash() const { 2361 uint32_t SkPaint::getHash() const {
2360 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2362 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2361 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2363 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2362 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t), 2364 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t),
2363 "SkPaint_notPackedTightly"); 2365 "SkPaint_notPackedTightly");
2364 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2366 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2365 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2367 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2366 } 2368 }
OLDNEW
« no previous file with comments | « src/c/sk_surface.cpp ('k') | src/effects/SkBlurDrawLooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698