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

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

Issue 126150: Rename CreateWithContext to Create (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/platform_canvas_mac.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_mac.h" 5 #include "skia/ext/bitmap_platform_device_mac.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "skia/ext/skia_utils_mac.h" 10 #include "skia/ext/skia_utils_mac.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 t.setTranslateX(-t.getTranslateX()); 168 t.setTranslateX(-t.getTranslateX());
169 t.setTranslateY(-t.getTranslateY()); 169 t.setTranslateY(-t.getTranslateY());
170 LoadClippingRegionToCGContext(bitmap_context_, clip_region_, t); 170 LoadClippingRegionToCGContext(bitmap_context_, clip_region_, t);
171 } 171 }
172 172
173 173
174 // We use this static factory function instead of the regular constructor so 174 // We use this static factory function instead of the regular constructor so
175 // that we can create the pixel data before calling the constructor. This is 175 // that we can create the pixel data before calling the constructor. This is
176 // required so that we can call the base class' constructor with the pixel 176 // required so that we can call the base class' constructor with the pixel
177 // data. 177 // data.
178 BitmapPlatformDevice* BitmapPlatformDevice::CreateWithContext( 178 BitmapPlatformDevice* BitmapPlatformDevice::Create(CGContextRef context,
179 CGContextRef context, int width, int height, bool is_opaque) { 179 int width,
180 int height,
181 bool is_opaque) {
180 SkBitmap bitmap; 182 SkBitmap bitmap;
181 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); 183 bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
182 if (bitmap.allocPixels() != true) 184 if (bitmap.allocPixels() != true)
183 return NULL; 185 return NULL;
184 186
185 void* data = NULL; 187 void* data = NULL;
186 if (context) { 188 if (context) {
187 data = CGBitmapContextGetData(context); 189 data = CGBitmapContextGetData(context);
188 bitmap.setPixels(data); 190 bitmap.setPixels(data);
189 } else { 191 } else {
(...skipping 24 matching lines...) Expand all
214 } 216 }
215 217
216 BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data, 218 BitmapPlatformDevice* BitmapPlatformDevice::CreateWithData(uint8_t* data,
217 int width, 219 int width,
218 int height, 220 int height,
219 bool is_opaque) { 221 bool is_opaque) {
220 CGContextRef context = NULL; 222 CGContextRef context = NULL;
221 if (data) 223 if (data)
222 context = CGContextForData(data, width, height); 224 context = CGContextForData(data, width, height);
223 225
224 return CreateWithContext(context, width, height, is_opaque); 226 return Create(context, width, height, is_opaque);
225 } 227 }
226 228
227 // The device will own the bitmap, which corresponds to also owning the pixel 229 // The device will own the bitmap, which corresponds to also owning the pixel
228 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap. 230 // data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
229 BitmapPlatformDevice::BitmapPlatformDevice( 231 BitmapPlatformDevice::BitmapPlatformDevice(
230 BitmapPlatformDeviceData* data, const SkBitmap& bitmap) 232 BitmapPlatformDeviceData* data, const SkBitmap& bitmap)
231 : PlatformDevice(bitmap), 233 : PlatformDevice(bitmap),
232 data_(data) { 234 data_(data) {
233 } 235 }
234 236
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 for (int i = 0; i < height; i++) { 325 for (int i = 0; i < height; i++) {
324 size_t offset = (i + bitmap_start_y) * row_words + bitmap_start_x; 326 size_t offset = (i + bitmap_start_y) * row_words + bitmap_start_x;
325 for (int j = 0; j < width; j++) { 327 for (int j = 0; j < width; j++) {
326 adjustor(data + offset + j); 328 adjustor(data + offset + j);
327 } 329 }
328 } 330 }
329 } 331 }
330 } 332 }
331 333
332 } // namespace skia 334 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.h ('k') | skia/ext/platform_canvas_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698