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

Side by Side Diff: src/pdf/SkPDFGraphicState.cpp

Issue 313823004: Add assertHeld() to SkMutex. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: notes Created 6 years, 6 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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkPDFFormXObject.h" 8 #include "SkPDFFormXObject.h"
9 #include "SkPDFGraphicState.h" 9 #include "SkPDFGraphicState.h"
10 #include "SkPDFUtils.h" 10 #include "SkPDFUtils.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return CanonicalPaints()[index].fGraphicState; 107 return CanonicalPaints()[index].fGraphicState;
108 } 108 }
109 GSCanonicalEntry newEntry(new SkPDFGraphicState(paint)); 109 GSCanonicalEntry newEntry(new SkPDFGraphicState(paint));
110 CanonicalPaints().push(newEntry); 110 CanonicalPaints().push(newEntry);
111 return newEntry.fGraphicState; 111 return newEntry.fGraphicState;
112 } 112 }
113 113
114 // static 114 // static
115 SkPDFObject* SkPDFGraphicState::GetInvertFunction() { 115 SkPDFObject* SkPDFGraphicState::GetInvertFunction() {
116 // This assumes that canonicalPaintsMutex is held. 116 // This assumes that canonicalPaintsMutex is held.
117 CanonicalPaintsMutex().assertHeld();
117 static SkPDFStream* invertFunction = NULL; 118 static SkPDFStream* invertFunction = NULL;
118 if (!invertFunction) { 119 if (!invertFunction) {
119 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use 120 // Acrobat crashes if we use a type 0 function, kpdf crashes if we use
120 // a type 2 function, so we use a type 4 function. 121 // a type 2 function, so we use a type 4 function.
121 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray); 122 SkAutoTUnref<SkPDFArray> domainAndRange(new SkPDFArray);
122 domainAndRange->reserve(2); 123 domainAndRange->reserve(2);
123 domainAndRange->appendInt(0); 124 domainAndRange->appendInt(0);
124 domainAndRange->appendInt(1); 125 domainAndRange->appendInt(1);
125 126
126 static const char psInvert[] = "{1 exch sub}"; 127 static const char psInvert[] = "{1 exch sub}";
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 280 }
280 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode || 281 if (bXfermodeName < 0 || bXfermodeName > SkXfermode::kLastMode ||
281 blend_mode_from_xfermode(bXfermodeName) == NULL) { 282 blend_mode_from_xfermode(bXfermodeName) == NULL) {
282 bXfermodeName = SkXfermode::kSrcOver_Mode; 283 bXfermodeName = SkXfermode::kSrcOver_Mode;
283 } 284 }
284 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName); 285 const char* bXfermodeString = blend_mode_from_xfermode(bXfermodeName);
285 SkASSERT(bXfermodeString != NULL); 286 SkASSERT(bXfermodeString != NULL);
286 287
287 return strcmp(aXfermodeString, bXfermodeString) == 0; 288 return strcmp(aXfermodeString, bXfermodeString) == 0;
288 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698