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

Side by Side Diff: src/core/SkCanvas.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 | « samplecode/SampleApp.cpp ('k') | src/core/SkClipStack.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 2008 The Android Open Source Project 2 * Copyright 2008 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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 30 matching lines...) Expand all
41 /* 41 /*
42 * Return true if the drawing this rect would hit every pixels in the canvas. 42 * Return true if the drawing this rect would hit every pixels in the canvas.
43 * 43 *
44 * Returns false if 44 * Returns false if
45 * - rect does not contain the canvas' bounds 45 * - rect does not contain the canvas' bounds
46 * - paint is not fill 46 * - paint is not fill
47 * - paint would blur or otherwise change the coverage of the rect 47 * - paint would blur or otherwise change the coverage of the rect
48 */ 48 */
49 bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa int, 49 bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa int,
50 ShaderOverrideOpacity overrideOpacity ) const { 50 ShaderOverrideOpacity overrideOpacity ) const {
51 SK_COMPILE_ASSERT((int)SkPaintPriv::kNone_ShaderOverrideOpacity == 51 static_assert((int)SkPaintPriv::kNone_ShaderOverrideOpacity ==
52 (int)kNone_ShaderOverrideOpacity, 52 (int)kNone_ShaderOverrideOpacity,
53 need_matching_enums0); 53 "need_matching_enums0");
54 SK_COMPILE_ASSERT((int)SkPaintPriv::kOpaque_ShaderOverrideOpacity == 54 static_assert((int)SkPaintPriv::kOpaque_ShaderOverrideOpacity ==
55 (int)kOpaque_ShaderOverrideOpacity, 55 (int)kOpaque_ShaderOverrideOpacity,
56 need_matching_enums1); 56 "need_matching_enums1");
57 SK_COMPILE_ASSERT((int)SkPaintPriv::kNotOpaque_ShaderOverrideOpacity == 57 static_assert((int)SkPaintPriv::kNotOpaque_ShaderOverrideOpacity ==
58 (int)kNotOpaque_ShaderOverrideOpacity, 58 (int)kNotOpaque_ShaderOverrideOpacity,
59 need_matching_enums2); 59 "need_matching_enums2");
60 60
61 const SkISize size = this->getBaseLayerSize(); 61 const SkISize size = this->getBaseLayerSize();
62 const SkRect bounds = SkRect::MakeIWH(size.width(), size.height()); 62 const SkRect bounds = SkRect::MakeIWH(size.width(), size.height());
63 if (!this->getClipStack()->quickContains(bounds)) { 63 if (!this->getClipStack()->quickContains(bounds)) {
64 return false; 64 return false;
65 } 65 }
66 66
67 if (rect) { 67 if (rect) {
68 if (!this->getTotalMatrix().rectStaysRect()) { 68 if (!this->getTotalMatrix().rectStaysRect()) {
69 return false; // conservative 69 return false; // conservative
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 } 2784 }
2785 2785
2786 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); 2786 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect());
2787 picture->playback(this); 2787 picture->playback(this);
2788 } 2788 }
2789 2789
2790 /////////////////////////////////////////////////////////////////////////////// 2790 ///////////////////////////////////////////////////////////////////////////////
2791 /////////////////////////////////////////////////////////////////////////////// 2791 ///////////////////////////////////////////////////////////////////////////////
2792 2792
2793 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { 2793 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) {
2794 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small ); 2794 static_assert(sizeof(fStorage) >= sizeof(SkDrawIter), "fStorage_too_small");
2795 2795
2796 SkASSERT(canvas); 2796 SkASSERT(canvas);
2797 2797
2798 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips); 2798 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips);
2799 fDone = !fImpl->next(); 2799 fDone = !fImpl->next();
2800 } 2800 }
2801 2801
2802 SkCanvas::LayerIter::~LayerIter() { 2802 SkCanvas::LayerIter::~LayerIter() {
2803 fImpl->~SkDrawIter(); 2803 fImpl->~SkDrawIter();
2804 } 2804 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 } 2884 }
2885 2885
2886 if (matrix) { 2886 if (matrix) {
2887 canvas->concat(*matrix); 2887 canvas->concat(*matrix);
2888 } 2888 }
2889 } 2889 }
2890 2890
2891 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2891 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2892 fCanvas->restoreToCount(fSaveCount); 2892 fCanvas->restoreToCount(fSaveCount);
2893 } 2893 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkClipStack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698