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

Side by Side Diff: skia/ext/bitmap_platform_device_linux.cc

Issue 10828069: return NULL if we failed to allocate a cairo surface, rather than waiting for skia to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "skia/ext/bitmap_platform_device_linux.h" 5 #include "skia/ext/bitmap_platform_device_linux.h"
6 6
7 #include "skia/ext/bitmap_platform_device_data.h" 7 #include "skia/ext/bitmap_platform_device_data.h"
8 8
9 #if defined(OS_OPENBSD) 9 #if defined(OS_OPENBSD)
10 #include <cairo.h> 10 #include <cairo.h>
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // The device object will take ownership of the graphics context. 92 // The device object will take ownership of the graphics context.
93 return new BitmapPlatformDevice 93 return new BitmapPlatformDevice
94 (bitmap, new BitmapPlatformDeviceData(surface)); 94 (bitmap, new BitmapPlatformDeviceData(surface));
95 } 95 }
96 96
97 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, 97 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
98 bool is_opaque) { 98 bool is_opaque) {
99 // This initializes the bitmap to all zeros. 99 // This initializes the bitmap to all zeros.
100 cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 100 cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
101 width, height); 101 width, height);
102 if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
103 cairo_surface_destroy(surface);
104 return NULL;
105 }
102 106
103 BitmapPlatformDevice* device = Create(width, height, is_opaque, surface); 107 BitmapPlatformDevice* device = Create(width, height, is_opaque, surface);
104 108
105 #ifndef NDEBUG 109 #ifndef NDEBUG
106 if (is_opaque) // Fill with bright bluish green 110 if (is_opaque) // Fill with bright bluish green
107 device->eraseColor(SkColorSetARGB(255, 0, 255, 128)); 111 device->eraseColor(SkColorSetARGB(255, 0, 255, 128));
108 #endif 112 #endif
109 113
110 return device; 114 return device;
111 } 115 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 SkASSERT(false); 170 SkASSERT(false);
167 } 171 }
168 172
169 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 173 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
170 const SkRegion& region, 174 const SkRegion& region,
171 const SkClipStack&) { 175 const SkClipStack&) {
172 data_->SetMatrixClip(transform, region); 176 data_->SetMatrixClip(transform, region);
173 } 177 }
174 178
175 } // namespace skia 179 } // namespace skia
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698