diff options
Diffstat (limited to 'skia/ext/bitmap_platform_device_mac.cc')
-rw-r--r-- | skia/ext/bitmap_platform_device_mac.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/skia/ext/bitmap_platform_device_mac.cc b/skia/ext/bitmap_platform_device_mac.cc index 8276545..543fc38 100644 --- a/skia/ext/bitmap_platform_device_mac.cc +++ b/skia/ext/bitmap_platform_device_mac.cc @@ -226,8 +226,8 @@ void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, data_->SetMatrixClip(transform, region); } -void BitmapPlatformDevice::DrawToNativeContext(CGContextRef context, int x, - int y, const CGRect* src_rect) { +void BitmapPlatformDevice::DrawToContext(CGContextRef context, int x, int y, + const CGRect* src_rect) { bool created_dc = false; if (!data_->bitmap_context()) { created_dc = true; @@ -261,6 +261,14 @@ bool BitmapPlatformDevice::IsVectorial() { return false; } +// Returns the color value at the specified location. +SkColor BitmapPlatformDevice::getColorAt(int x, int y) { + const SkBitmap& bitmap = accessBitmap(true); + SkAutoLockPixels lock(bitmap); + uint32_t* data = bitmap.getAddr32(0, 0); + return static_cast<SkColor>(data[x + y * width()]); +} + void BitmapPlatformDevice::onAccessBitmap(SkBitmap*) { // Not needed in CoreGraphics } |