| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con
st WebRect& clip, bool canPaintLCDText, WebFloatRect& opaque) | 52 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con
st WebRect& clip, bool canPaintLCDText, WebFloatRect& opaque) |
| 53 { | 53 { |
| 54 PlatformContextSkia platformContext(canvas); | 54 PlatformContextSkia platformContext(canvas); |
| 55 #if defined(SK_SUPPORT_HINTING_SCALE_FACTOR) | 55 #if defined(SK_SUPPORT_HINTING_SCALE_FACTOR) |
| 56 if (canvas) | 56 if (canvas) |
| 57 platformContext.setHintingScaleFactor(canvas->getTotalMatrix().getScaleX
()); | 57 platformContext.setHintingScaleFactor(canvas->getTotalMatrix().getScaleX
()); |
| 58 #endif | 58 #endif |
| 59 platformContext.setTrackOpaqueRegion(!m_opaque); | 59 platformContext.setTrackOpaqueRegion(!m_opaque); |
| 60 platformContext.setDrawingToImageBuffer(!m_opaque); |
| 60 GraphicsContext context(&platformContext); | 61 GraphicsContext context(&platformContext); |
| 61 context.setShouldSmoothFonts(canPaintLCDText && m_opaque); | 62 context.setShouldSmoothFonts(canPaintLCDText && m_opaque); |
| 62 | 63 |
| 63 // Record transform prior to painting, as all opaque tracking will be | 64 // Record transform prior to painting, as all opaque tracking will be |
| 64 // relative to this current value. | 65 // relative to this current value. |
| 65 AffineTransform canvasToContentTransform = context.getCTM().inverse(); | 66 AffineTransform canvasToContentTransform = context.getCTM().inverse(); |
| 66 | 67 |
| 67 m_painter->paint(context, clip); | 68 m_painter->paint(context, clip); |
| 68 | 69 |
| 69 // Transform tracked opaque paints back to our layer's content space. | 70 // Transform tracked opaque paints back to our layer's content space. |
| 70 ASSERT(canvasToContentTransform.isInvertible()); | 71 ASSERT(canvasToContentTransform.isInvertible()); |
| 71 ASSERT(canvasToContentTransform.preservesAxisAlignment()); | 72 ASSERT(canvasToContentTransform.preservesAxisAlignment()); |
| 72 opaque = canvasToContentTransform.mapRect(platformContext.opaqueRegion().asR
ect()); | 73 opaque = canvasToContentTransform.mapRect(platformContext.opaqueRegion().asR
ect()); |
| 73 } | 74 } |
| 74 | 75 |
| 75 } | 76 } |
| OLD | NEW |