diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 00:01:47 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 00:01:47 +0000 |
commit | 56164f0194e23d5df428bcfa278556cf96ed639a (patch) | |
tree | d52597fb318936393db91d2ad14972ab74443639 /skia/ext/bitmap_platform_device_win.cc | |
parent | aa82299b37136a5de8a842d35eb893be6eb995f8 (diff) | |
download | chromium_src-56164f0194e23d5df428bcfa278556cf96ed639a.zip chromium_src-56164f0194e23d5df428bcfa278556cf96ed639a.tar.gz chromium_src-56164f0194e23d5df428bcfa278556cf96ed639a.tar.bz2 |
Move BitmapPlatformDevice::makeOpaque into a shared file
so it's implemented on all platforms. This makes the method
available on Linux+Mac, while removing
BitmapPlatformDevice::processPixels from Mac (doesn't appear to
be used anywhere).
Review URL: http://codereview.chromium.org/3227007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/bitmap_platform_device_win.cc')
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 76f0ea3..490ad77 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -15,37 +15,6 @@ namespace skia { -namespace { - -// Constrains position and size to fit within available_size. If |size| is -1, -// all the available_size is used. Returns false if the position is out of -// available_size. -bool Constrain(int available_size, int* position, int *size) { - if (*size < -2) - return false; - - if (*position < 0) { - if (*size != -1) - *size += *position; - *position = 0; - } - if (*size == 0 || *position >= available_size) - return false; - - if (*size > 0) { - int overflow = (*position + *size) - available_size; - if (overflow > 0) { - *size -= overflow; - } - } else { - // Fill up available size. - *size = available_size - *position; - } - return true; -} - -} // namespace - BitmapPlatformDevice::BitmapPlatformDeviceData::BitmapPlatformDeviceData( HBITMAP hbitmap) : bitmap_context_(hbitmap), @@ -286,34 +255,6 @@ void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, data_->ReleaseBitmapDC(); } -void BitmapPlatformDevice::makeOpaque(int x, int y, int width, int height) { - const SkBitmap& bitmap = accessBitmap(true); - SkASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); - - // FIXME(brettw): This is kind of lame, we shouldn't be dealing with - // transforms at this level. Probably there should be a PlatformCanvas - // function that does the transform (using the actual transform not just the - // translation) and calls us with the transformed rect. - const SkMatrix& matrix = data_->transform(); - int bitmap_start_x = SkScalarRound(matrix.getTranslateX()) + x; - int bitmap_start_y = SkScalarRound(matrix.getTranslateY()) + y; - - if (Constrain(bitmap.width(), &bitmap_start_x, &width) && - Constrain(bitmap.height(), &bitmap_start_y, &height)) { - SkAutoLockPixels lock(bitmap); - SkASSERT(bitmap.rowBytes() % sizeof(uint32_t) == 0u); - size_t row_words = bitmap.rowBytes() / sizeof(uint32_t); - // Set data to the first pixel to be modified. - uint32_t* data = bitmap.getAddr32(0, 0) + (bitmap_start_y * row_words) + - bitmap_start_x; - for (int i = 0; i < height; i++) { - for (int j = 0; j < width; j++) - data[j] |= (0xFF << SK_A32_SHIFT); - data += row_words; - } - } -} - // Returns the color value at the specified location. SkColor BitmapPlatformDevice::getColorAt(int x, int y) { const SkBitmap& bitmap = accessBitmap(false); |