Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.mm

Issue 2705723002: Convert SkiaBitLocker to use PaintCanvas (Closed)
Patch Set: Remove rogue cc:: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 43
44 static const int kMaxDirtyRectPixelSize = 10000; 44 static const int kMaxDirtyRectPixelSize = 10000;
45 45
46 LocalCurrentGraphicsContext::LocalCurrentGraphicsContext( 46 LocalCurrentGraphicsContext::LocalCurrentGraphicsContext(
47 PaintCanvas* canvas, 47 PaintCanvas* canvas,
48 float deviceScaleFactor, 48 float deviceScaleFactor,
49 const IntRect& dirtyRect) 49 const IntRect& dirtyRect)
50 : m_didSetGraphicsContext(false), 50 : m_didSetGraphicsContext(false),
51 m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect)), 51 m_inflatedDirtyRect(ThemeMac::inflateRectForAA(dirtyRect)),
52 m_skiaBitLocker(canvas, m_inflatedDirtyRect, deviceScaleFactor) { 52 m_graphicsContextCanvas(canvas, m_inflatedDirtyRect, deviceScaleFactor) {
53 m_savedCanvas = canvas; 53 m_savedCanvas = canvas;
54 canvas->save(); 54 canvas->save();
55 55
56 // Constrain the maximum size of what we paint to something reasonable. This 56 // Constrain the maximum size of what we paint to something reasonable. This
57 // accordingly means we will not paint the entirety of truly huge native form 57 // accordingly means we will not paint the entirety of truly huge native form
58 // elements, which is deemed an acceptable tradeoff for this simple approach 58 // elements, which is deemed an acceptable tradeoff for this simple approach
59 // to manage such an edge case. 59 // to manage such an edge case.
60 if (dirtyRect.width() > kMaxDirtyRectPixelSize || 60 if (dirtyRect.width() > kMaxDirtyRectPixelSize ||
61 dirtyRect.height() > kMaxDirtyRectPixelSize) 61 dirtyRect.height() > kMaxDirtyRectPixelSize)
62 canvas->clipRect(clampRect(kMaxDirtyRectPixelSize, dirtyRect), 62 canvas->clipRect(clampRect(kMaxDirtyRectPixelSize, dirtyRect),
(...skipping 17 matching lines...) Expand all
80 [NSGraphicsContext setCurrentContext:m_savedNSGraphicsContext]; 80 [NSGraphicsContext setCurrentContext:m_savedNSGraphicsContext];
81 [m_savedNSGraphicsContext release]; 81 [m_savedNSGraphicsContext release];
82 } 82 }
83 83
84 m_savedCanvas->restore(); 84 m_savedCanvas->restore();
85 } 85 }
86 86
87 CGContextRef LocalCurrentGraphicsContext::cgContext() { 87 CGContextRef LocalCurrentGraphicsContext::cgContext() {
88 // This synchronizes the CGContext to reflect the current SkCanvas state. 88 // This synchronizes the CGContext to reflect the current SkCanvas state.
89 // The implementation may not return the same CGContext each time. 89 // The implementation may not return the same CGContext each time.
90 CGContextRef cgContext = m_skiaBitLocker.cgContext(); 90 CGContextRef cgContext = m_graphicsContextCanvas.cgContext();
91 91
92 return cgContext; 92 return cgContext;
93 } 93 }
94 } 94 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/mac/LocalCurrentGraphicsContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698