| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #ifndef GraphicsContextAnnotator_h | 32 #ifndef GraphicsContextAnnotator_h |
| 33 #define GraphicsContextAnnotator_h | 33 #define GraphicsContextAnnotator_h |
| 34 | 34 |
| 35 // FIXME: Introduce a real paint API instead of piggybacking on GraphicsContextA
nnotator. |
| 35 #define ANNOTATE_GRAPHICS_CONTEXT(paintInfo, renderer) \ | 36 #define ANNOTATE_GRAPHICS_CONTEXT(paintInfo, renderer) \ |
| 37 GraphicsContextAnnotator::trackPaintInvalidation(paintInfo, renderer); \ |
| 36 GraphicsContextAnnotator scopedGraphicsContextAnnotator; \ | 38 GraphicsContextAnnotator scopedGraphicsContextAnnotator; \ |
| 37 if (UNLIKELY(paintInfo.context->annotationMode())) \ | 39 if (UNLIKELY(paintInfo.context->annotationMode())) \ |
| 38 scopedGraphicsContextAnnotator.annotate(paintInfo, renderer) | 40 scopedGraphicsContextAnnotator.annotate(paintInfo, renderer) |
| 39 | 41 |
| 40 namespace blink { | 42 namespace blink { |
| 41 | 43 |
| 42 class GraphicsContext; | 44 class GraphicsContext; |
| 43 struct PaintInfo; | 45 struct PaintInfo; |
| 44 class RenderObject; | 46 class RenderObject; |
| 45 | 47 |
| 46 class GraphicsContextAnnotator { | 48 class GraphicsContextAnnotator { |
| 47 public: | 49 public: |
| 48 GraphicsContextAnnotator() | 50 GraphicsContextAnnotator() |
| 49 : m_context(0) | 51 : m_context(0) |
| 50 { } | 52 { } |
| 51 | 53 |
| 52 ~GraphicsContextAnnotator() | 54 ~GraphicsContextAnnotator() |
| 53 { | 55 { |
| 54 if (UNLIKELY(m_context != 0)) | 56 if (UNLIKELY(m_context != 0)) |
| 55 finishAnnotation(); | 57 finishAnnotation(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void annotate(const PaintInfo&, const RenderObject*); | 60 void annotate(const PaintInfo&, const RenderObject*); |
| 59 | 61 |
| 62 static void trackPaintInvalidation(const PaintInfo&, RenderObject*); |
| 63 |
| 60 private: | 64 private: |
| 61 void finishAnnotation(); | 65 void finishAnnotation(); |
| 62 | 66 |
| 63 GraphicsContext* m_context; | 67 GraphicsContext* m_context; |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 } // namespace blink | 70 } // namespace blink |
| 67 | 71 |
| 68 #endif // GraphicsContextAnnotator_h | 72 #endif // GraphicsContextAnnotator_h |
| OLD | NEW |