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

Side by Side Diff: ui/gfx/mac/io_surface.cc

Issue 1825283003: [Merge to 2623] Disable IOSurface clearing on OS X 10.9. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 9 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 | « no previous file | ui/gl/test/gl_image_test_template.h » ('j') | ui/gl/test/gl_image_test_template.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/mac/io_surface.h" 5 #include "ui/gfx/mac/io_surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/mac/mac_util.h"
11 #include "base/mac/mach_logging.h" 12 #include "base/mac/mach_logging.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "ui/gfx/buffer_format_util.h" 14 #include "ui/gfx/buffer_format_util.h"
14 15
15 namespace gfx { 16 namespace gfx {
16 17
17 namespace { 18 namespace {
18 19
19 void AddIntegerValue(CFMutableDictionaryRef dictionary, 20 void AddIntegerValue(CFMutableDictionaryRef dictionary,
20 const CFStringRef key, 21 const CFStringRef key,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 AddIntegerValue(properties, kIOSurfacePixelFormat, PixelFormat(format)); 144 AddIntegerValue(properties, kIOSurfacePixelFormat, PixelFormat(format));
144 if (num_planes > 1) { 145 if (num_planes > 1) {
145 CFDictionaryAddValue(properties, kIOSurfacePlaneInfo, planes); 146 CFDictionaryAddValue(properties, kIOSurfacePlaneInfo, planes);
146 } else { 147 } else {
147 AddIntegerValue(properties, kIOSurfaceBytesPerElement, 148 AddIntegerValue(properties, kIOSurfaceBytesPerElement,
148 BytesPerElement(format, 0)); 149 BytesPerElement(format, 0));
149 } 150 }
150 151
151 IOSurfaceRef surface = IOSurfaceCreate(properties); 152 IOSurfaceRef surface = IOSurfaceCreate(properties);
152 153
153 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock 154 // For unknown reasons, triggering this lock on OS X 10.9, on certain GPUs,
154 // appears to be sufficient. https://crbug.com/584760#c17 155 // causes PDFs to render incorrectly. Hopefully this check can be removed once
155 IOReturn r = IOSurfaceLock(surface, 0, nullptr); 156 // pdfium switches to a Skia backend on Mac.
156 DCHECK_EQ(kIOReturnSuccess, r); 157 // https://crbug.com/594343.
157 r = IOSurfaceUnlock(surface, 0, nullptr); 158 if (!base::mac::IsOSMavericks()) {
158 DCHECK_EQ(kIOReturnSuccess, r); 159 // Zero-initialize the IOSurface. Calling IOSurfaceLock/IOSurfaceUnlock
160 // appears to be sufficient. https://crbug.com/584760#c17
161 IOReturn r = IOSurfaceLock(surface, 0, nullptr);
162 DCHECK_EQ(kIOReturnSuccess, r);
163 r = IOSurfaceUnlock(surface, 0, nullptr);
164 DCHECK_EQ(kIOReturnSuccess, r);
165 }
159 166
160 return surface; 167 return surface;
161 } 168 }
162 169
163 } // namespace gfx 170 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gl/test/gl_image_test_template.h » ('j') | ui/gl/test/gl_image_test_template.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698