OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void OpaqueRectTrackingContentLayerDelegate::paintContents( | 51 void OpaqueRectTrackingContentLayerDelegate::paintContents( |
52 SkCanvas* canvas, const WebRect& clip, bool canPaintLCDText, WebFloatRect& o
paque, | 52 SkCanvas* canvas, const WebRect& clip, bool canPaintLCDText, WebFloatRect& o
paque, |
53 blink::WebContentLayerClient::GraphicsContextStatus contextStatus) | 53 blink::WebContentLayerClient::GraphicsContextStatus contextStatus) |
54 { | 54 { |
55 static const unsigned char* annotationsEnabled = 0; | 55 static const unsigned char* annotationsEnabled = 0; |
56 if (UNLIKELY(!annotationsEnabled)) | 56 if (UNLIKELY(!annotationsEnabled)) |
57 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA
BLED_BY_DEFAULT("blink.graphics_context_annotations")); | 57 annotationsEnabled = EventTracer::getTraceCategoryEnabledFlag(TRACE_DISA
BLED_BY_DEFAULT("blink.graphics_context_annotations")); |
58 | 58 |
59 GraphicsContext context(canvas, | 59 GraphicsContext context(canvas, |
60 contextStatus == blink::WebContentLayerClient::GraphicsContextEnabled ?
GraphicsContext::NothingDisabled : GraphicsContext::FullyDisabled); | 60 contextStatus == blink::WebContentLayerClient::GraphicsContextEnabled ?
GraphicsContext::NothingDisabled : GraphicsContext::FullyDisabled); |
61 context.setTrackOpaqueRegion(!m_opaque); | 61 context.setRegionTrackingMode(m_opaque ? GraphicsContext::RegionTrackingDisa
bled : GraphicsContext::RegionTrackingOpaque); |
62 context.setCertainlyOpaque(m_opaque); | 62 context.setCertainlyOpaque(m_opaque); |
63 context.setShouldSmoothFonts(canPaintLCDText); | 63 context.setShouldSmoothFonts(canPaintLCDText); |
64 | 64 |
65 if (*annotationsEnabled) | 65 if (*annotationsEnabled) |
66 context.setAnnotationMode(AnnotateAll); | 66 context.setAnnotationMode(AnnotateAll); |
67 | 67 |
68 // Record transform prior to painting, as all opaque tracking will be | 68 // Record transform prior to painting, as all opaque tracking will be |
69 // relative to this current value. | 69 // relative to this current value. |
70 AffineTransform canvasToContentTransform = context.getCTM().inverse(); | 70 AffineTransform canvasToContentTransform = context.getCTM().inverse(); |
71 | 71 |
72 m_painter->paint(context, clip); | 72 m_painter->paint(context, clip); |
73 | 73 |
74 // Transform tracked opaque paints back to our layer's content space. | 74 // Transform tracked opaque paints back to our layer's content space. |
75 ASSERT(canvasToContentTransform.isInvertible()); | 75 ASSERT(canvasToContentTransform.isInvertible()); |
76 ASSERT(canvasToContentTransform.preservesAxisAlignment()); | 76 ASSERT(canvasToContentTransform.preservesAxisAlignment()); |
77 opaque = canvasToContentTransform.mapRect(context.opaqueRegion().asRect()); | 77 opaque = canvasToContentTransform.mapRect(context.opaqueRegion().asRect()); |
78 } | 78 } |
79 | 79 |
80 } | 80 } |
OLD | NEW |