| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 OpaqueRectTrackingContentLayerDelegate::~OpaqueRectTrackingContentLayerDelegate(
) | 43 OpaqueRectTrackingContentLayerDelegate::~OpaqueRectTrackingContentLayerDelegate(
) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con
st IntRect& clip, IntRect& opaque) | 47 void OpaqueRectTrackingContentLayerDelegate::paintContents(SkCanvas* canvas, con
st IntRect& clip, IntRect& opaque) |
| 48 { | 48 { |
| 49 PlatformContextSkia platformContext(canvas); | 49 PlatformContextSkia platformContext(canvas); |
| 50 platformContext.setTrackOpaqueRegion(!m_opaque); | 50 platformContext.setTrackOpaqueRegion(!m_opaque); |
| 51 GraphicsContext context(&platformContext); | 51 GraphicsContext context(&platformContext); |
| 52 | 52 |
| 53 context.clearRect(clip); | |
| 54 context.clip(clip); | |
| 55 | |
| 56 // Record transform prior to painting, as all opaque tracking will be | 53 // Record transform prior to painting, as all opaque tracking will be |
| 57 // relative to this current value. | 54 // relative to this current value. |
| 58 AffineTransform canvasToContentTransform = context.getCTM().inverse(); | 55 AffineTransform canvasToContentTransform = context.getCTM().inverse(); |
| 59 | 56 |
| 60 m_painter->paint(context, clip); | 57 m_painter->paint(context, clip); |
| 61 | 58 |
| 62 // Transform tracked opaque paints back to our layer's content space. | 59 // Transform tracked opaque paints back to our layer's content space. |
| 63 ASSERT(canvasToContentTransform.isInvertible()); | 60 ASSERT(canvasToContentTransform.isInvertible()); |
| 64 ASSERT(canvasToContentTransform.preservesAxisAlignment()); | 61 ASSERT(canvasToContentTransform.preservesAxisAlignment()); |
| 65 FloatRect opaqueCanvasRect = platformContext.opaqueRegion().asRect(); | 62 FloatRect opaqueCanvasRect = platformContext.opaqueRegion().asRect(); |
| 66 opaque = enclosedIntRect(canvasToContentTransform.mapRect(opaqueCanvasRect))
; | 63 opaque = enclosedIntRect(canvasToContentTransform.mapRect(opaqueCanvasRect))
; |
| 67 } | 64 } |
| 68 | 65 |
| 69 } | 66 } |
| OLD | NEW |