OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvasStateUtils.h" | 8 #include "SkCanvasStateUtils.h" |
9 | 9 |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 134 }; |
135 | 135 |
136 //////////////////////////////////////////////////////////////////////////////// | 136 //////////////////////////////////////////////////////////////////////////////// |
137 | 137 |
138 class ClipValidator : public SkCanvas::ClipVisitor { | 138 class ClipValidator : public SkCanvas::ClipVisitor { |
139 public: | 139 public: |
140 ClipValidator() : fFailed(false) {} | 140 ClipValidator() : fFailed(false) {} |
141 bool failed() { return fFailed; } | 141 bool failed() { return fFailed; } |
142 | 142 |
143 // ClipVisitor | 143 // ClipVisitor |
144 virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) S
K_OVERRIDE { | 144 void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) SK_OVERRI
DE { |
145 fFailed |= antialias; | 145 fFailed |= antialias; |
146 } | 146 } |
147 | 147 |
148 virtual void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias
) SK_OVERRIDE { | 148 void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) SK_OVE
RRIDE { |
149 fFailed |= antialias; | 149 fFailed |= antialias; |
150 } | 150 } |
151 | 151 |
152 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) SK_OVERRI
DE { | 152 void clipPath(const SkPath&, SkRegion::Op, bool antialias) SK_OVERRIDE { |
153 fFailed |= antialias; | 153 fFailed |= antialias; |
154 } | 154 } |
155 | 155 |
156 private: | 156 private: |
157 bool fFailed; | 157 bool fFailed; |
158 }; | 158 }; |
159 | 159 |
160 static void setup_MC_state(SkMCState* state, const SkMatrix& matrix, const SkReg
ion& clip) { | 160 static void setup_MC_state(SkMCState* state, const SkMatrix& matrix, const SkReg
ion& clip) { |
161 // initialize the struct | 161 // initialize the struct |
162 state->clipRectCount = 0; | 162 state->clipRectCount = 0; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 //////////////////////////////////////////////////////////////////////////////// | 351 //////////////////////////////////////////////////////////////////////////////// |
352 | 352 |
353 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) { | 353 void SkCanvasStateUtils::ReleaseCanvasState(SkCanvasState* state) { |
354 SkASSERT(!state || SkCanvasState_v1::kVersion == state->version); | 354 SkASSERT(!state || SkCanvasState_v1::kVersion == state->version); |
355 // Upcast to the correct version of SkCanvasState. This avoids having a virt
ual destructor on | 355 // Upcast to the correct version of SkCanvasState. This avoids having a virt
ual destructor on |
356 // SkCanvasState. That would be strange since SkCanvasState has no other vir
tual functions, and | 356 // SkCanvasState. That would be strange since SkCanvasState has no other vir
tual functions, and |
357 // instead uses the field "version" to determine how to behave. | 357 // instead uses the field "version" to determine how to behave. |
358 SkDELETE(static_cast<SkCanvasState_v1*>(state)); | 358 SkDELETE(static_cast<SkCanvasState_v1*>(state)); |
359 } | 359 } |
OLD | NEW |