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

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

Issue 48523008: All SkAnnotations are no-draw. Propose we fold that through. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: deprecate Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkAnnotation.cpp ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 fTextScaleX = SK_Scalar1; 73 fTextScaleX = SK_Scalar1;
74 fColor = SK_ColorBLACK; 74 fColor = SK_ColorBLACK;
75 fMiterLimit = SkPaintDefaults_MiterLimit; 75 fMiterLimit = SkPaintDefaults_MiterLimit;
76 fFlags = SkPaintDefaults_Flags; 76 fFlags = SkPaintDefaults_Flags;
77 fCapType = kDefault_Cap; 77 fCapType = kDefault_Cap;
78 fJoinType = kDefault_Join; 78 fJoinType = kDefault_Join;
79 fTextAlign = kLeft_Align; 79 fTextAlign = kLeft_Align;
80 fStyle = kFill_Style; 80 fStyle = kFill_Style;
81 fTextEncoding = kUTF8_TextEncoding; 81 fTextEncoding = kUTF8_TextEncoding;
82 fHinting = SkPaintDefaults_Hinting; 82 fHinting = SkPaintDefaults_Hinting;
83 fPrivFlags = 0;
84 #ifdef SK_BUILD_FOR_ANDROID 83 #ifdef SK_BUILD_FOR_ANDROID
85 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid; 84 new (&fPaintOptionsAndroid) SkPaintOptionsAndroid;
86 fGenerationID = 0; 85 fGenerationID = 0;
87 #endif 86 #endif
88 } 87 }
89 88
90 SkPaint::SkPaint(const SkPaint& src) { 89 SkPaint::SkPaint(const SkPaint& src) {
91 memcpy(this, &src, sizeof(src)); 90 memcpy(this, &src, sizeof(src));
92 91
93 SkSafeRef(fTypeface); 92 SkSafeRef(fTypeface);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 419
421 SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imageFilter) { 420 SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imageFilter) {
422 SkRefCnt_SafeAssign(fImageFilter, imageFilter); 421 SkRefCnt_SafeAssign(fImageFilter, imageFilter);
423 GEN_ID_INC; 422 GEN_ID_INC;
424 return imageFilter; 423 return imageFilter;
425 } 424 }
426 425
427 SkAnnotation* SkPaint::setAnnotation(SkAnnotation* annotation) { 426 SkAnnotation* SkPaint::setAnnotation(SkAnnotation* annotation) {
428 SkRefCnt_SafeAssign(fAnnotation, annotation); 427 SkRefCnt_SafeAssign(fAnnotation, annotation);
429 GEN_ID_INC; 428 GEN_ID_INC;
430
431 bool isNoDraw = annotation && annotation->isNoDraw();
432 fPrivFlags = SkSetClearMask(fPrivFlags, isNoDraw, kNoDrawAnnotation_PrivFlag );
433
434 return annotation; 429 return annotation;
435 } 430 }
436 431
437 /////////////////////////////////////////////////////////////////////////////// 432 ///////////////////////////////////////////////////////////////////////////////
438 433
439 static SkScalar mag2(SkScalar x, SkScalar y) { 434 static SkScalar mag2(SkScalar x, SkScalar y) {
440 return x * x + y * y; 435 return x * x + y * y;
441 } 436 }
442 437
443 static bool tooBig(const SkMatrix& m, SkScalar ma2max) { 438 static bool tooBig(const SkMatrix& m, SkScalar ma2max) {
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 } 2103 }
2109 } 2104 }
2110 #ifdef SK_BUILD_FOR_ANDROID 2105 #ifdef SK_BUILD_FOR_ANDROID
2111 if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) { 2106 if (flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
2112 this->getPaintOptionsAndroid().flatten(buffer); 2107 this->getPaintOptionsAndroid().flatten(buffer);
2113 } 2108 }
2114 #endif 2109 #endif
2115 } 2110 }
2116 2111
2117 void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) { 2112 void SkPaint::unflatten(SkFlattenableReadBuffer& buffer) {
2118 fPrivFlags = 0;
2119
2120 uint8_t flatFlags = 0; 2113 uint8_t flatFlags = 0;
2121 if (buffer.isOrderedBinaryBuffer()) { 2114 if (buffer.isOrderedBinaryBuffer()) {
2122 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize); 2115 SkASSERT(SkAlign4(kPODPaintSize) == kPODPaintSize);
2123 const void* podData = buffer.getOrderedBinaryBuffer()->skip(kPODPaintSiz e); 2116 const void* podData = buffer.getOrderedBinaryBuffer()->skip(kPODPaintSiz e);
2124 const uint32_t* pod = reinterpret_cast<const uint32_t*>(podData); 2117 const uint32_t* pod = reinterpret_cast<const uint32_t*>(podData);
2125 2118
2126 // the order we read must match the order we wrote in flatten() 2119 // the order we read must match the order we wrote in flatten()
2127 this->setTextSize(read_scalar(pod)); 2120 this->setTextSize(read_scalar(pod));
2128 this->setTextScaleX(read_scalar(pod)); 2121 this->setTextScaleX(read_scalar(pod));
2129 this->setTextSkewX(read_scalar(pod)); 2122 this->setTextSkewX(read_scalar(pod));
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2608 case SkXfermode::kPlus_Mode: 2601 case SkXfermode::kPlus_Mode:
2609 return 0 == this->getAlpha(); 2602 return 0 == this->getAlpha();
2610 case SkXfermode::kDst_Mode: 2603 case SkXfermode::kDst_Mode:
2611 return true; 2604 return true;
2612 default: 2605 default:
2613 break; 2606 break;
2614 } 2607 }
2615 } 2608 }
2616 return false; 2609 return false;
2617 } 2610 }
OLDNEW
« no previous file with comments | « src/core/SkAnnotation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698