| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class CanvasInterceptorBase { | 47 class CanvasInterceptorBase { |
| 48 STACK_ALLOCATED(); | 48 STACK_ALLOCATED(); |
| 49 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); | 49 WTF_MAKE_NONCOPYABLE(CanvasInterceptorBase); |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 CanvasInterceptorBase(InterceptingCanvasBase* canvas) : canvas_(canvas) { | 52 CanvasInterceptorBase(InterceptingCanvasBase* canvas) : canvas_(canvas) { |
| 53 ++canvas_->call_nesting_depth_; | 53 ++canvas_->call_nesting_depth_; |
| 54 } | 54 } |
| 55 | 55 |
| 56 ~CanvasInterceptorBase() { | 56 ~CanvasInterceptorBase() { |
| 57 ASSERT(canvas_->call_nesting_depth_ > 0); | 57 DCHECK_GT(canvas_->call_nesting_depth_, 0u); |
| 58 if (!--canvas_->call_nesting_depth_) | 58 if (!--canvas_->call_nesting_depth_) |
| 59 canvas_->call_count_++; | 59 canvas_->call_count_++; |
| 60 } | 60 } |
| 61 | 61 |
| 62 DerivedCanvas* Canvas() { return static_cast<DerivedCanvas*>(canvas_); } | 62 DerivedCanvas* Canvas() { return static_cast<DerivedCanvas*>(canvas_); } |
| 63 bool TopLevelCall() const { return canvas_->CallNestingDepth() == 1; } | 63 bool TopLevelCall() const { return canvas_->CallNestingDepth() == 1; } |
| 64 InterceptingCanvasBase* canvas_; | 64 InterceptingCanvasBase* canvas_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 void ResetStepCount() { call_count_ = 0; } | 67 void ResetStepCount() { call_count_ = 0; } |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 void willRestore() override { | 359 void willRestore() override { |
| 360 Interceptor interceptor(this); | 360 Interceptor interceptor(this); |
| 361 this->SkCanvas::willRestore(); | 361 this->SkCanvas::willRestore(); |
| 362 } | 362 } |
| 363 }; | 363 }; |
| 364 | 364 |
| 365 } // namespace blink | 365 } // namespace blink |
| 366 | 366 |
| 367 #endif // InterceptingCanvas_h | 367 #endif // InterceptingCanvas_h |
| OLD | NEW |