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

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

Issue 1974783002: Revert of Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 MOVE_FIELD(PathEffect) 362 MOVE_FIELD(PathEffect)
363 MOVE_FIELD(MaskFilter) 363 MOVE_FIELD(MaskFilter)
364 #undef MOVE_FIELD 364 #undef MOVE_FIELD
365 void SkPaint::setLooper(sk_sp<SkDrawLooper> looper) { fLooper = std::move(looper ); } 365 void SkPaint::setLooper(sk_sp<SkDrawLooper> looper) { fLooper = std::move(looper ); }
366 366
367 #define SET_PTR(Field) \ 367 #define SET_PTR(Field) \
368 Sk##Field* SkPaint::set##Field(Sk##Field* f) { \ 368 Sk##Field* SkPaint::set##Field(Sk##Field* f) { \
369 this->f##Field.reset(SkSafeRef(f)); \ 369 this->f##Field.reset(SkSafeRef(f)); \
370 return f; \ 370 return f; \
371 } 371 }
372 #ifdef SK_SUPPORT_LEGACY_TYPEFACE_PTR
373 SET_PTR(Typeface) 372 SET_PTR(Typeface)
374 #endif
375 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR 373 #ifdef SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR
376 SET_PTR(Rasterizer) 374 SET_PTR(Rasterizer)
377 #endif 375 #endif
378 SET_PTR(ImageFilter) 376 SET_PTR(ImageFilter)
379 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR 377 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR
380 SET_PTR(Shader) 378 SET_PTR(Shader)
381 #endif 379 #endif
382 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR 380 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR
383 SET_PTR(ColorFilter) 381 SET_PTR(ColorFilter)
384 #endif 382 #endif
(...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1891 1889
1892 unsigned flatFlags = unpack_paint_flags(this, buffer.readUInt()); 1890 unsigned flatFlags = unpack_paint_flags(this, buffer.readUInt());
1893 1891
1894 uint32_t tmp = buffer.readUInt(); 1892 uint32_t tmp = buffer.readUInt();
1895 this->setStrokeCap(static_cast<Cap>((tmp >> 24) & 0xFF)); 1893 this->setStrokeCap(static_cast<Cap>((tmp >> 24) & 0xFF));
1896 this->setStrokeJoin(static_cast<Join>((tmp >> 16) & 0xFF)); 1894 this->setStrokeJoin(static_cast<Join>((tmp >> 16) & 0xFF));
1897 this->setStyle(static_cast<Style>((tmp >> 8) & 0xFF)); 1895 this->setStyle(static_cast<Style>((tmp >> 8) & 0xFF));
1898 this->setTextEncoding(static_cast<TextEncoding>((tmp >> 0) & 0xFF)); 1896 this->setTextEncoding(static_cast<TextEncoding>((tmp >> 0) & 0xFF));
1899 1897
1900 if (flatFlags & kHasTypeface_FlatFlag) { 1898 if (flatFlags & kHasTypeface_FlatFlag) {
1901 this->setTypeface(sk_ref_sp(buffer.readTypeface())); 1899 this->setTypeface(buffer.readTypeface());
1902 } else { 1900 } else {
1903 this->setTypeface(nullptr); 1901 this->setTypeface(nullptr);
1904 } 1902 }
1905 1903
1906 if (flatFlags & kHasEffects_FlatFlag) { 1904 if (flatFlags & kHasEffects_FlatFlag) {
1907 this->setPathEffect(buffer.readPathEffect()); 1905 this->setPathEffect(buffer.readPathEffect());
1908 this->setShader(buffer.readShader()); 1906 this->setShader(buffer.readShader());
1909 this->setXfermode(buffer.readXfermode()); 1907 this->setXfermode(buffer.readXfermode());
1910 this->setMaskFilter(buffer.readMaskFilter()); 1908 this->setMaskFilter(buffer.readMaskFilter());
1911 this->setColorFilter(buffer.readColorFilter()); 1909 this->setColorFilter(buffer.readColorFilter());
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 } 2320 }
2323 2321
2324 uint32_t SkPaint::getHash() const { 2322 uint32_t SkPaint::getHash() const {
2325 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2323 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2326 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2324 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2327 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t), 2325 static_assert(offsetof(SkPaint, fBitfields) == 9 * sizeof(void*) + 6 * sizeo f(uint32_t),
2328 "SkPaint_notPackedTightly"); 2326 "SkPaint_notPackedTightly");
2329 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2327 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2330 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2328 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2331 } 2329 }
OLDNEW
« no previous file with comments | « src/core/SkFont.cpp ('k') | src/core/SkPictureData.cpp » ('j') | src/ports/SkFontMgr_android.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698