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

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

Issue 495453003: fix #if to #ifdef for SK_DEBUG (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « no previous file | 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "SkRecordDraw.h" 8 #include "SkRecordDraw.h"
9 #include "SkTSort.h" 9 #include "SkTSort.h"
10 10
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 for (int i = 1; i < N; i++) { 305 for (int i = 1; i < N; i++) {
306 left = SkMinScalar(left, op.xpos[i]); 306 left = SkMinScalar(left, op.xpos[i]);
307 right = SkMaxScalar(right, op.xpos[i]); 307 right = SkMaxScalar(right, op.xpos[i]);
308 } 308 }
309 SkRect dst = { left, op.y, right, op.y }; 309 SkRect dst = { left, op.y, right, op.y };
310 AdjustTextForFontMetrics(&dst, op.paint); 310 AdjustTextForFontMetrics(&dst, op.paint);
311 return this->adjustAndMap(dst, &op.paint); 311 return this->adjustAndMap(dst, &op.paint);
312 } 312 }
313 313
314 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) { 314 static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
315 #if SK_DEBUG 315 #ifdef SK_DEBUG
316 SkRect correct = *rect; 316 SkRect correct = *rect;
317 #endif 317 #endif
318 const SkScalar yPad = 1.5f * paint.getTextSize(), // In practice, this seems to be enough. 318 const SkScalar yPad = 1.5f * paint.getTextSize(), // In practice, this seems to be enough.
319 xPad = 4.0f * yPad; // Hack for very wide Github logo font. 319 xPad = 4.0f * yPad; // Hack for very wide Github logo font.
320 rect->outset(xPad, yPad); 320 rect->outset(xPad, yPad);
321 #if SK_DEBUG 321 #ifdef SK_DEBUG
322 SkPaint::FontMetrics metrics; 322 SkPaint::FontMetrics metrics;
323 paint.getFontMetrics(&metrics); 323 paint.getFontMetrics(&metrics);
324 correct.fLeft += metrics.fXMin; 324 correct.fLeft += metrics.fXMin;
325 correct.fTop += metrics.fTop; 325 correct.fTop += metrics.fTop;
326 correct.fRight += metrics.fXMax; 326 correct.fRight += metrics.fXMax;
327 correct.fBottom += metrics.fBottom; 327 correct.fBottom += metrics.fBottom;
328 SkASSERTF(rect->contains(correct), "%f %f %f %f vs. %f %f %f %f\n", 328 SkASSERTF(rect->contains(correct), "%f %f %f %f vs. %f %f %f %f\n",
329 -xPad, -yPad, +xPad, +yPad, 329 -xPad, -yPad, +xPad, +yPad,
330 metrics.fXMin, metrics.fTop, metrics.fXMax, metrics.fBottom); 330 metrics.fXMin, metrics.fTop, metrics.fXMax, metrics.fBottom);
331 #endif 331 #endif
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 387 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
388 SkTDArray<SaveBounds> fSaveStack; 388 SkTDArray<SaveBounds> fSaveStack;
389 SkTDArray<unsigned> fControlIndices; 389 SkTDArray<unsigned> fControlIndices;
390 }; 390 };
391 391
392 } // namespace SkRecords 392 } // namespace SkRecords
393 393
394 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 394 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
395 SkRecords::FillBounds(record, bbh); 395 SkRecords::FillBounds(record, bbh);
396 } 396 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698