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

Unified Diff: skia/ext/bitmap_platform_device_win.cc

Issue 3227007: Move BitmapPlatformDevice::makeOpaque into a shared file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/platform_device_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_win.cc
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc
index 76f0ea3f53ea4015098fb454cf72912d735771e3..490ad775d3f79907e7ec889973c52c04dcfbf40e 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);
« no previous file with comments | « skia/ext/bitmap_platform_device_mac.cc ('k') | skia/ext/platform_device_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698