| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 LocalCurrentGraphicsContext::LocalCurrentGraphicsContext( | 45 LocalCurrentGraphicsContext::LocalCurrentGraphicsContext( |
| 46 SkCanvas* canvas, | 46 SkCanvas* canvas, |
| 47 float deviceScaleFactor, | 47 float deviceScaleFactor, |
| 48 const IntRect& dirtyRect) | 48 const IntRect& dirtyRect) |
| 49 : m_didSetGraphicsContext(false), | 49 : m_didSetGraphicsContext(false), |
| 50 m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect)), | 50 m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect)), |
| 51 m_skiaBitLocker(canvas, m_inflatedDirtyRect, deviceScaleFactor) { | 51 m_skiaBitLocker(canvas, m_inflatedDirtyRect, deviceScaleFactor) { |
| 52 m_savedCanvas = canvas; | 52 m_savedCanvas = canvas; |
| 53 canvas->save(); | 53 canvas->save(); |
| 54 | 54 |
| 55 // Constrain the maximum size of what we paint to something reasonable. This a
ccordingly | 55 // Constrain the maximum size of what we paint to something reasonable. This |
| 56 // means we will not paint the entirety of truly huge native form elements, wh
ich is | 56 // accordingly means we will not paint the entirety of truly huge native form |
| 57 // deemed an acceptable tradeoff for this simple approach to manage such an ed
ge case. | 57 // elements, which is deemed an acceptable tradeoff for this simple approach |
| 58 // to manage such an edge case. |
| 58 if (dirtyRect.width() > kMaxDirtyRectPixelSize || | 59 if (dirtyRect.width() > kMaxDirtyRectPixelSize || |
| 59 dirtyRect.height() > kMaxDirtyRectPixelSize) | 60 dirtyRect.height() > kMaxDirtyRectPixelSize) |
| 60 canvas->clipRect(clampRect(kMaxDirtyRectPixelSize, dirtyRect), | 61 canvas->clipRect(clampRect(kMaxDirtyRectPixelSize, dirtyRect), |
| 61 SkRegion::kIntersect_Op); | 62 SkRegion::kIntersect_Op); |
| 62 | 63 |
| 63 CGContextRef cgContext = this->cgContext(); | 64 CGContextRef cgContext = this->cgContext(); |
| 64 if (cgContext == [[NSGraphicsContext currentContext] graphicsPort]) { | 65 if (cgContext == [[NSGraphicsContext currentContext] graphicsPort]) { |
| 65 m_savedNSGraphicsContext = 0; | 66 m_savedNSGraphicsContext = 0; |
| 66 return; | 67 return; |
| 67 } | 68 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 83 } | 84 } |
| 84 | 85 |
| 85 CGContextRef LocalCurrentGraphicsContext::cgContext() { | 86 CGContextRef LocalCurrentGraphicsContext::cgContext() { |
| 86 // This synchronizes the CGContext to reflect the current SkCanvas state. | 87 // This synchronizes the CGContext to reflect the current SkCanvas state. |
| 87 // The implementation may not return the same CGContext each time. | 88 // The implementation may not return the same CGContext each time. |
| 88 CGContextRef cgContext = m_skiaBitLocker.cgContext(); | 89 CGContextRef cgContext = m_skiaBitLocker.cgContext(); |
| 89 | 90 |
| 90 return cgContext; | 91 return cgContext; |
| 91 } | 92 } |
| 92 } | 93 } |
| OLD | NEW |