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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Remove PlatformCanvas::getTopDevice. Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #include <time.h> 8 #include <time.h>
9 9
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 data_->LoadConfig(); 219 data_->LoadConfig();
220 return data_->bitmap_context(); 220 return data_->bitmap_context();
221 } 221 }
222 222
223 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, 223 void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
224 const SkRegion& region, 224 const SkRegion& region,
225 const SkClipStack&) { 225 const SkClipStack&) {
226 data_->SetMatrixClip(transform, region); 226 data_->SetMatrixClip(transform, region);
227 } 227 }
228 228
229 void BitmapPlatformDevice::DrawToContext(CGContextRef context, int x, int y, 229 void BitmapPlatformDevice::DrawToNativeContext(CGContextRef context, int x,
230 const CGRect* src_rect) { 230 int y, const CGRect* src_rect) {
231 bool created_dc = false; 231 bool created_dc = false;
232 if (!data_->bitmap_context()) { 232 if (!data_->bitmap_context()) {
233 created_dc = true; 233 created_dc = true;
234 GetBitmapContext(); 234 GetBitmapContext();
235 } 235 }
236 236
237 // this should not make a copy of the bits, since we're not doing 237 // this should not make a copy of the bits, since we're not doing
238 // anything to trigger copy on write 238 // anything to trigger copy on write
239 CGImageRef image = CGBitmapContextCreateImage(data_->bitmap_context()); 239 CGImageRef image = CGBitmapContextCreateImage(data_->bitmap_context());
240 CGRect bounds; 240 CGRect bounds;
(...skipping 13 matching lines...) Expand all
254 CGImageRelease(image); 254 CGImageRelease(image);
255 255
256 if (created_dc) 256 if (created_dc)
257 data_->ReleaseBitmapContext(); 257 data_->ReleaseBitmapContext();
258 } 258 }
259 259
260 bool BitmapPlatformDevice::IsVectorial() { 260 bool BitmapPlatformDevice::IsVectorial() {
261 return false; 261 return false;
262 } 262 }
263 263
264 // Returns the color value at the specified location.
265 SkColor BitmapPlatformDevice::getColorAt(int x, int y) {
266 const SkBitmap& bitmap = accessBitmap(true);
267 SkAutoLockPixels lock(bitmap);
268 uint32_t* data = bitmap.getAddr32(0, 0);
269 return static_cast<SkColor>(data[x + y * width()]);
270 }
271
272 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { 264 void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) {
273 // Not needed in CoreGraphics 265 // Not needed in CoreGraphics
274 } 266 }
275 267
276 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() { 268 SkDeviceFactory* BitmapPlatformDevice::onNewDeviceFactory() {
277 return SkNEW(BitmapPlatformDeviceFactory); 269 return SkNEW(BitmapPlatformDeviceFactory);
278 } 270 }
279 271
280 } // namespace skia 272 } // namespace skia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698