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

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

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/core/SkPaint.cpp ('k') | src/core/SkResourceCache.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 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 "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkImage_Base.h" 10 #include "SkImage_Base.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 1, // DRAW_PATCH - right after op code 98 1, // DRAW_PATCH - right after op code
99 1, // DRAW_PICTURE_MATRIX_PAINT - right after op code 99 1, // DRAW_PICTURE_MATRIX_PAINT - right after op code
100 1, // DRAW_TEXT_BLOB- right after op code 100 1, // DRAW_TEXT_BLOB- right after op code
101 1, // DRAW_IMAGE - right after op code 101 1, // DRAW_IMAGE - right after op code
102 1, // DRAW_IMAGE_RECT_STRICT - right after op code 102 1, // DRAW_IMAGE_RECT_STRICT - right after op code
103 1, // DRAW_ATLAS - right after op code 103 1, // DRAW_ATLAS - right after op code
104 1, // DRAW_IMAGE_NINE - right after op code 104 1, // DRAW_IMAGE_NINE - right after op code
105 1, // DRAW_IMAGE_RECT - right after op code 105 1, // DRAW_IMAGE_RECT - right after op code
106 }; 106 };
107 107
108 SK_COMPILE_ASSERT(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1, 108 static_assert(sizeof(gPaintOffsets) == LAST_DRAWTYPE_ENUM + 1, "need_to_be_i n_sync");
109 need_to_be_in_sync);
110 SkASSERT((unsigned)op <= (unsigned)LAST_DRAWTYPE_ENUM); 109 SkASSERT((unsigned)op <= (unsigned)LAST_DRAWTYPE_ENUM);
111 110
112 int overflow = 0; 111 int overflow = 0;
113 if (0 != (opSize & ~MASK_24) || opSize == MASK_24) { 112 if (0 != (opSize & ~MASK_24) || opSize == MASK_24) {
114 // This op's size overflows so an extra uint32_t will be written 113 // This op's size overflows so an extra uint32_t will be written
115 // after the op code 114 // after the op code
116 overflow = sizeof(uint32_t); 115 overflow = sizeof(uint32_t);
117 } 116 }
118 117
119 if (SAVE_LAYER == op) { 118 if (SAVE_LAYER == op) {
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1060 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1062 int index = fTextBlobRefs.count(); 1061 int index = fTextBlobRefs.count();
1063 *fTextBlobRefs.append() = blob; 1062 *fTextBlobRefs.append() = blob;
1064 blob->ref(); 1063 blob->ref();
1065 // follow the convention of recording a 1-based index 1064 // follow the convention of recording a 1-based index
1066 this->addInt(index + 1); 1065 this->addInt(index + 1);
1067 } 1066 }
1068 1067
1069 /////////////////////////////////////////////////////////////////////////////// 1068 ///////////////////////////////////////////////////////////////////////////////
1070 1069
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698